From: Jarod Wilson <jarod@redhat.com>
To: linux-media@vger.kernel.org
Cc: Jarod Wilson <jarod@redhat.com>
Subject: [PATCH 8/9] [media] mceusb: report actual tx frequencies
Date: Thu, 14 Jul 2011 18:09:53 -0400 [thread overview]
Message-ID: <1310681394-3530-9-git-send-email-jarod@redhat.com> (raw)
In-Reply-To: <1310681394-3530-1-git-send-email-jarod@redhat.com>
Rather than dumping out hex values, lets print the actual calculated
frequency and period the hardware has been configured for. After this
change:
[ 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>
---
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 bbd79c0..fa1d182 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -517,6 +517,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
u8 cmd, subcmd, data1, data2, data3, data4, data5;
struct device *dev = ir->dev;
int i, start, skip = 0;
+ u32 carrier, period;
if (!debug)
return;
@@ -614,9 +615,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",
data1, data2);
break;
- case MCE_CMD_SETIRCFS:
- dev_info(dev, "%s carrier mode and freq of "
- "0x%02x 0x%02x\n", inout, data1, data2);
+ case MCE_RSP_EQIRCFS:
+ period = DIV_ROUND_CLOSEST(
+ (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;
case MCE_CMD_GETIRCFS:
dev_info(dev, "Get carrier mode and freq\n");
@@ -627,9 +633,9 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
break;
case MCE_RSP_EQIRTIMEOUT:
/* 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",
- inout,
- ((data1 << 8) | data2) * MCE_TIME_UNIT / 1000);
+ inout, period);
break;
case MCE_CMD_GETIRTIMEOUT:
dev_info(dev, "Get receive timeout\n");
--
1.7.1
next prev parent reply other threads:[~2011-07-14 22:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-14 22:09 [PATCH 0/9] mceusb updates per MS docs Jarod Wilson
2011-07-14 22:09 ` [PATCH 1/9] [media] mceusb: command/response updates from " Jarod Wilson
2011-07-14 22:09 ` [PATCH 2/9] [media] mceusb: give hardware time to reply to cmds Jarod Wilson
2011-07-14 23:30 ` Mauro Carvalho Chehab
2011-07-18 17:47 ` Jarod Wilson
2011-07-18 18:11 ` Jarod Wilson
2011-07-14 22:09 ` [PATCH 3/9] [media] mceusb: set wakeup bits for IR-based resume Jarod Wilson
2011-07-14 22:09 ` [PATCH 4/9] [media] mceusb: issue device resume cmd when needed Jarod Wilson
2011-07-14 22:09 ` [PATCH 5/9] [media] mceusb: query device for firmware emulator version Jarod Wilson
2011-07-14 22:09 ` [PATCH 6/9] [media] mceusb: get misc port data from hardware Jarod Wilson
2011-07-14 22:09 ` [PATCH 7/9] [media] mceusb: flash LED (emu v2+ only) to signal end of init Jarod Wilson
2011-07-14 22:09 ` Jarod Wilson [this message]
2011-07-14 22:09 ` [PATCH 9/9] [media] mceusb: update version, copyright, author Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 0/9] mceusb updates per MS docs Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 1/9] [media] mceusb: command/response updates from " Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 2/9] [media] mceusb: give hardware time to reply to cmds Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 3/9] [media] mceusb: set wakeup bits for IR-based resume Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 4/9] [media] mceusb: issue device resume cmd when needed Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 5/9] [media] mceusb: query device for firmware emulator version Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 6/9] [media] mceusb: get misc port data from hardware Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 7/9] [media] mceusb: flash LED (emu v2+ only) to signal end of init Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 8/9] [media] mceusb: report actual tx frequencies Jarod Wilson
2011-07-18 19:54 ` [PATCH v2 9/9] [media] mceusb: update version, copyright, author Jarod Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310681394-3530-9-git-send-email-jarod@redhat.com \
--to=jarod@redhat.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox