All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 0/8] Fix V4L/DVB/RC warnings
@ 2010-12-27 23:55 Andy Walls
  2010-12-28  3:12 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Walls @ 2010-12-27 23:55 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List

I have hardware for lirc_zilog.  I can look later this week.
I also have hardware that lirc_i2c handles but not all the hardware it handles.

 IIRC lirc_i2c is very much like ir-kbd-i2c, so do we need it anymore?  I'm not able to check for myself at the moment.

Regards,
Andy

Mauro Carvalho Chehab <mchehab@redhat.com> wrote:

>
>There were several warnings at the subsystem, that were catched with
>gcc version 4.5.1. All of them are fixed on those patches by a 
>trivial patch. So, let's fix them ;)
>
>Now, the only remaining patches are the ones we want to be there:
>
>drivers/staging/lirc/lirc_i2c.c: In function ‘ir_probe’:
>drivers/staging/lirc/lirc_i2c.c:431:3: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>drivers/staging/lirc/lirc_i2c.c:450:3: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>drivers/staging/lirc/lirc_i2c.c:479:9: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>drivers/staging/lirc/lirc_zilog.c: In function ‘ir_probe’:
>drivers/staging/lirc/lirc_zilog.c:1199:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>drivers/media/video/cx88/cx88-i2c.c: In function ‘cx88_i2c_init’:
>drivers/media/video/cx88/cx88-i2c.c:149:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>drivers/media/video/cx88/cx88-vp3054-i2c.c: In function ‘vp3054_i2c_probe’:
>drivers/media/video/cx88/cx88-vp3054-i2c.c:128:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>
>They are basically caused by lirc_i2c and lirc_zilog, that still needs
>to use the legacy .id field at the I2C structs. Somebody with those
>hardware, please fix it.
>
>Thanks,
>Mauro
>
>-
>
>Mauro Carvalho Chehab (8):
>  [media] dmxdev: Fix a compilation warning due to a bad type
>  [media] radio-wl1273: Fix two warnings
>  [media] lirc_zilog: Fix a warning
>  [media] dib7000m/dib7000p: Add support for TRANSMISSION_MODE_4K
>  [media] gspca: Fix a warning for using len before filling it
>  [media] stv090x: Fix some compilation warnings
>  [media] af9013: Fix a compilation warning
>  [media] streamzap: Fix a compilation warning when compiled builtin
>
> drivers/media/dvb/dvb-core/dmxdev.c    |    4 ++--
> drivers/media/dvb/frontends/af9013.c   |    2 +-
> drivers/media/dvb/frontends/dib7000m.c |   10 +++++-----
> drivers/media/dvb/frontends/dib7000p.c |   10 +++++-----
> drivers/media/dvb/frontends/stv090x.c  |    6 +++---
> drivers/media/radio/radio-wl1273.c     |    3 +--
> drivers/media/rc/streamzap.c           |    2 +-
> drivers/media/video/gspca/gspca.c      |    2 +-
> drivers/staging/lirc/lirc_zilog.c      |    1 -
> 9 files changed, 19 insertions(+), 21 deletions(-)
>
>-- 
>1.7.3.4
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-media" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/8] Fix V4L/DVB/RC warnings
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2010-12-28  3:12 UTC (permalink / raw)
  To: Andy Walls; +Cc: Linux Media Mailing List

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!

> I also have hardware that lirc_i2c handles but not all the hardware it handles.
> 
>  IIRC lirc_i2c is very much like ir-kbd-i2c, so do we need it anymore?  I'm not able to check for myself at the moment.

Both ir-kbd-i2c and lirc_i2c have almost the same features. We need to
double-check if all I2C addresses supported by lirc_i2c are also supported
by ir-kbd-i2c and if all I2C chipsets are supported.

> 
> Regards,
> Andy
> 
> Mauro Carvalho Chehab <mchehab@redhat.com> wrote:
> 
>>
>> There were several warnings at the subsystem, that were catched with
>> gcc version 4.5.1. All of them are fixed on those patches by a 
>> trivial patch. So, let's fix them ;)
>>
>> Now, the only remaining patches are the ones we want to be there:
>>
>> drivers/staging/lirc/lirc_i2c.c: In function ‘ir_probe’:
>> drivers/staging/lirc/lirc_i2c.c:431:3: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>> drivers/staging/lirc/lirc_i2c.c:450:3: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>> drivers/staging/lirc/lirc_i2c.c:479:9: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>> drivers/staging/lirc/lirc_zilog.c: In function ‘ir_probe’:
>> drivers/staging/lirc/lirc_zilog.c:1199:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>> drivers/media/video/cx88/cx88-i2c.c: In function ‘cx88_i2c_init’:
>> drivers/media/video/cx88/cx88-i2c.c:149:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>> drivers/media/video/cx88/cx88-vp3054-i2c.c: In function ‘vp3054_i2c_probe’:
>> drivers/media/video/cx88/cx88-vp3054-i2c.c:128:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
>>
>> They are basically caused by lirc_i2c and lirc_zilog, that still needs
>> to use the legacy .id field at the I2C structs. Somebody with those
>> hardware, please fix it.
>>
>> Thanks,
>> Mauro
>>
>> -
>>
>> Mauro Carvalho Chehab (8):
>>  [media] dmxdev: Fix a compilation warning due to a bad type
>>  [media] radio-wl1273: Fix two warnings
>>  [media] lirc_zilog: Fix a warning
>>  [media] dib7000m/dib7000p: Add support for TRANSMISSION_MODE_4K
>>  [media] gspca: Fix a warning for using len before filling it
>>  [media] stv090x: Fix some compilation warnings
>>  [media] af9013: Fix a compilation warning
>>  [media] streamzap: Fix a compilation warning when compiled builtin
>>
>> drivers/media/dvb/dvb-core/dmxdev.c    |    4 ++--
>> drivers/media/dvb/frontends/af9013.c   |    2 +-
>> drivers/media/dvb/frontends/dib7000m.c |   10 +++++-----
>> drivers/media/dvb/frontends/dib7000p.c |   10 +++++-----
>> drivers/media/dvb/frontends/stv090x.c  |    6 +++---
>> drivers/media/radio/radio-wl1273.c     |    3 +--
>> drivers/media/rc/streamzap.c           |    2 +-
>> drivers/media/video/gspca/gspca.c      |    2 +-
>> drivers/staging/lirc/lirc_zilog.c      |    1 -
>> 9 files changed, 19 insertions(+), 21 deletions(-)
>>
>> -- 
>> 1.7.3.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> N�����r��y���b�X��ǧv�^�)޺{.n�+����{���bj)���w*\x1fjg���\x1e�����ݢj/���z�ޖ��2�ޙ���&�)ߡ�a��\x7f��\x1e�G���h�\x0f�j:+v���w�٥


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/8] Fix V4L/DVB/RC warnings
  2010-12-28  3:12 ` Mauro Carvalho Chehab
@ 2010-12-28 14:14   ` Andy Walls
  2010-12-28 14:45     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Walls @ 2010-12-28 14:14 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List

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.



> > I also have hardware that lirc_i2c handles but not all the hardware it handles.
> > 
> >  IIRC lirc_i2c is very much like ir-kbd-i2c, so do we need it
> anymore?  I'm not able to check for myself at the moment.
> 
> Both ir-kbd-i2c and lirc_i2c have almost the same features. We need to
> double-check if all I2C addresses supported by lirc_i2c are also supported
> by ir-kbd-i2c and if all I2C chipsets are supported.

I'll modify lirc_i2c.c in three stages to do this:

1. get rid of adapter->id use
	- Trivial for I2C address 0x71 (the Zilog Z8F0811 chip's IR Rx)
	- Requires modifications to cx88 for the LeadTek PVR2000.
2. drop support for ir already handled by bridge drivers + ir-kbd-i2c
3. move support for remainders in lirc_i2c to ir-kbd-i2c and bridge
drivers

Regards,
Andy

> > 
> > Regards,
> > Andy
> > 
> > Mauro Carvalho Chehab <mchehab@redhat.com> wrote:
> > 
> >>
> >> There were several warnings at the subsystem, that were catched with
> >> gcc version 4.5.1. All of them are fixed on those patches by a 
> >> trivial patch. So, let's fix them ;)
> >>
> >> Now, the only remaining patches are the ones we want to be there:
> >>
> >> drivers/staging/lirc/lirc_i2c.c: In function ‘ir_probe’:
> >> drivers/staging/lirc/lirc_i2c.c:431:3: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
> >> drivers/staging/lirc/lirc_i2c.c:450:3: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
> >> drivers/staging/lirc/lirc_i2c.c:479:9: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
> >> drivers/staging/lirc/lirc_zilog.c: In function ‘ir_probe’:
> >> drivers/staging/lirc/lirc_zilog.c:1199:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
> >> drivers/media/video/cx88/cx88-i2c.c: In function ‘cx88_i2c_init’:
> >> drivers/media/video/cx88/cx88-i2c.c:149:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
> >> drivers/media/video/cx88/cx88-vp3054-i2c.c: In function ‘vp3054_i2c_probe’:
> >> drivers/media/video/cx88/cx88-vp3054-i2c.c:128:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
> >>
> >> They are basically caused by lirc_i2c and lirc_zilog, that still needs
> >> to use the legacy .id field at the I2C structs. Somebody with those
> >> hardware, please fix it.
> >>
> >> Thanks,
> >> Mauro
> >>
> >> -
> >>
> >> Mauro Carvalho Chehab (8):
> >>  [media] dmxdev: Fix a compilation warning due to a bad type
> >>  [media] radio-wl1273: Fix two warnings
> >>  [media] lirc_zilog: Fix a warning
> >>  [media] dib7000m/dib7000p: Add support for TRANSMISSION_MODE_4K
> >>  [media] gspca: Fix a warning for using len before filling it
> >>  [media] stv090x: Fix some compilation warnings
> >>  [media] af9013: Fix a compilation warning
> >>  [media] streamzap: Fix a compilation warning when compiled builtin
> >>
> >> drivers/media/dvb/dvb-core/dmxdev.c    |    4 ++--
> >> drivers/media/dvb/frontends/af9013.c   |    2 +-
> >> drivers/media/dvb/frontends/dib7000m.c |   10 +++++-----
> >> drivers/media/dvb/frontends/dib7000p.c |   10 +++++-----
> >> drivers/media/dvb/frontends/stv090x.c  |    6 +++---
> >> drivers/media/radio/radio-wl1273.c     |    3 +--
> >> drivers/media/rc/streamzap.c           |    2 +-
> >> drivers/media/video/gspca/gspca.c      |    2 +-
> >> drivers/staging/lirc/lirc_zilog.c      |    1 -
> >> 9 files changed, 19 insertions(+), 21 deletions(-)
> >>
> >> -- 
> >> 1.7.3.4
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > N�����r��y���b�X��ǧv�^�)޺{.n�+����{���bj)���w*\x1fjg���\x1e�����ݢj/���z�ޖ��2�ޙ���&�)ߡ�a��\x7f��\x1e�G���h�\x0f�j:+v���w�٥
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/8] Fix V4L/DVB/RC warnings
  2010-12-28 14:14   ` Andy Walls
@ 2010-12-28 14:45     ` Mauro Carvalho Chehab
  2010-12-28 22:18       ` Andy Walls
  0 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2010-12-28 14:45 UTC (permalink / raw)
  To: Andy Walls; +Cc: Linux Media Mailing List

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 */

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/8] Fix V4L/DVB/RC warnings
  2010-12-28 14:45     ` Mauro Carvalho Chehab
@ 2010-12-28 22:18       ` Andy Walls
  2011-01-06 21:54         ` Jarod Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Walls @ 2010-12-28 22:18 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List

On Tue, 2010-12-28 at 12:45 -0200, Mauro Carvalho Chehab wrote:
> 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.

Well there is one more exception in lirc_zilog for the HD-PVR that also
relies on adapter->id.

lirc_zilog only handles Hauppauge adapters with that Z8 microcontroller
(PVR-150's, HVR-1600's, etc.) and the HD-PVR is the only device that
requires these quirky exceptions AFAIK.

It's probably better just to let lirc_zilog cleanly know it is dealing
with an HD-PVR and let it handle.  I'm working on it this evening and
will post something soon.

Regards,
Andy

> 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 */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/8] Fix V4L/DVB/RC warnings
  2010-12-28 22:18       ` Andy Walls
@ 2011-01-06 21:54         ` Jarod Wilson
  0 siblings, 0 replies; 7+ messages in thread
From: Jarod Wilson @ 2011-01-06 21:54 UTC (permalink / raw)
  To: Andy Walls; +Cc: Mauro Carvalho Chehab, Linux Media Mailing List

On Dec 28, 2010, at 5:18 PM, Andy Walls wrote:

> On Tue, 2010-12-28 at 12:45 -0200, Mauro Carvalho Chehab wrote:
>> 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.
> 
> Well there is one more exception in lirc_zilog for the HD-PVR that also
> relies on adapter->id.
> 
> lirc_zilog only handles Hauppauge adapters with that Z8 microcontroller
> (PVR-150's, HVR-1600's, etc.) and the HD-PVR is the only device that
> requires these quirky exceptions AFAIK.
> 
> It's probably better just to let lirc_zilog cleanly know it is dealing
> with an HD-PVR and let it handle.  I'm working on it this evening and
> will post something soon.

Thanks much for working on this admittedly crappy lirc code, and apologies
for the relative radio silence of late. The holiday break didn't afford
nearly as much (okay, any) time for IR work like I'd hoped. :\

Trying to catch up now though, and I do have an hdpvr to beat on with
some of the patches I'm seeing floated on the list.

-- 
Jarod Wilson
jarod@wilsonet.com




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 0/8] Fix V4L/DVB/RC warnings
@ 2010-12-27 16:22 Mauro Carvalho Chehab
  0 siblings, 0 replies; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2010-12-27 16:22 UTC (permalink / raw)
  Cc: Linux Media Mailing List


There were several warnings at the subsystem, that were catched with
gcc version 4.5.1. All of them are fixed on those patches by a 
trivial patch. So, let's fix them ;)

Now, the only remaining patches are the ones we want to be there:

drivers/staging/lirc/lirc_i2c.c: In function ‘ir_probe’:
drivers/staging/lirc/lirc_i2c.c:431:3: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
drivers/staging/lirc/lirc_i2c.c:450:3: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
drivers/staging/lirc/lirc_i2c.c:479:9: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
drivers/staging/lirc/lirc_zilog.c: In function ‘ir_probe’:
drivers/staging/lirc/lirc_zilog.c:1199:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
drivers/media/video/cx88/cx88-i2c.c: In function ‘cx88_i2c_init’:
drivers/media/video/cx88/cx88-i2c.c:149:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)
drivers/media/video/cx88/cx88-vp3054-i2c.c: In function ‘vp3054_i2c_probe’:
drivers/media/video/cx88/cx88-vp3054-i2c.c:128:2: warning: ‘id’ is deprecated (declared at include/linux/i2c.h:356)

They are basically caused by lirc_i2c and lirc_zilog, that still needs
to use the legacy .id field at the I2C structs. Somebody with those
hardware, please fix it.

Thanks,
Mauro

-

Mauro Carvalho Chehab (8):
  [media] dmxdev: Fix a compilation warning due to a bad type
  [media] radio-wl1273: Fix two warnings
  [media] lirc_zilog: Fix a warning
  [media] dib7000m/dib7000p: Add support for TRANSMISSION_MODE_4K
  [media] gspca: Fix a warning for using len before filling it
  [media] stv090x: Fix some compilation warnings
  [media] af9013: Fix a compilation warning
  [media] streamzap: Fix a compilation warning when compiled builtin

 drivers/media/dvb/dvb-core/dmxdev.c    |    4 ++--
 drivers/media/dvb/frontends/af9013.c   |    2 +-
 drivers/media/dvb/frontends/dib7000m.c |   10 +++++-----
 drivers/media/dvb/frontends/dib7000p.c |   10 +++++-----
 drivers/media/dvb/frontends/stv090x.c  |    6 +++---
 drivers/media/radio/radio-wl1273.c     |    3 +--
 drivers/media/rc/streamzap.c           |    2 +-
 drivers/media/video/gspca/gspca.c      |    2 +-
 drivers/staging/lirc/lirc_zilog.c      |    1 -
 9 files changed, 19 insertions(+), 21 deletions(-)

-- 
1.7.3.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-06 21:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.