Re: tda8290 regression fix

2012-12-04 Thread Anders Thomson

On 2012-11-15 21:43, Anders Thomson wrote:

On 2012-10-01 18:56, Anders Thomson wrote:
  On 2012-09-23 23:06, Anders Thomson wrote:
 Awfully sorry about this. After having had the familty sit in and check
 the differences,
 I must say that the patch does not fix the issue. This time around I
 have x11grabs with
 ffmpeg to show if you want.
  
 I'll be away from the card until the end of the coming week. Then, I'll
 bring out the multimeter...
  
  
  So, I got the multimeter working over the weekend and pretty much no
  results there. :-(
  I tested vanilla 3.5.3, w/ my patch, w/ your tuner patch. All three
  gave a (DC) reading of 0 to 30 mV (yes milli-). Given that the wiki page
  you referred to spoke of a few volts, I guess this is just noise. Coming
  to think of it, shouldn't any signal amplification done work on HF, so
  I'd have to measure the AC on the carrier freq or something? This
  multimeter is useless in the MHz range...

  While at it, I created these 20 sec snippets:
  http://pickup.famthomson.se/output-vanilla.avi
  vanilla 3.5.3

  http://pickup.famthomson.se/output-test3.avi
  This patch:
 # cat /TV_TEST3.diff
  diff --git a/drivers/media/video/saa7134/saa7134-cards.c
  b/drivers/media/video/saa7134/saa7134-cards.c
  index bc08f1d..98b482e 100644
  --- a/drivers/media/video/saa7134/saa7134-cards.c
  +++ b/drivers/media/video/saa7134/saa7134-cards.c
  @@ -3291,7 +3291,7 @@ struct saa7134_board saa7134_boards[] = {
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
  -   .tuner_config   = 1,
  +   .tuner_config   = 0,
.mpeg   = SAA7134_MPEG_DVB,
.gpiomask   = 0x00020,
.inputs = {{

  http://pickup.famthomson.se/output-card.avi
  This patch:
 # cat /TV_CARD.diff
  diff --git a/drivers/media/common/tuners/tda8290.c
  b/drivers/media/common/tuners/tda8290.c
  index 064d14c..498cc7b 100644
  --- a/drivers/media/common/tuners/tda8290.c
  +++ b/drivers/media/common/tuners/tda8290.c
  @@ -635,7 +635,11 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
   priv-i2c_props.adap,priv-cfg);
  +   tuner_info(ANDERS: setting switch_addr. was 0x%02x, new
  0x%02x\n,priv-cfg.switch_addr,priv-i2c_props.addr);
priv-cfg.switch_addr = priv-i2c_props.addr;
  +   priv-cfg.switch_addr = 0xc2 / 2;
  +   tuner_info(ANDERS: new 0x%02x\n,priv-cfg.switch_addr);
  +
}
if (fe-ops.tuner_ops.init)
fe-ops.tuner_ops.init(fe);


  Would looking again at the specifics on the 2.6.25-26 transition be of
  any help? I expect some pain to go to such old kernel, but if I can add
  some printks somewhere, maybe that could help?

  Cheers,
  -Anders

Hi Mauro,

Picking up this thread again. Did you have chance to look into this?

/Anders

Hi Mauro,

Any chance we can make progress on this one? As indicated, the patches 
you've proposed do not work. I have no idea why mine does though


/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-11-15 Thread Anders Thomson

On 2012-10-01 18:56, Anders Thomson wrote:

On 2012-09-23 23:06, Anders Thomson wrote:
  Awfully sorry about this. After having had the familty sit in and check
  the differences,
  I must say that the patch does not fix the issue. This time around I
  have x11grabs with
  ffmpeg to show if you want.

  I'll be away from the card until the end of the coming week. Then, I'll
  bring out the multimeter...


So, I got the multimeter working over the weekend and pretty much no
results there. :-(
I tested vanilla 3.5.3, w/ my patch, w/ your tuner patch. All three
gave a (DC) reading of 0 to 30 mV (yes milli-). Given that the wiki page
you referred to spoke of a few volts, I guess this is just noise. Coming
to think of it, shouldn't any signal amplification done work on HF, so
I'd have to measure the AC on the carrier freq or something? This
multimeter is useless in the MHz range...

While at it, I created these 20 sec snippets:
http://pickup.famthomson.se/output-vanilla.avi
vanilla 3.5.3

http://pickup.famthomson.se/output-test3.avi
This patch:
   # cat /TV_TEST3.diff
diff --git a/drivers/media/video/saa7134/saa7134-cards.c
b/drivers/media/video/saa7134/saa7134-cards.c
index bc08f1d..98b482e 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -3291,7 +3291,7 @@ struct saa7134_board saa7134_boards[] = {
  .radio_type = UNSET,
  .tuner_addr = ADDR_UNSET,
  .radio_addr = ADDR_UNSET,
-   .tuner_config   = 1,
+   .tuner_config   = 0,
  .mpeg   = SAA7134_MPEG_DVB,
  .gpiomask   = 0x00020,
  .inputs = {{

http://pickup.famthomson.se/output-card.avi
This patch:
   # cat /TV_CARD.diff
diff --git a/drivers/media/common/tuners/tda8290.c
b/drivers/media/common/tuners/tda8290.c
index 064d14c..498cc7b 100644
--- a/drivers/media/common/tuners/tda8290.c
+++ b/drivers/media/common/tuners/tda8290.c
@@ -635,7 +635,11 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

  dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
 priv-i2c_props.adap,priv-cfg);
+   tuner_info(ANDERS: setting switch_addr. was 0x%02x, new
0x%02x\n,priv-cfg.switch_addr,priv-i2c_props.addr);
  priv-cfg.switch_addr = priv-i2c_props.addr;
+   priv-cfg.switch_addr = 0xc2 / 2;
+   tuner_info(ANDERS: new 0x%02x\n,priv-cfg.switch_addr);
+
  }
  if (fe-ops.tuner_ops.init)
  fe-ops.tuner_ops.init(fe);


Would looking again at the specifics on the 2.6.25-26 transition be of
any help? I expect some pain to go to such old kernel, but if I can add
some printks somewhere, maybe that could help?

Cheers,
-Anders


Hi Mauro,

Picking up this thread again. Did you have chance to look into this?

/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-10-01 Thread Anders Thomson

On 2012-09-23 23:06, Anders Thomson wrote:

Awfully sorry about this. After having had the familty sit in and check
the differences,
I must say that the patch does not fix the issue. This time around I
have x11grabs with
ffmpeg to show if you want.

I'll be away from the card until the end of the coming week. Then, I'll
bring out the multimeter...


So, I got the multimeter working over the weekend and pretty much no 
results there. :-(
I tested vanilla 3.5.3, w/ my patch, w/ your tuner patch. All three 
gave a (DC) reading of 0 to 30 mV (yes milli-). Given that the wiki page 
you referred to spoke of a few volts, I guess this is just noise. Coming 
to think of it, shouldn't any signal amplification done work on HF, so 
I'd have to measure the AC on the carrier freq or something? This 
multimeter is useless in the MHz range...


While at it, I created these 20 sec snippets:
http://pickup.famthomson.se/output-vanilla.avi
vanilla 3.5.3

http://pickup.famthomson.se/output-test3.avi
This patch:
 # cat /TV_TEST3.diff
diff --git a/drivers/media/video/saa7134/saa7134-cards.c 
b/drivers/media/video/saa7134/saa7134-cards.c

index bc08f1d..98b482e 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -3291,7 +3291,7 @@ struct saa7134_board saa7134_boards[] = {
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
-   .tuner_config   = 1,
+   .tuner_config   = 0,
.mpeg   = SAA7134_MPEG_DVB,
.gpiomask   = 0x00020,
.inputs = {{

http://pickup.famthomson.se/output-card.avi
This patch:
 # cat /TV_CARD.diff
diff --git a/drivers/media/common/tuners/tda8290.c 
b/drivers/media/common/tuners/tda8290.c

index 064d14c..498cc7b 100644
--- a/drivers/media/common/tuners/tda8290.c
+++ b/drivers/media/common/tuners/tda8290.c
@@ -635,7 +635,11 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
   priv-i2c_props.adap, priv-cfg);
+   tuner_info(ANDERS: setting switch_addr. was 0x%02x, new 
0x%02x\n,priv-cfg.switch_addr,priv-i2c_props.addr);

priv-cfg.switch_addr = priv-i2c_props.addr;
+   priv-cfg.switch_addr = 0xc2 / 2;
+   tuner_info(ANDERS: new 0x%02x\n,priv-cfg.switch_addr);
+
}
if (fe-ops.tuner_ops.init)
fe-ops.tuner_ops.init(fe);


Would looking again at the specifics on the 2.6.25-26 transition be of 
any help? I expect some pain to go to such old kernel, but if I can add 
some printks somewhere, maybe that could help?


Cheers,
-Anders

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-09-23 Thread Anders Thomson

On 2012-09-23 13:36, Mauro Carvalho Chehab wrote:

Em 22-09-2012 11:32, Anders Eriksson escreveu:
  Not to my knowledge. It's a standard antenna cable to my cabletv box. I 
watch tv over hdmi to get HD. I only use analogue (and this htpc card) to record 
stuff.

(please, don't top-post - it makes harder to preserve the history of the
  discussions)

Sorry about that. I was using my notsosmartphone.


Then, maybe that's the reason why you're having troubles with this board.

The tda8290-based devices have two components:

1) a tda8275 tuner, at address 0x61 at the 7-bit I2C address notation
  (or 0xc2, at the 8-bit notation);
2) a tda8290 analog demod at address 0x4b (7-bit notation).

Some devices provide a way to send power to a low noise amplifier located at the
antenna or at the device itself (called LNA). The way to activate the LNA is
board-dependent.

On some devices the tda8290 can also be used to enable/disable a linear 
amplifier
(LNA). Enabling/disabling the LNA and its gain affects the quality of the 
signal.

In the case of tda8275/tda8290 based devices, the LNA setup type is stored at
priv-cfg-config, where:

0 - means no LNA control at all - device won't use it;
1, 2 - LNA is via a pin at tda8290 (GPIO 0):
When config is 1, LNA high gain happens writing a 0;
When config is 2, LNA high gain happens writing a 1;
3 - The LNA gain control is via a pin at saa713x.

For modes 1 and 2, the switch_addr should be equal to 0x4b, as the commands
sent to the device are for the tda8290 chip; sending them to tda8275 will
likely produce no results or would affect something else there.

I suspect that, in the case of your board, the LNA is at the antenna bundled
together with the device. If I'm right, by enabling LNA, your board is sending
some voltage through the cabling (you could easily check it with a voltmeter).

I actually have a multimeter somewhere. We're talking about the
antenna-in (unconnected) on the card, right? And what voltages
should I expect?


What I think that your patch is actually doing is to disable LNA. As such, it
should be equivalent to:


diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
index bc08f1d..98b482e 100644
--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -3288,13 +3288,13 @@ struct saa7134_board saa7134_boards[] = {
.name   = Pinnacle PCTV 310i,
.audio_clock= 0x00187de7,
.tuner_type = TUNER_PHILIPS_TDA8290,
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
-   .tuner_config   = 1,
+   .tuner_config   = 0,
.mpeg   = SAA7134_MPEG_DVB,
.gpiomask   = 0x00020,
.inputs = {{
.name = name_tv,
.vmux = 4,
.amux = TV,


Please test if the above patch fixes the issue you're suffering[1]. If so, then
we'll need to add a modprobe parameter to allow disabling LNA for saa7134 
devices
with LNA.

[1] Note: the above is not the fix, as some users of this board may be using the
original antenna, and changing tuner_config will break things for them; the 
right
fix is likely to allow controlling the LNA via userspace.

Tried that patch on 3.5.3. No improvement, unfortunately.

Regards,
/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-09-23 Thread Anders Thomson

On 2012-09-23 19:54, Anders Thomson wrote:

  diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
  index bc08f1d..98b482e 100644
  --- a/drivers/media/pci/saa7134/saa7134-cards.c
  +++ b/drivers/media/pci/saa7134/saa7134-cards.c
  @@ -3288,13 +3288,13 @@ struct saa7134_board saa7134_boards[] = {
.name   = Pinnacle PCTV 310i,
.audio_clock= 0x00187de7,
.tuner_type = TUNER_PHILIPS_TDA8290,
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
  - .tuner_config   = 1,
  + .tuner_config   = 0,
.mpeg   = SAA7134_MPEG_DVB,
.gpiomask   = 0x00020,
.inputs = {{
.name = name_tv,
.vmux = 4,
.amux = TV,


  Please test if the above patch fixes the issue you're suffering[1]. If so, 
then
  we'll need to add a modprobe parameter to allow disabling LNA for saa7134 
devices
  with LNA.

  [1] Note: the above is not the fix, as some users of this board may be using 
the
  original antenna, and changing tuner_config will break things for them; the 
right
  fix is likely to allow controlling the LNA via userspace.
Tried that patch on 3.5.3. No improvement, unfortunately.

I have to retract that. It turns out that there is some strange interaction
between the cabletv box and the card. When I rebooted into 'my' patch
I still got the noisy signal. I then power cycled the cabletv box, and 
voila,

I got a good signal on my own patch. Wondering what I had actually tested
with your patch, I tested it again, and indeed it works!

So, 1) you're on to something, that's for sure, and 2) there is 
_something_ in

the cabletv box which can make all this fall into a bad state too.

Cheers,
/Anders




--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-09-23 Thread Anders Thomson

On 2012-09-23 20:39, Anders Thomson wrote:

On 2012-09-23 19:54, Anders Thomson wrote:
 diff --git a/drivers/media/pci/saa7134/saa7134-cards.c 
b/drivers/media/pci/saa7134/saa7134-cards.c
 index bc08f1d..98b482e 100644
 --- a/drivers/media/pci/saa7134/saa7134-cards.c
 +++ b/drivers/media/pci/saa7134/saa7134-cards.c
 @@ -3288,13 +3288,13 @@ struct saa7134_board saa7134_boards[] = {
.name   = Pinnacle PCTV 310i,
.audio_clock= 0x00187de7,
.tuner_type = TUNER_PHILIPS_TDA8290,
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
 -  .tuner_config   = 1,
 +  .tuner_config   = 0,
.mpeg   = SAA7134_MPEG_DVB,
.gpiomask   = 0x00020,
.inputs = {{
.name = name_tv,
.vmux = 4,
.amux = TV,
  
  
 Please test if the above patch fixes the issue you're suffering[1]. If 
so, then
 we'll need to add a modprobe parameter to allow disabling LNA for 
saa7134 devices
 with LNA.
  
 [1] Note: the above is not the fix, as some users of this board may be 
using the
 original antenna, and changing tuner_config will break things for them; 
the right
 fix is likely to allow controlling the LNA via userspace.
  Tried that patch on 3.5.3. No improvement, unfortunately.
I have to retract that. It turns out that there is some strange interaction
between the cabletv box and the card. When I rebooted into 'my' patch
I still got the noisy signal. I then power cycled the cabletv box, and
voila,
I got a good signal on my own patch.
Awfully sorry about this. After having had the familty sit in and check 
the differences,
I must say that the patch does not fix the issue. This time around I 
have x11grabs with

ffmpeg to show if you want.

I'll be away from the card until the end of the coming week. Then, I'll 
bring out the multimeter...


Best regards,
/Anders
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-09-19 Thread Anders Thomson

On 2012-09-18 11:53, Mauro Carvalho Chehab wrote:

Em 16-09-2012 05:48, Anders Thomson escreveu:
  It doesn't make any difference though :-( I still have the layer of noise...

That's weird. Hmm... perhaps priv-cfg.config is being initialized
latter. Maybe you can then do, instead:

  return -EREMOTEIO;
  }

+priv-cfg.switch_addr = priv-i2c_props.addr;
  if ((data == 0x83) || (data == 0x84)) {
  priv-ver |= TDA18271;
  tda829x_tda18271_config.config = priv-cfg.config;



No dice:
 $ git diff | cat
diff --git a/drivers/media/common/tuners/tda8290.c 
b/drivers/media/common/tuners/tda8290.c

index 8c48521..16d7ff7 100644
--- a/drivers/media/common/tuners/tda8290.c
+++ b/drivers/media/common/tuners/tda8290.c
@@ -627,6 +627,9 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
return -EREMOTEIO;
}

+   tuner_info(ANDERS: old priv-cfg.switch_addr %x\n, 
priv-cfg.switch_addr);

+   priv-cfg.switch_addr = priv-i2c_props.addr;
+   tuner_info(ANDERS: new priv-cfg.switch_addr %x\n, 
priv-cfg.switch_addr);

if ((data == 0x83) || (data == 0x84)) {
priv-ver |= TDA18271;
tda829x_tda18271_config.config = priv-cfg.config;
@@ -640,7 +643,6 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
   priv-i2c_props.adap, priv-cfg);
-   priv-cfg.switch_addr = priv-i2c_props.addr;
}
if (fe-ops.tuner_ops.init)
fe-ops.tuner_ops.init(fe);
anders@tv /usr/src/linux $ dmesg | grep ANDERS
[5.667022] tda829x 4-004b: ANDERS: old priv-cfg.switch_addr 0
[5.667025] tda829x 4-004b: ANDERS: new priv-cfg.switch_addr 4b

Whereas to work, I need:
anders@tv /usr/src/linux $ grep ANDERS /3.3.8-d.patched
[6.565254] tda829x 5-004b: ANDERS: setting switch_addr. was 0x00, 
new 0x4b

[6.565265] tda829x 5-004b: ANDERS: new 0x61

The right data should come from some i2d property I gather...
Is there any i2c CONFIG I need to have enabled to have this working 
automagically?


here's what I have:
$ zgrep I2C /proc/config.gz
# CONFIG_BMP085_I2C is not set
CONFIG_SENSORS_LIS3_I2C=y
# CONFIG_MOUSE_SYNAPTICS_I2C is not set
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=m
# CONFIG_I2C_MUX is not set
CONFIG_I2C_HELPER_AUTO=y
CONFIG_I2C_SMBUS=m
CONFIG_I2C_ALGOBIT=y
# I2C Hardware Bus support
CONFIG_I2C_ALI1535=m
CONFIG_I2C_ALI1563=m
CONFIG_I2C_ALI15X3=m
CONFIG_I2C_AMD756=m
CONFIG_I2C_AMD756_S4882=m
CONFIG_I2C_AMD8111=m
CONFIG_I2C_I801=m
# CONFIG_I2C_ISCH is not set
CONFIG_I2C_PIIX4=m
CONFIG_I2C_NFORCE2=m
# CONFIG_I2C_NFORCE2_S4985 is not set
CONFIG_I2C_SIS5595=m
CONFIG_I2C_SIS630=m
CONFIG_I2C_SIS96X=m
CONFIG_I2C_VIA=m
CONFIG_I2C_VIAPRO=m
CONFIG_I2C_SCMI=m
# I2C system bus drivers (mostly embedded / system-on-chip)
# CONFIG_I2C_DESIGNWARE_PCI is not set
# CONFIG_I2C_EG20T is not set
# CONFIG_I2C_INTEL_MID is not set
CONFIG_I2C_OCORES=m
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_I2C_PXA_PCI is not set
CONFIG_I2C_SIMTEC=m
# CONFIG_I2C_XILINX is not set
# External I2C/SMBus adapter drivers
# CONFIG_I2C_DIOLAN_U2C is not set
CONFIG_I2C_PARPORT=m
CONFIG_I2C_PARPORT_LIGHT=m
CONFIG_I2C_TAOS_EVM=m
CONFIG_I2C_TINY_USB=m
# Other I2C/SMBus bus drivers
CONFIG_I2C_STUB=m
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
# CONFIG_MFD_DA9052_I2C is not set
# CONFIG_MFD_WM831X_I2C is not set
# CONFIG_MFD_WM8350_I2C is not set
# CONFIG_MFD_MC13XXX_I2C is not set
CONFIG_VIDEO_IR_I2C=m
# CONFIG_I2C_SI4713 is not set
# I2C encoder or helper chips
# CONFIG_DRM_I2C_CH7006 is not set
# CONFIG_DRM_I2C_SIL164 is not set
CONFIG_FB_RADEON_I2C=y
# I2C RTC drivers

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-09-19 Thread Anders Thomson

On 2012-09-19 18:45, Mauro Carvalho Chehab wrote:

Em 19-09-2012 10:01, Anders Thomson escreveu:
  On 2012-09-18 11:53, Mauro Carvalho Chehab wrote:
  Em 16-09-2012 05:48, Anders Thomson escreveu:
 It doesn't make any difference though :-( I still have the layer of 
noise...

  That's weird. Hmm... perhaps priv-cfg.config is being initialized
  latter. Maybe you can then do, instead:

return -EREMOTEIO;
}

  +priv-cfg.switch_addr = priv-i2c_props.addr;
if ((data == 0x83) || (data == 0x84)) {
priv-ver |= TDA18271;
tda829x_tda18271_config.config = priv-cfg.config;


  No dice:
   $ git diff | cat
  diff --git a/drivers/media/common/tuners/tda8290.c 
b/drivers/media/common/tuners/tda8290.c
  index 8c48521..16d7ff7 100644
  --- a/drivers/media/common/tuners/tda8290.c
  +++ b/drivers/media/common/tuners/tda8290.c
  @@ -627,6 +627,9 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
  return -EREMOTEIO;
  }

  +   tuner_info(ANDERS: old priv-cfg.switch_addr %x\n, 
priv-cfg.switch_addr);
  +   priv-cfg.switch_addr = priv-i2c_props.addr;
  +   tuner_info(ANDERS: new priv-cfg.switch_addr %x\n, 
priv-cfg.switch_addr);
  if ((data == 0x83) || (data == 0x84)) {
  priv-ver |= TDA18271;
  tda829x_tda18271_config.config = priv-cfg.config;
  @@ -640,7 +643,6 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

  dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
 priv-i2c_props.adap,priv-cfg);
  -   priv-cfg.switch_addr = priv-i2c_props.addr;
  }
  if (fe-ops.tuner_ops.init)
  fe-ops.tuner_ops.init(fe);
  anders@tv /usr/src/linux $ dmesg | grep ANDERS
  [5.667022] tda829x 4-004b: ANDERS: old priv-cfg.switch_addr 0
  [5.667025] tda829x 4-004b: ANDERS: new priv-cfg.switch_addr 4b

switch_addr got properly filled here.
Well, it got filled with 4b, but that it not what is needed. Recall my 
own patch:

# cat /TV_CARD.diff
diff --git a/drivers/media/common/tuners/tda8290.c 
b/drivers/media/common/tuners/tda8290.c

index 064d14c..498cc7b 100644
--- a/drivers/media/common/tuners/tda8290.c
+++ b/drivers/media/common/tuners/tda8290.c
@@ -635,7 +635,11 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
   priv-i2c_props.adap, priv-cfg);
+   tuner_info(ANDERS: setting switch_addr. was 0x%02x, new 
0x%02x\n,priv-cfg.switch_addr,priv-i2c_props.addr);

priv-cfg.switch_addr = priv-i2c_props.addr;
+   priv-cfg.switch_addr = 0xc2 / 2;
+   tuner_info(ANDERS: new 0x%02x\n,priv-cfg.switch_addr);
+
}
if (fe-ops.tuner_ops.init)
fe-ops.tuner_ops.init(fe);
It needs to be filled with 0xc2 / 2. I'm not sure where I got that 
expression from, but it is the sum of my efforts tracing code changes 
around 2.6.26.


  Whereas to work, I need:
  anders@tv /usr/src/linux $ grep ANDERS /3.3.8-d.patched
  [6.565254] tda829x 5-004b: ANDERS: setting switch_addr. was 0x00, new 
0x4b

What looks weird here is that the device number changed from 4 to 5.
I have a webcam permanently on USB, so it ends up as two v4l2 devices 
(with device enumeration changing between boots)


Do you have more than one board on your machine?

  [6.565265] tda829x 5-004b: ANDERS: new 0x61


The 0x61 address should be filled already by the existing code, otherwise
you wouldn't be able to switch from one channel to another one.

If you're in doubt, you could add an extra printk at the initialization code,
in order to see what's happening there.
Not sure I follow here. Which code should set the ox61 address? I'd be 
more than happy to add printks. Where? I recall getting lost in how this 
stuff uses the i2c code in the past.

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-09-16 Thread Anders Thomson

On 2012-09-16 00:25, Mauro Carvalho Chehab wrote:

Em Sat, 15 Sep 2012 20:12:49 +0200
Anders Thomsonaerikss...@gmail.com  escreveu:

  On 2012-09-15 19:58, Mauro Carvalho Chehab wrote:
Em Sat, 15 Sep 2012 19:39:31 +0200
Anders Thomsonaerikss...@gmail.com   escreveu:
  
   On 2012-09-15 18:34, Mauro Carvalho Chehab wrote:
  $ cat /TV_CARD.diff
  diff --git a/drivers/media/common/tuners/tda8290.c
  b/drivers/media/common/tuners/tda8290.c
  index 064d14c..498cc7b 100644
  --- a/drivers/media/common/tuners/tda8290.c
  +++ b/drivers/media/common/tuners/tda8290.c
  @@ -635,7 +635,11 @@ static int tda829x_find_tuner(struct 
dvb_frontend *fe)
  
   dvb_attach(tda827x_attach, fe, 
priv-tda827x_addr,
  priv-i2c_props.adap,priv-cfg);
  +   tuner_info(ANDERS: setting switch_addr. was 
0x%02x, new
  0x%02x\n,priv-cfg.switch_addr,priv-i2c_props.addr);
   priv-cfg.switch_addr = 
priv-i2c_props.addr;
  +   priv-cfg.switch_addr = 0xc2 / 2;
   
  No, this is wrong. The I2C address is passed by the bridge driver 
or by
  the tuner_core attachment, being stored at priv-i2c_props.addr.
   
  What's the driver and card you're using?
   
   lspci -vv:
   03:06.0 Multimedia controller: Philips Semiconductors
   SAA7131/SAA7133/SAA7135 Video Broadcast Decoder (rev d1)
Subsystem: Pinnacle Systems Inc. Device 002f
  
There are lots of Pinnacle device supported by saa7134 driver. Without its
PCI ID that's not much we can do.
  That here, right?
  lspci -nvv:
  03:06.0 0480: 1131:7133 (rev d1)
   Subsystem: 11bd:002f
   Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
  ParErr- Stepping- SERR- FastB2B- DisINTx-
   Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium
   TAbort-TAbort-MAbort-SERR-PERR- INTx-
   Latency: 64 (21000ns min, 8000ns max)
   Interrupt: pin A routed to IRQ 21
   Region 0: Memory at fdeff000 (32-bit, non-prefetchable) [size=2K]
   Capabilities: [40] Power Management version 2
   Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA
  PME(D0-,D1-,D2-,D3hot-,D3cold-)
   Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME-
   Kernel driver in use: saa7134
   Kernel modules: saa7134




Also, please post the dmesg showing what happens without and with your 
patch.
  Coming. Hold on...

Thanks!

Please try the enclosed patch.

-

[PATCH] tda8290: Fix lna switch address

When LNA is configured with config 1 or config 2, tda827x driver
will use the LNA switch_addr. However, this is not happening for
all devices using such config, as reported by Anders. According
to him, he is experiencing bad tuning with this code since
Kenrel 2.6.26.

Reported-by: Anders Thomsonaerikss...@gmail.com
Signed-off-by: Mauro Carvalho Chehabmche...@redhat.com

diff --git a/drivers/media/tuners/tda8290.c b/drivers/media/tuners/tda8290.c
index 8c48521..bedc6ce 100644
--- a/drivers/media/tuners/tda8290.c
+++ b/drivers/media/tuners/tda8290.c
@@ -627,6 +627,9 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
return -EREMOTEIO;
}

+   if (priv-cfg.config == 1 || priv-cfg.config == 2)
+   priv-cfg.switch_addr = priv-i2c_props.addr;
+
if ((data == 0x83) || (data == 0x84)) {
priv-ver |= TDA18271;
tda829x_tda18271_config.config = priv-cfg.config;
@@ -640,7 +643,6 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
   priv-i2c_props.adap,priv-cfg);
-   priv-cfg.switch_addr = priv-i2c_props.addr;
}
if (fe-ops.tuner_ops.init)
fe-ops.tuner_ops.init(fe);



Hi,
Which tree should this be applied to? I have no drivers/media/tuners dir 
here.

However, it applies cleanly to 3.5.3 as:
 diff --git a/drivers/media/common/tuners/tda8290.c 
b/drivers/media/common/tuners/tda8290.c

index 8c48521..bedc6ce 100644
--- a/drivers/media/common/tuners/tda8290.c
+++ b/drivers/media/common/tuners/tda8290.c
@@ -627,6 +627,9 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)
return -EREMOTEIO;
}

+   if (priv-cfg.config == 1 || priv-cfg.config == 2)
+   priv-cfg.switch_addr = priv-i2c_props.addr;
+
if ((data == 0x83) || (data == 0x84)) {
priv-ver |= TDA18271;
tda829x_tda18271_config.config = priv-cfg.config;
@@ -640,7 +643,6 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
   priv-i2c_props.adap, priv-cfg);
-   

Re: tda8290 regression fix

2012-09-15 Thread Anders Thomson

On 2012-09-15 18:34, Mauro Carvalho Chehab wrote:

  $ cat /TV_CARD.diff
  diff --git a/drivers/media/common/tuners/tda8290.c
  b/drivers/media/common/tuners/tda8290.c
  index 064d14c..498cc7b 100644
  --- a/drivers/media/common/tuners/tda8290.c
  +++ b/drivers/media/common/tuners/tda8290.c
  @@ -635,7 +635,11 @@ static int tda829x_find_tuner(struct dvb_frontend *fe)

   dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
  priv-i2c_props.adap,priv-cfg);
  +   tuner_info(ANDERS: setting switch_addr. was 0x%02x, new
  0x%02x\n,priv-cfg.switch_addr,priv-i2c_props.addr);
   priv-cfg.switch_addr = priv-i2c_props.addr;
  +   priv-cfg.switch_addr = 0xc2 / 2;

No, this is wrong. The I2C address is passed by the bridge driver or by
the tuner_core attachment, being stored at priv-i2c_props.addr.

What's the driver and card you're using?


lspci -vv:
03:06.0 Multimedia controller: Philips Semiconductors 
SAA7131/SAA7133/SAA7135 Video Broadcast Decoder (rev d1)

Subsystem: Pinnacle Systems Inc. Device 002f
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium 
TAbort- TAbort- MAbort- SERR- PERR- INTx-

Latency: 64 (21000ns min, 8000ns max)
Interrupt: pin A routed to IRQ 21
Region 0: Memory at fdeff000 (32-bit, non-prefetchable) [size=2K]
Capabilities: [40] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)

Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME-
Kernel driver in use: saa7134
Kernel modules: saa7134

Without the patch I get a layer of noise added. Kind of like a weak 
aerial signal to an old analogue TV set.


-Anders
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-09-15 Thread Anders Thomson

On 2012-09-15 19:39, Anders Thomson wrote:

On 2012-09-15 18:34, Mauro Carvalho Chehab wrote:
 $ cat /TV_CARD.diff
 diff --git a/drivers/media/common/tuners/tda8290.c
 b/drivers/media/common/tuners/tda8290.c
 index 064d14c..498cc7b 100644
 --- a/drivers/media/common/tuners/tda8290.c
 +++ b/drivers/media/common/tuners/tda8290.c
 @@ -635,7 +635,11 @@ static int tda829x_find_tuner(struct dvb_frontend 
*fe)
  
  dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
 priv-i2c_props.adap,priv-cfg);
 +   tuner_info(ANDERS: setting switch_addr. was 0x%02x, new
 0x%02x\n,priv-cfg.switch_addr,priv-i2c_props.addr);
  priv-cfg.switch_addr = priv-i2c_props.addr;
 +   priv-cfg.switch_addr = 0xc2 / 2;

  No, this is wrong. The I2C address is passed by the bridge driver or by
  the tuner_core attachment, being stored at priv-i2c_props.addr.

  What's the driver and card you're using?



...and here's the modules I'm using
Module  Size  Used by
hid_sunplus 1321  0
usbhid 29765  0
uinput  6426  2
saa7134_alsa9359  0
tda1004x   12639  1
saa7134_dvb22092  0
videobuf_dvb4106  1 saa7134_dvb
dvb_core   78773  1 videobuf_dvb
ir_kbd_i2c  4473  0
tda827x 8291  2
tda829011906  1
tuner  13649  1
uvcvideo   54515  0
videobuf2_core 15467  1 uvcvideo
snd_hda_codec_realtek46581  1
saa7134   149350  2 saa7134_alsa,saa7134_dvb
videobuf_dma_sg 6504  3 saa7134_alsa,saa7134_dvb,saa7134
videobuf_core  12866  3 videobuf_dvb,saa7134,videobuf_dma_sg
snd_hda_intel  20144  1
snd_hda_codec  59409  2 snd_hda_codec_realtek,snd_hda_intel
v4l2_common 4558  2 tuner,saa7134
videodev   68383  4 tuner,uvcvideo,saa7134,v4l2_common
snd_usb_audio  81087  0
lirc_dev9954  0
ir_mce_kbd_decoder  2838  0
parport_pc 27310  0
rc_imon_mce 1349  0
v4l2_compat_ioctl32 6796  1 videodev
ir_rc6_decoder  1946  0
videobuf2_vmalloc   1812  1 uvcvideo
snd_usbmidi_lib15516  1 snd_usb_audio
tveeprom   12721  1 saa7134
snd_hwdep   5006  2 snd_hda_codec,snd_usb_audio
asus_atk01107054  0
parport24807  1 parport_pc
i2c_piix4   7680  0
videobuf2_memops1638  1 videobuf2_vmalloc
ir_rc5_decoder  1433  0
imon   18432  1
rc_core10749  8 
ir_kbd_i2c,saa7134,ir_mce_kbd_decoder,rc_imon_mce,ir_rc6_decoder,ir_rc5_decoder,imon

pcspkr  1659  0
atiixp  2404  0
rtc_cmos7570  0
sg 20980  0
snd_rawmidi14984  1 snd_usbmidi_lib


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: tda8290 regression fix

2012-09-15 Thread Anders Thomson

On 2012-09-15 19:58, Mauro Carvalho Chehab wrote:

Em Sat, 15 Sep 2012 19:39:31 +0200
Anders Thomsonaerikss...@gmail.com  escreveu:

  On 2012-09-15 18:34, Mauro Carvalho Chehab wrote:
   $ cat /TV_CARD.diff
   diff --git a/drivers/media/common/tuners/tda8290.c
   b/drivers/media/common/tuners/tda8290.c
   index 064d14c..498cc7b 100644
   --- a/drivers/media/common/tuners/tda8290.c
   +++ b/drivers/media/common/tuners/tda8290.c
   @@ -635,7 +635,11 @@ static int tda829x_find_tuner(struct 
dvb_frontend *fe)

dvb_attach(tda827x_attach, fe, priv-tda827x_addr,
   priv-i2c_props.adap,priv-cfg);
   +   tuner_info(ANDERS: setting switch_addr. was 0x%02x, 
new
   0x%02x\n,priv-cfg.switch_addr,priv-i2c_props.addr);
priv-cfg.switch_addr = priv-i2c_props.addr;
   +   priv-cfg.switch_addr = 0xc2 / 2;
  
No, this is wrong. The I2C address is passed by the bridge driver or by
the tuner_core attachment, being stored at priv-i2c_props.addr.
  
What's the driver and card you're using?
  
  lspci -vv:
  03:06.0 Multimedia controller: Philips Semiconductors
  SAA7131/SAA7133/SAA7135 Video Broadcast Decoder (rev d1)
   Subsystem: Pinnacle Systems Inc. Device 002f

There are lots of Pinnacle device supported by saa7134 driver. Without its
PCI ID that's not much we can do.

That here, right?
lspci -nvv:
03:06.0 0480: 1131:7133 (rev d1)
Subsystem: 11bd:002f
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- 
ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium 
TAbort- TAbort- MAbort- SERR- PERR- INTx-

Latency: 64 (21000ns min, 8000ns max)
Interrupt: pin A routed to IRQ 21
Region 0: Memory at fdeff000 (32-bit, non-prefetchable) [size=2K]
Capabilities: [40] Power Management version 2
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA 
PME(D0-,D1-,D2-,D3hot-,D3cold-)

Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=1 PME-
Kernel driver in use: saa7134
Kernel modules: saa7134





Also, please post the dmesg showing what happens without and with your patch.

Coming. Hold on...

Regards,
Mauro


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html