diff options
author | Jarod Wilson <jarod@redhat.com> | 2011-07-18 15:54:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-08-27 07:56:39 -0400 |
commit | e217fb43c47830857a685673ae0dc3e28493bb88 (patch) | |
tree | cbe429b68ec0e79c2e078b86c953a0ecd599de2e /drivers/media/rc/mceusb.c | |
parent | b71969bee23ea0c44c594e5027ba26029d27afea (diff) |
[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: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/mceusb.c')
-rw-r--r-- | drivers/media/rc/mceusb.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 8fa5a725bed7..e51637f46ab2 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c | |||
@@ -516,6 +516,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | |||
516 | u8 cmd, subcmd, data1, data2, data3, data4, data5; | 516 | u8 cmd, subcmd, data1, data2, data3, data4, data5; |
517 | struct device *dev = ir->dev; | 517 | struct device *dev = ir->dev; |
518 | int i, start, skip = 0; | 518 | int i, start, skip = 0; |
519 | u32 carrier, period; | ||
519 | 520 | ||
520 | if (!debug) | 521 | if (!debug) |
521 | return; | 522 | return; |
@@ -613,9 +614,14 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | |||
613 | dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n", | 614 | dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n", |
614 | data1, data2); | 615 | data1, data2); |
615 | break; | 616 | break; |
616 | case MCE_CMD_SETIRCFS: | 617 | case MCE_RSP_EQIRCFS: |
617 | dev_info(dev, "%s carrier mode and freq of " | 618 | period = DIV_ROUND_CLOSEST( |
618 | "0x%02x 0x%02x\n", inout, data1, data2); | 619 | (1 << data1 * 2) * (data2 + 1), 10); |
620 | if (!period) | ||
621 | break; | ||
622 | carrier = (1000 * 1000) / period; | ||
623 | dev_info(dev, "%s carrier of %u Hz (period %uus)\n", | ||
624 | inout, carrier, period); | ||
619 | break; | 625 | break; |
620 | case MCE_CMD_GETIRCFS: | 626 | case MCE_CMD_GETIRCFS: |
621 | dev_info(dev, "Get carrier mode and freq\n"); | 627 | 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 | break; | 632 | break; |
627 | case MCE_RSP_EQIRTIMEOUT: | 633 | case MCE_RSP_EQIRTIMEOUT: |
628 | /* value is in units of 50us, so x*50/1000 ms */ | 634 | /* value is in units of 50us, so x*50/1000 ms */ |
635 | period = ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000; | ||
629 | dev_info(dev, "%s receive timeout of %d ms\n", | 636 | dev_info(dev, "%s receive timeout of %d ms\n", |
630 | inout, | 637 | inout, period); |
631 | ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000); | ||
632 | break; | 638 | break; |
633 | case MCE_CMD_GETIRTIMEOUT: | 639 | case MCE_CMD_GETIRTIMEOUT: |
634 | dev_info(dev, "Get receive timeout\n"); | 640 | dev_info(dev, "Get receive timeout\n"); |