From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Andy Walls <awalls@md.metrocast.net>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH 0/8] Fix V4L/DVB/RC warnings
Date: Tue, 28 Dec 2010 12:45:29 -0200 [thread overview]
Message-ID: <4D19F809.3010409@redhat.com> (raw)
In-Reply-To: <1293545649.2728.28.camel@morgan.silverblock.net>
Em 28-12-2010 12:14, Andy Walls escreveu:
> On Tue, 2010-12-28 at 01:12 -0200, Mauro Carvalho Chehab wrote:
>> Em 27-12-2010 21:55, Andy Walls escreveu:
>>> I have hardware for lirc_zilog. I can look later this week.
>>
>> That would be great!
>
> It shouldn't be hard to fix up the lirc_zilog.c use of adap->id but it
> may require a change to the hdpvr driver as well.
>
> As I was looking, I noticed this commit is incomplete:
>
> http://git.linuxtv.org/media_tree.git?a=commitdiff;h=07cc65d4f4a21a104269ff7e4e7be42bd26d7acb
>
> The "goto" was missed in the conditional compilation for the HD-PVR:
>
> http://git.linuxtv.org/media_tree.git?a=blob;f=drivers/staging/lirc/lirc_zilog.c;h=f0076eb025f1a0e9d412080caab87f627dda4970#l844
>
> You might want to revert the trivial commit that removed the "done:"
> label. When I clean up the dependence on adap->id, I may need the
> "done:" label back again.
>
>
Argh! this is not a very nice code at all...
I think that the proper way is to apply the enclosed patch. After having it
fixed, the dont_wait parameter can be passed to the driver via platform_data.
So, we should add a field at struct IR for it.
Cheers,
Mauro
lirc_zilog: Fix the TX logic for hd-pvr
The dont_wait parameter should be passed to the driver via platform_data, in order
to allow removing the usage of the legacy i2c_adapter.id field.
So, we should add a field at struct IR for it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c
index 52be6de..8486b66 100644
--- a/drivers/staging/lirc/lirc_zilog.c
+++ b/drivers/staging/lirc/lirc_zilog.c
@@ -88,6 +88,7 @@ struct IR {
struct i2c_client c_tx;
int need_boot;
int have_tx;
+ bool dont_wait;
};
/* Minor -> data mapping */
@@ -841,46 +842,43 @@ static int send_code(struct IR *ir, unsigned int code, unsigned int key)
return ret < 0 ? ret : -EFAULT;
}
-#ifdef I2C_HW_B_HDPVR
/*
* The sleep bits aren't necessary on the HD PVR, and in fact, the
* last i2c_master_recv always fails with a -5, so for now, we're
* going to skip this whole mess and say we're done on the HD PVR
*/
- if (ir->c_rx.adapter->id == I2C_HW_B_HDPVR)
- goto done;
-#endif
-
- /*
- * This bit NAKs until the device is ready, so we retry it
- * sleeping a bit each time. This seems to be what the windows
- * driver does, approximately.
- * Try for up to 1s.
- */
- for (i = 0; i < 20; ++i) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout((50 * HZ + 999) / 1000);
- ret = i2c_master_send(&ir->c_tx, buf, 1);
- if (ret == 1)
- break;
- dprintk("NAK expected: i2c_master_send "
- "failed with %d (try %d)\n", ret, i+1);
- }
- if (ret != 1) {
- zilog_error("IR TX chip never got ready: last i2c_master_send "
- "failed with %d\n", ret);
- return ret < 0 ? ret : -EFAULT;
- }
+ if (!ir->dont_wait) {
+ /*
+ * This bit NAKs until the device is ready, so we retry it
+ * sleeping a bit each time. This seems to be what the
+ * windows driver does, approximately.
+ * Try for up to 1s.
+ */
+ for (i = 0; i < 20; ++i) {
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout((50 * HZ + 999) / 1000);
+ ret = i2c_master_send(&ir->c_tx, buf, 1);
+ if (ret == 1)
+ break;
+ dprintk("NAK expected: i2c_master_send "
+ "failed with %d (try %d)\n", ret, i+1);
+ }
+ if (ret != 1) {
+ zilog_error("IR TX chip never got ready: last i2c_master_send "
+ "failed with %d\n", ret);
+ return ret < 0 ? ret : -EFAULT;
+ }
- /* Seems to be an 'ok' response */
- i = i2c_master_recv(&ir->c_tx, buf, 1);
- if (i != 1) {
- zilog_error("i2c_master_recv failed with %d\n", ret);
- return -EFAULT;
- }
- if (buf[0] != 0x80) {
- zilog_error("unexpected IR TX response #2: %02x\n", buf[0]);
- return -EFAULT;
+ /* Seems to be an 'ok' response */
+ i = i2c_master_recv(&ir->c_tx, buf, 1);
+ if (i != 1) {
+ zilog_error("i2c_master_recv failed with %d\n", ret);
+ return -EFAULT;
+ }
+ if (buf[0] != 0x80) {
+ zilog_error("unexpected IR TX response #2: %02x\n", buf[0]);
+ return -EFAULT;
+ }
}
/* Oh good, it worked */
@@ -1278,6 +1276,11 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
strlcpy(ir->c_tx.name, ZILOG_HAUPPAUGE_IR_TX_NAME,
I2C_NAME_SIZE);
ir->have_tx = 1;
+
+#ifdef I2C_HW_B_HDPVR
+ if (ir->c_rx.adapter->id == I2C_HW_B_HDPVR)
+ ir->dont_wait = true;
+#endif
}
/* set lirc_dev stuff */
next prev parent reply other threads:[~2010-12-28 14:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-27 23:55 [PATCH 0/8] Fix V4L/DVB/RC warnings Andy Walls
2010-12-28 3:12 ` Mauro Carvalho Chehab
2010-12-28 14:14 ` Andy Walls
2010-12-28 14:45 ` Mauro Carvalho Chehab [this message]
2010-12-28 22:18 ` Andy Walls
2011-01-06 21:54 ` Jarod Wilson
-- strict thread matches above, loose matches on Subject: below --
2010-12-27 16:22 Mauro Carvalho Chehab
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=4D19F809.3010409@redhat.com \
--to=mchehab@redhat.com \
--cc=awalls@md.metrocast.net \
--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