Commit e217fb43 authored by Jarod Wilson's avatar Jarod Wilson Committed by Mauro Carvalho Chehab

[media] mceusb: report actual tx frequencies

Rather than dumping out hex values, lets print the actual calculated
frequency and period the hardware has been configured for. After this

[ 2643.276215] mceusb 3-1:1.0: tx data: 9f 07 (length=2)
[ 2643.276218] mceusb 3-1:1.0: Get carrier mode and freq
[ 2643.277206] mceusb 3-1:1.0: rx data: 9f 06 01 42 (length=4)
[ 2643.277209] mceusb 3-1:1.0: Got carrier of 37037 Hz (period 27us)

Matches up perfectly with the table in Microsoft's docs.

Of course, I've noticed on one of my devices that the MS-recommended
default value of 1 for carrier pre-scaler and 66 for carrier period was
butchered, and instead of converting 66 to hex (0x42 like above), they
put in 0x66, so the hardware reports a default carrier of 24390Hz.
Fortunately, I guess, this particular device is rx-only, but I wouldn't
put it past other hw to screw up here too.
Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b71969be
...@@ -516,6 +516,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, ...@@ -516,6 +516,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
u8 cmd, subcmd, data1, data2, data3, data4, data5; u8 cmd, subcmd, data1, data2, data3, data4, data5;
struct device *dev = ir->dev; struct device *dev = ir->dev;
int i, start, skip = 0; int i, start, skip = 0;
u32 carrier, period;
if (!debug) if (!debug)
return; return;
...@@ -613,9 +614,14 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, ...@@ -613,9 +614,14 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n", dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n",
data1, data2); data1, data2);
break; break;
case MCE_CMD_SETIRCFS: case MCE_RSP_EQIRCFS:
dev_info(dev, "%s carrier mode and freq of " period = DIV_ROUND_CLOSEST(
"0x%02x 0x%02x\n", inout, data1, data2); (1 << data1 * 2) * (data2 + 1), 10);
if (!period)
break;
carrier = (1000 * 1000) / period;
dev_info(dev, "%s carrier of %u Hz (period %uus)\n",
inout, carrier, period);
break; break;
case MCE_CMD_GETIRCFS: case MCE_CMD_GETIRCFS:
dev_info(dev, "Get carrier mode and freq\n"); dev_info(dev, "Get carrier mode and freq\n");
...@@ -626,9 +632,9 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, ...@@ -626,9 +632,9 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
break; break;
case MCE_RSP_EQIRTIMEOUT: case MCE_RSP_EQIRTIMEOUT:
/* value is in units of 50us, so x*50/1000 ms */ /* value is in units of 50us, so x*50/1000 ms */
period = ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000;
dev_info(dev, "%s receive timeout of %d ms\n", dev_info(dev, "%s receive timeout of %d ms\n",
inout, inout, period);
((data1 << 8) | data2) * MCE_TIME_UNIT / 1000);
break; break;
case MCE_CMD_GETIRTIMEOUT: case MCE_CMD_GETIRTIMEOUT:
dev_info(dev, "Get receive timeout\n"); dev_info(dev, "Get receive timeout\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment