public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [linux-dvb] Support of Nova S SE DVB card missing
@ 2008-08-23 13:15 Eberhard Kaltenhaeuser
  2008-08-23 13:57 ` e9hack
  0 siblings, 1 reply; 14+ messages in thread
From: Eberhard Kaltenhaeuser @ 2008-08-23 13:15 UTC (permalink / raw)
  To: linux-dvb


[-- Attachment #1.1: Type: text/plain, Size: 822 bytes --]

Actual kernel does not support the Hauppauge WinTV Nova S SE PCI card 
anymore:

Aug 10 16:00:43 linvdr user.info kernel: [   13.464026] DVB: registering new adapter (TT-Budget/WinTV-NOVA-S  PCI)
Aug 10 16:00:43 linvdr user.warn kernel: [   13.472474] adapter has MAC addr = 00:d0:5c:23:72:54
Aug 10 16:00:43 linvdr user.warn kernel: [   13.590880] budget: A frontend driver was not found for device 1131/7146 subsystem 13c2/1016

Tested with kernel 2.6.25.11

Previous kernel versions (i.e. 2.6.20.1) did not show this problem:

Aug 10 16:14:12 linvdr user.info kernel: DVB: registering new adapter (TT-Budget/WinTV-NOVA-S  PCI)
Aug 10 16:14:12 linvdr user.warn kernel: adapter has MAC addr = 00:d0:5c:23:72:54
Aug 10 16:14:12 linvdr user.warn kernel: DVB: registering frontend 1 (Samsung S5H1420 DVB-S)...

Regards
-- 


[-- Attachment #1.2: Type: text/html, Size: 1321 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 13:15 [linux-dvb] Support of Nova S SE DVB card missing Eberhard Kaltenhaeuser
@ 2008-08-23 13:57 ` e9hack
  2008-08-23 15:09   ` Patrick Boettcher
  2008-08-23 15:11   ` Oliver Endriss
  0 siblings, 2 replies; 14+ messages in thread
From: e9hack @ 2008-08-23 13:57 UTC (permalink / raw)
  To: linux-dvb

Eberhard Kaltenhaeuser schrieb:
> Actual kernel does not support the Hauppauge WinTV Nova S SE PCI card 
> anymore:
> 

I think it is a problem of this changeset http://linuxtv.org/hg/v4l-dvb/rev/358d281e6a3d 
from Patrick Boettcher. The S5H1420 isn't able to understand repeated start conditions. 
The i2c-read code was changed from:

	if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1)
		return ret;

	if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1)
		return ret;

to:
	if (state->config->repeated_start_workaround) {
		ret = i2c_transfer(state->i2c, msg, 3);
		if (ret != 3)
			return ret;
	} else {
		ret = i2c_transfer(state->i2c, &msg[1], 2);
		if (ret != 2)
			return ret;
	}

-Hartmut



_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 13:57 ` e9hack
@ 2008-08-23 15:09   ` Patrick Boettcher
  2008-08-23 15:26     ` e9hack
  2008-08-23 18:17     ` Eberhard Kaltenhaeuser
  2008-08-23 15:11   ` Oliver Endriss
  1 sibling, 2 replies; 14+ messages in thread
From: Patrick Boettcher @ 2008-08-23 15:09 UTC (permalink / raw)
  To: e9hack; +Cc: linux-dvb

Hi Hartmut and Eberhard,

thanks for pointing that out, I almost overlooked the previous mail from 
Eberhard.

Eberhard, are you able to try patches and to compile your own drivers in 
order to help finding the best solution.

One option is to put back the original code in case the 
repeated-start-workaround is not set. But this one looks not very 
protected. I mean between the two i2c_transfer-calls something else could 
happen.

Is there no other mean to tell to the i2c-adapter to do a repeated start 
within one i2c_transfer-call?

Another option would be to try to set the "repeated_start_workaround" 
option also for the Nova SE card.

What do you think?

Patrick.

--
   Mail: patrick.boettcher@desy.de
   WWW:  http://www.wi-bw.tfh-wildau.de/~pboettch/


On Sat, 23 Aug 2008, e9hack wrote:

> Eberhard Kaltenhaeuser schrieb:
>> Actual kernel does not support the Hauppauge WinTV Nova S SE PCI card
>> anymore:
>>
>
> I think it is a problem of this changeset http://linuxtv.org/hg/v4l-dvb/rev/358d281e6a3d
> from Patrick Boettcher. The S5H1420 isn't able to understand repeated start conditions.
> The i2c-read code was changed from:
>
> 	if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1)
> 		return ret;
>
> 	if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1)
> 		return ret;
>
> to:
> 	if (state->config->repeated_start_workaround) {
> 		ret = i2c_transfer(state->i2c, msg, 3);
> 		if (ret != 3)
> 			return ret;
> 	} else {
> 		ret = i2c_transfer(state->i2c, &msg[1], 2);
> 		if (ret != 2)
> 			return ret;
> 	}
>
> -Hartmut
>

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 13:57 ` e9hack
  2008-08-23 15:09   ` Patrick Boettcher
@ 2008-08-23 15:11   ` Oliver Endriss
  2008-08-23 15:21     ` Patrick Boettcher
                       ` (2 more replies)
  1 sibling, 3 replies; 14+ messages in thread
From: Oliver Endriss @ 2008-08-23 15:11 UTC (permalink / raw)
  To: linux-dvb; +Cc: Patrick Boettcher

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

e9hack wrote:
> Eberhard Kaltenhaeuser schrieb:
> > Actual kernel does not support the Hauppauge WinTV Nova S SE PCI card 
> > anymore:
> > 
> 
> I think it is a problem of this changeset http://linuxtv.org/hg/v4l-dvb/rev/358d281e6a3d 
> from Patrick Boettcher. The S5H1420 isn't able to understand repeated start conditions. 
> The i2c-read code was changed from:
> 
> 	if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1)
> 		return ret;
> 
> 	if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1)
> 		return ret;
> 
> to:
> 	if (state->config->repeated_start_workaround) {
> 		ret = i2c_transfer(state->i2c, msg, 3);
> 		if (ret != 3)
> 			return ret;
> 	} else {
> 		ret = i2c_transfer(state->i2c, &msg[1], 2);
> 		if (ret != 2)
> 			return ret;
> 	}

I think you are right.

Btw, I don't understand Patrick's workaround.

As the tuner does not support repeated start conditions, the solution
is to send two separate messages, as it was before.

Does the attached patch fix the problem?

CU
Oliver

-- 
----------------------------------------------------------------
VDR Remote Plugin 0.4.0: http://www.escape-edv.de/endriss/vdr/
----------------------------------------------------------------

[-- Attachment #2: s5h1420_repeated_start.diff --]
[-- Type: text/x-diff, Size: 561 bytes --]

diff -r 1760a612cc98 linux/drivers/media/dvb/frontends/s5h1420.c
--- a/linux/drivers/media/dvb/frontends/s5h1420.c	Sun Aug 03 05:02:35 2008 +0200
+++ b/linux/drivers/media/dvb/frontends/s5h1420.c	Sat Aug 23 17:07:01 2008 +0200
@@ -94,8 +94,11 @@ static u8 s5h1420_readreg(struct s5h1420
 		if (ret != 3)
 			return ret;
 	} else {
-		ret = i2c_transfer(state->i2c, &msg[1], 2);
-		if (ret != 2)
+		ret = i2c_transfer(state->i2c, &msg[1], 1);
+		if (ret != 1)
+			return ret;
+		ret = i2c_transfer(state->i2c, &msg[2], 1);
+		if (ret != 1)
 			return ret;
 	}
 

[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 15:11   ` Oliver Endriss
@ 2008-08-23 15:21     ` Patrick Boettcher
  2008-08-23 15:48       ` Oliver Endriss
  2008-08-24  8:12     ` Eberhard Kaltenhaeuser
  2008-08-28 15:48     ` Eberhard Kaltenhaeuser
  2 siblings, 1 reply; 14+ messages in thread
From: Patrick Boettcher @ 2008-08-23 15:21 UTC (permalink / raw)
  To: linux-dvb

Hi,

On Sat, 23 Aug 2008, Oliver Endriss wrote:
> Btw, I don't understand Patrick's workaround.

The Flexcop i2c-interface is not very flexible. You cannot send just a 
single write request with an independent read request following.

The same problematic applies for several USB-I2C requests as we have it in 
dvb-usb at several places.

In addition (see my other mail in that thread), sending two independent 
i2c_transfers which actually belong together is not really safe. (However 
I understand that for most single-receiver boards it is no real problem, 
as long as no one is using this i2c-adapter from user-space at the same 
time.)

Patrick.

--
   Mail: patrick.boettcher@desy.de
   WWW:  http://www.wi-bw.tfh-wildau.de/~pboettch/

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 15:09   ` Patrick Boettcher
@ 2008-08-23 15:26     ` e9hack
  2008-08-23 18:17     ` Eberhard Kaltenhaeuser
  1 sibling, 0 replies; 14+ messages in thread
From: e9hack @ 2008-08-23 15:26 UTC (permalink / raw)
  To: linux-dvb

Hi,

it seems another card is also not working after the flexcop changes 
(http://linuxtv.org/pipermail/linux-dvb/2008-June/026512.html). The CableStar uses also a 
crazy chip (stv0297), which doesn't understand repeated start conditions.

-Hartmut


_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 15:21     ` Patrick Boettcher
@ 2008-08-23 15:48       ` Oliver Endriss
  2008-08-23 15:53         ` Patrick Boettcher
  0 siblings, 1 reply; 14+ messages in thread
From: Oliver Endriss @ 2008-08-23 15:48 UTC (permalink / raw)
  To: linux-dvb

Patrick Boettcher wrote:
> Hi,
> 
> On Sat, 23 Aug 2008, Oliver Endriss wrote:
> > Btw, I don't understand Patrick's workaround.
> 
> The Flexcop i2c-interface is not very flexible. You cannot send just a 
> single write request with an independent read request following.

Ah, ok. Maybe we should add some comments.

> The same problematic applies for several USB-I2C requests as we have it in 
> dvb-usb at several places.
> 
> In addition (see my other mail in that thread), sending two independent 
> i2c_transfers which actually belong together is not really safe.

The current code in the else path will *never* work, because the tuner
does not support repeated start conditions. The problem is not the I2C
master (saa7146/flexcop) but the I2C slave (s5h1420).

> (However 
> I understand that for most single-receiver boards it is no real problem, 
> as long as no one is using this i2c-adapter from user-space at the same 
> time.)

True.

CU
Oliver

-- 
----------------------------------------------------------------
VDR Remote Plugin 0.4.0: http://www.escape-edv.de/endriss/vdr/
----------------------------------------------------------------

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 15:48       ` Oliver Endriss
@ 2008-08-23 15:53         ` Patrick Boettcher
  2008-08-23 16:42           ` Oliver Endriss
  0 siblings, 1 reply; 14+ messages in thread
From: Patrick Boettcher @ 2008-08-23 15:53 UTC (permalink / raw)
  To: linux-dvb

On Sat, 23 Aug 2008, Oliver Endriss wrote:
>> In addition (see my other mail in that thread), sending two independent
>> i2c_transfers which actually belong together is not really safe.
>
> The current code in the else path will *never* work, because the tuner
> does not support repeated start conditions. The problem is not the I2C
> master (saa7146/flexcop) but the I2C slave (s5h1420).

Wouldn't it be more correct to have a flag signaling to the 
i2c_tranfer-function that a repeated start is not wanted even though it is 
two i2c-messages glued (which are interpreted today as a read with
repeated start).

Patrick.

--
   Mail: patrick.boettcher@desy.de
   WWW:  http://www.wi-bw.tfh-wildau.de/~pboettch/

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 15:53         ` Patrick Boettcher
@ 2008-08-23 16:42           ` Oliver Endriss
  2008-08-23 17:21             ` Oliver Endriss
  2008-08-24  4:56             ` Oliver Endriss
  0 siblings, 2 replies; 14+ messages in thread
From: Oliver Endriss @ 2008-08-23 16:42 UTC (permalink / raw)
  To: linux-dvb

Patrick Boettcher wrote:
> On Sat, 23 Aug 2008, Oliver Endriss wrote:
> >> In addition (see my other mail in that thread), sending two independent
> >> i2c_transfers which actually belong together is not really safe.
> >
> > The current code in the else path will *never* work, because the tuner
> > does not support repeated start conditions. The problem is not the I2C
> > master (saa7146/flexcop) but the I2C slave (s5h1420).
> 
> Wouldn't it be more correct to have a flag signaling to the 
> i2c_tranfer-function that a repeated start is not wanted even though it is 
> two i2c-messages glued (which are interpreted today as a read with
> repeated start).

As there is a flag I2C_M_NOSTART in the I2C subsystem in recent kernels,
we could pass this flag to the I2C driver and add a workaround to the 
i2c master_xfer function.

I remember that we had the same discussion for the stv0297 driver a long
time ago. I suggested to add a workaround to the saa7146 master_xfer
routine, but Johannes stated that the frontend caused the problem, and
so it should be fixed there...

For the stv0297 I have an experimental patch which intercepts the
master_xfer routine, but this is not very nice either.

Usually there is no problem with the old approach, because i2c transfers
are protected by the frontend mutex. But bad things may happen if
someone accesses the i2c bus from user space. :-(

I'll think about the I2C_M_NOSTART mod for the master_xfer routine,
but I need some time to work it out.

For now we should test whether the driver works again if we put the old
code into the else path.

Btw,
        b[1] = state->shadow[(reg - 1) & 0xff];
reads shadow[255] for reg == 0.

So you should change
   u8 shadow[255];
to
   u8 shadow[256];

CU
Oliver

-- 
----------------------------------------------------------------
VDR Remote Plugin 0.4.0: http://www.escape-edv.de/endriss/vdr/
----------------------------------------------------------------

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 16:42           ` Oliver Endriss
@ 2008-08-23 17:21             ` Oliver Endriss
  2008-08-24  4:56             ` Oliver Endriss
  1 sibling, 0 replies; 14+ messages in thread
From: Oliver Endriss @ 2008-08-23 17:21 UTC (permalink / raw)
  To: linux-dvb

Oliver Endriss wrote:
> As there is a flag I2C_M_NOSTART in the I2C subsystem in recent kernels,
> we could pass this flag to the I2C driver and add a workaround to the 
> i2c master_xfer function.

Correction. I2C_M_NOSTART cannot be used. It removes a *start*
condition, but we have to insert a *stop* condition...

CU
Oliver

-- 
----------------------------------------------------------------
VDR Remote Plugin 0.4.0: http://www.escape-edv.de/endriss/vdr/
----------------------------------------------------------------

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 15:09   ` Patrick Boettcher
  2008-08-23 15:26     ` e9hack
@ 2008-08-23 18:17     ` Eberhard Kaltenhaeuser
  1 sibling, 0 replies; 14+ messages in thread
From: Eberhard Kaltenhaeuser @ 2008-08-23 18:17 UTC (permalink / raw)
  To: Patrick Boettcher; +Cc: linux-dvb


[-- Attachment #1.1: Type: text/plain, Size: 2546 bytes --]

Hi Patrick,

sorry, actually, i have no environment to compile drivers or kernels.

Eberhard


Patrick Boettcher schrieb:
> Hi Hartmut and Eberhard,
>
> thanks for pointing that out, I almost overlooked the previous mail from 
> Eberhard.
>
> Eberhard, are you able to try patches and to compile your own drivers in 
> order to help finding the best solution.
>
> One option is to put back the original code in case the 
> repeated-start-workaround is not set. But this one looks not very 
> protected. I mean between the two i2c_transfer-calls something else could 
> happen.
>
> Is there no other mean to tell to the i2c-adapter to do a repeated start 
> within one i2c_transfer-call?
>
> Another option would be to try to set the "repeated_start_workaround" 
> option also for the Nova SE card.
>
> What do you think?
>
> Patrick.
>
> --
>    Mail: patrick.boettcher@desy.de
>    WWW:  http://www.wi-bw.tfh-wildau.de/~pboettch/
>
>
> On Sat, 23 Aug 2008, e9hack wrote:
>
>   
>> Eberhard Kaltenhaeuser schrieb:
>>     
>>> Actual kernel does not support the Hauppauge WinTV Nova S SE PCI card
>>> anymore:
>>>
>>>       
>> I think it is a problem of this changeset http://linuxtv.org/hg/v4l-dvb/rev/358d281e6a3d
>> from Patrick Boettcher. The S5H1420 isn't able to understand repeated start conditions.
>> The i2c-read code was changed from:
>>
>> 	if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1)
>> 		return ret;
>>
>> 	if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1)
>> 		return ret;
>>
>> to:
>> 	if (state->config->repeated_start_workaround) {
>> 		ret = i2c_transfer(state->i2c, msg, 3);
>> 		if (ret != 3)
>> 			return ret;
>> 	} else {
>> 		ret = i2c_transfer(state->i2c, &msg[1], 2);
>> 		if (ret != 2)
>> 			return ret;
>> 	}
>>
>> -Hartmut
>>
>>     
>
> _______________________________________________
> linux-dvb mailing list
> linux-dvb@linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
>
>   

-- 
         ___________________________________
        |                                   |
        |      Eberhard Kaltenhaeuser       |
      _ | (+49/0)9135 Tel:799955 Fax:725517 | _
     / )|                                   |( \
    / / |       mailto:ke2705@gmx.de        | \ \
  _( (_ |  _                             _  | _) )_
 (((\ \>|_/ )___________________________( \_|</ /)))
 (\ \  \_/ /                             \ \_/  / /)
  \       /                               \       /
   \    _/                                 \_    /
   /   /                                     \   \

[-- Attachment #1.2: Type: text/html, Size: 6708 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 16:42           ` Oliver Endriss
  2008-08-23 17:21             ` Oliver Endriss
@ 2008-08-24  4:56             ` Oliver Endriss
  1 sibling, 0 replies; 14+ messages in thread
From: Oliver Endriss @ 2008-08-24  4:56 UTC (permalink / raw)
  To: linux-dvb

[-- Attachment #1: Type: text/plain, Size: 2048 bytes --]

Hi,

Oliver Endriss wrote:
> Patrick Boettcher wrote:
> > On Sat, 23 Aug 2008, Oliver Endriss wrote:
> > >> In addition (see my other mail in that thread), sending two independent
> > >> i2c_transfers which actually belong together is not really safe.
> > >
> > > The current code in the else path will *never* work, because the tuner
> > > does not support repeated start conditions. The problem is not the I2C
> > > master (saa7146/flexcop) but the I2C slave (s5h1420).
> > 
> > Wouldn't it be more correct to have a flag signaling to the 
> > i2c_tranfer-function that a repeated start is not wanted even though it is 
> > two i2c-messages glued (which are interpreted today as a read with
> > repeated start).
> 
> I remember that we had the same discussion for the stv0297 driver a long
> time ago.

See
  http://linuxtv.org/pipermail/linux-dvb/2007-May/018122.html
for this interesting discussion.

Obviously the i2c maintainers were not willing to add the I2C_M_STOP
flag...

> For the stv0297 I have an experimental patch which intercepts the
> master_xfer routine, but this is not very nice either.

See attachment. It will probably not apply to the current tree, but you
should get the idea. Anyway, I don't want to add this crap to a frontend
driver. It does not fix the userspace issues anyway.

For now I suggest to use the good old double i2c_transfer() approach for
the budget driver.

Btw, I still do not understand how your repeated_start_workaround works.
  struct i2c_msg msg[] = {
    { .addr = state->config->demod_address, .flags = 0, .buf = b, .len = 2 },
    { .addr = state->config->demod_address, .flags = 0, .buf = &reg, .len = 1 },
    { .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = b, .len = 1 },
  };
What does the flexcop master_xfer send over the i2c bus when it receives
these messages?

CU
Oliver

-- 
----------------------------------------------------------------
VDR Remote Plugin 0.4.0: http://www.escape-edv.de/endriss/vdr/
----------------------------------------------------------------

[-- Attachment #2: stv0297_restart_workaround.diff --]
[-- Type: text/x-diff, Size: 5077 bytes --]

diff -r 8f9147c3bacd linux/drivers/media/dvb/frontends/stv0297.c
--- a/linux/drivers/media/dvb/frontends/stv0297.c	Wed Aug 01 12:14:44 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/stv0297.c	Wed Aug 01 23:02:17 2007 +0200
@@ -35,6 +35,10 @@ struct stv0297_state {
 	const struct stv0297_config *config;
 	struct dvb_frontend frontend;
 
+	/* workaround, chip does not support repeated start condition */
+	struct i2c_algorithm i2c_algo_virt;
+	struct i2c_adapter i2c_adap_virt;
+
 	unsigned long last_ber;
 	unsigned long base_freq;
 };
@@ -47,6 +51,29 @@ struct stv0297_state {
 
 #define STV0297_CLOCK_KHZ   28900
 
+
+static int stv0297_master_xfer_virt (struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+{
+	struct stv0297_state *state = i2c_get_adapdata(adap);
+	struct i2c_adapter *i2c_phys = adap->algo_data;
+	int i, rc;
+
+	if (num == 2 &&
+	    msgs[0].addr == state->config->demod_address &&
+	    msgs[1].addr == state->config->demod_address &&
+	    msgs[0].flags == 0 && msgs[1].flags == I2C_M_RD) {
+		/* device needs a STOP between the register and data */
+		for (i = 0; i < num; i++) {
+			rc = i2c_transfer(i2c_phys, msgs+i, 1);
+			if (rc != 1)
+				return rc;
+		}
+		rc = num;
+	} else
+		rc = i2c_transfer(i2c_phys, msgs, num);
+
+	return rc;
+}
 
 static int stv0297_writereg(struct stv0297_state *state, u8 reg, u8 data)
 {
@@ -72,21 +99,9 @@ static int stv0297_readreg(struct stv029
 				 {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b1,.len = 1}
 			       };
 
-	// this device needs a STOP between the register and data
-	if (state->config->stop_during_read) {
-		if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) {
-			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret);
-			return -1;
-		}
-		if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) {
-			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret);
-			return -1;
-		}
-	} else {
-		if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) {
-			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret);
-			return -1;
-		}
+	if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) {
+		dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg, ret);
+		return -1;
 	}
 
 	return b1[0];
@@ -107,26 +122,13 @@ static int stv0297_readregs(struct stv02
 static int stv0297_readregs(struct stv0297_state *state, u8 reg1, u8 * b, u8 len)
 {
 	int ret;
-	struct i2c_msg msg[] = { {.addr = state->config->demod_address,.flags = 0,.buf =
-				  &reg1,.len = 1},
-	{.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b,.len = len}
-	};
-
-	// this device needs a STOP between the register and data
-	if (state->config->stop_during_read) {
-		if ((ret = i2c_transfer(state->i2c, &msg[0], 1)) != 1) {
-			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret);
-			return -1;
-		}
-		if ((ret = i2c_transfer(state->i2c, &msg[1], 1)) != 1) {
-			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret);
-			return -1;
-		}
-	} else {
-		if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) {
-			dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret);
-			return -1;
-		}
+	struct i2c_msg msg[] = { {.addr = state->config->demod_address,.flags = 0,.buf = &reg1,.len = 1},
+				 {.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b,.len = len}
+			       };
+
+	if ((ret = i2c_transfer(state->i2c, msg, 2)) != 2) {
+		dprintk("%s: readreg error (reg == 0x%02x, ret == %i)\n", __FUNCTION__, reg1, ret);
+		return -1;
 	}
 
 	return 0;
@@ -651,15 +653,30 @@ struct dvb_frontend *stv0297_attach(cons
 	struct stv0297_state *state = NULL;
 
 	/* allocate memory for the internal state */
-	state = kmalloc(sizeof(struct stv0297_state), GFP_KERNEL);
+	state = kzalloc(sizeof(struct stv0297_state), GFP_KERNEL);
 	if (state == NULL)
 		goto error;
 
 	/* setup the state */
 	state->config = config;
-	state->i2c = i2c;
-	state->last_ber = 0;
-	state->base_freq = 0;
+	if (state->config->stop_during_read) {
+		state->i2c_algo_virt.master_xfer = stv0297_master_xfer_virt;
+		state->i2c_algo_virt.functionality = i2c->algo->functionality;
+
+		state->i2c_adap_virt.id = i2c->id;
+		state->i2c_adap_virt.class = i2c->class;
+		state->i2c_adap_virt.algo = &state->i2c_algo_virt;
+		state->i2c_adap_virt.algo_data = i2c;
+		state->i2c_adap_virt.timeout = i2c->timeout;
+		state->i2c_adap_virt.retries = i2c->retries;
+		state->i2c_adap_virt.dev.parent = i2c->dev.parent;
+		i2c_set_adapdata(&state->i2c_adap_virt, state);
+
+		if (i2c_add_adapter(&state->i2c_adap_virt) < 0)
+			goto error;
+		state->i2c = &state->i2c_adap_virt;
+	} else
+		state->i2c = i2c;
 
 	/* check if the demod is there */
 	if ((stv0297_readreg(state, 0x80) & 0x70) != 0x20)
@@ -671,6 +688,8 @@ struct dvb_frontend *stv0297_attach(cons
 	return &state->frontend;
 
 error:
+	if (state && state->config->stop_during_read && state->i2c)
+		i2c_del_adapter(state->i2c);
 	kfree(state);
 	return NULL;
 }

[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 15:11   ` Oliver Endriss
  2008-08-23 15:21     ` Patrick Boettcher
@ 2008-08-24  8:12     ` Eberhard Kaltenhaeuser
  2008-08-28 15:48     ` Eberhard Kaltenhaeuser
  2 siblings, 0 replies; 14+ messages in thread
From: Eberhard Kaltenhaeuser @ 2008-08-24  8:12 UTC (permalink / raw)
  To: linux-dvb; +Cc: Patrick Boettcher


[-- Attachment #1.1: Type: text/plain, Size: 2417 bytes --]

Hi Oliver,

the patch fixed the problem - here the relevant part of the log:

Aug 24 09:40:07 vdrdev user.info kernel: [   13.943338] DVB: registering new adapter (TT-Budget/WinTV-NOVA-S  PCI)
Aug 24 09:40:07 vdrdev user.warn kernel: [   13.966605] adapter has MAC addr = 00:d0:5c:23:72:54
Aug 24 09:40:07 vdrdev user.warn kernel: [   14.064407] DVB: registering frontend 1 (Samsung S5H1420/PnpNetwork PN1010 DVB-S)...

Thanx to all - also to Dr.Seltsam for compiling.
Eberhard

Oliver Endriss schrieb:
> e9hack wrote:
>   
>> Eberhard Kaltenhaeuser schrieb:
>>     
>>> Actual kernel does not support the Hauppauge WinTV Nova S SE PCI card 
>>> anymore:
>>>
>>>       
>> I think it is a problem of this changeset http://linuxtv.org/hg/v4l-dvb/rev/358d281e6a3d 
>> from Patrick Boettcher. The S5H1420 isn't able to understand repeated start conditions. 
>> The i2c-read code was changed from:
>>
>> 	if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1)
>> 		return ret;
>>
>> 	if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1)
>> 		return ret;
>>
>> to:
>> 	if (state->config->repeated_start_workaround) {
>> 		ret = i2c_transfer(state->i2c, msg, 3);
>> 		if (ret != 3)
>> 			return ret;
>> 	} else {
>> 		ret = i2c_transfer(state->i2c, &msg[1], 2);
>> 		if (ret != 2)
>> 			return ret;
>> 	}
>>     
>
> I think you are right.
>
> Btw, I don't understand Patrick's workaround.
>
> As the tuner does not support repeated start conditions, the solution
> is to send two separate messages, as it was before.
>
> Does the attached patch fix the problem?
>
> CU
> Oliver
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> linux-dvb mailing list
> linux-dvb@linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

-- 
         ___________________________________
        |                                   |
        |      Eberhard Kaltenhaeuser       |
      _ | (+49/0)9135 Tel:799955 Fax:725517 | _
     / )|                                   |( \
    / / |       mailto:ke2705@gmx.de        | \ \
  _( (_ |  _                             _  | _) )_
 (((\ \>|_/ )___________________________( \_|</ /)))
 (\ \  \_/ /                             \ \_/  / /)
  \       /                               \       /
   \    _/                                 \_    /
   /   /                                     \   \

[-- Attachment #1.2: Type: text/html, Size: 4887 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

* Re: [linux-dvb] Support of Nova S SE DVB card missing
  2008-08-23 15:11   ` Oliver Endriss
  2008-08-23 15:21     ` Patrick Boettcher
  2008-08-24  8:12     ` Eberhard Kaltenhaeuser
@ 2008-08-28 15:48     ` Eberhard Kaltenhaeuser
  2 siblings, 0 replies; 14+ messages in thread
From: Eberhard Kaltenhaeuser @ 2008-08-28 15:48 UTC (permalink / raw)
  To: linux-dvb; +Cc: Patrick Boettcher


[-- Attachment #1.1: Type: text/plain, Size: 2263 bytes --]

Hello,

against my expectation, the Nova-S SE card does not work, although the 
card is recognized by the kernel. Frontend modul is loaded, but no 
signal can be received. So VDR exists (Emergency exit) when switching to 
this device (i.e. to record something)

Any suggestions?
Eberhard

Oliver Endriss wrote:

>e9hack wrote:
>  
>
>>Eberhard Kaltenhaeuser schrieb:
>>    
>>
>>>Actual kernel does not support the Hauppauge WinTV Nova S SE PCI card 
>>>anymore:
>>>
>>>      
>>>
>>I think it is a problem of this changeset http://linuxtv.org/hg/v4l-dvb/rev/358d281e6a3d 
>>from Patrick Boettcher. The S5H1420 isn't able to understand repeated start conditions. 
>>The i2c-read code was changed from:
>>
>>	if ((ret = i2c_transfer (state->i2c, &msg1, 1)) != 1)
>>		return ret;
>>
>>	if ((ret = i2c_transfer (state->i2c, &msg2, 1)) != 1)
>>		return ret;
>>
>>to:
>>	if (state->config->repeated_start_workaround) {
>>		ret = i2c_transfer(state->i2c, msg, 3);
>>		if (ret != 3)
>>			return ret;
>>	} else {
>>		ret = i2c_transfer(state->i2c, &msg[1], 2);
>>		if (ret != 2)
>>			return ret;
>>	}
>>    
>>
>
>I think you are right.
>
>Btw, I don't understand Patrick's workaround.
>
>As the tuner does not support repeated start conditions, the solution
>is to send two separate messages, as it was before.
>
>Does the attached patch fix the problem?
>
>CU
>Oliver
>
>  
>
>------------------------------------------------------------------------
>
>diff -r 1760a612cc98 linux/drivers/media/dvb/frontends/s5h1420.c
>--- a/linux/drivers/media/dvb/frontends/s5h1420.c	Sun Aug 03 05:02:35 2008 +0200
>+++ b/linux/drivers/media/dvb/frontends/s5h1420.c	Sat Aug 23 17:07:01 2008 +0200
>@@ -94,8 +94,11 @@ static u8 s5h1420_readreg(struct s5h1420
> 		if (ret != 3)
> 			return ret;
> 	} else {
>-		ret = i2c_transfer(state->i2c, &msg[1], 2);
>-		if (ret != 2)
>+		ret = i2c_transfer(state->i2c, &msg[1], 1);
>+		if (ret != 1)
>+			return ret;
>+		ret = i2c_transfer(state->i2c, &msg[2], 1);
>+		if (ret != 1)
> 			return ret;
> 	}
> 
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>linux-dvb mailing list
>linux-dvb@linuxtv.org
>http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
>

[-- Attachment #1.2: Type: text/html, Size: 2969 bytes --]

[-- Attachment #2: ke2705.vcf --]
[-- Type: text/x-vcard, Size: 229 bytes --]

begin:vcard
fn:Eberhard Kaltenhaeuser
n:Kaltenhaeuser;Eberhard
adr;dom:;;Obermembach 6;Hessdorf;;91093
email;internet:ke2705@gmx.de
tel;fax:+49 9135 725517
tel;home:+49 9135 799955
tel;cell:+49 173 3760676
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 150 bytes --]

_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

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

end of thread, other threads:[~2008-08-28 15:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-23 13:15 [linux-dvb] Support of Nova S SE DVB card missing Eberhard Kaltenhaeuser
2008-08-23 13:57 ` e9hack
2008-08-23 15:09   ` Patrick Boettcher
2008-08-23 15:26     ` e9hack
2008-08-23 18:17     ` Eberhard Kaltenhaeuser
2008-08-23 15:11   ` Oliver Endriss
2008-08-23 15:21     ` Patrick Boettcher
2008-08-23 15:48       ` Oliver Endriss
2008-08-23 15:53         ` Patrick Boettcher
2008-08-23 16:42           ` Oliver Endriss
2008-08-23 17:21             ` Oliver Endriss
2008-08-24  4:56             ` Oliver Endriss
2008-08-24  8:12     ` Eberhard Kaltenhaeuser
2008-08-28 15:48     ` Eberhard Kaltenhaeuser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox