On Sun, 9 Jul 2006, manu wrote:
> Hi all,
> I was browsing the code in tuner-core.c and saw this in set_type:
>
> case TUNER_LG_TDVS_H06XF:
> /* Set the Auxiliary Byte. */
> buffer[2] &= ~0x20;
> buffer[2] |= 0x18;
> buffer[3] = 0x20;
> i2c_master_send(c, buffer, 4);
> default_tuner_init(c);
> break;
>
> but buf[0] and buf[1] never get init before.
buffer[2] isn't initialized either. Here is message from the author of
this code:
http://www.linuxtv.org/pipermail/linux-dvb/2005-August/003978.html
You can download the datasheet for the TUA6034, the chip programmed here,
from Infineon's website. It is just a standard I2C tuner PLL like a
hundred other cards use. These tuners are programmed with a 4 byte
message, which is really two 2 byte messages back to back. These two
messages can be sent individually.
It looks like the author thought he was modifying an existing message to
the tuner, rather than working with an empty buffer.
That code is clearly trying to set the Aux byte to 0x20, which is its
default value after power on reset. What it really is doing is just
writing random values into the tuner control registers, which doesn't
matter because they will just get overwritten when the tuner is used. It
may or may not actually set the aux byte, depending on what happens to be
in buffer[2].
I'll attach two patches, the first fixes this to do what the original
author probably wanted to do.
The second just gets rid of it, I don't think this code is necessary at
all. There are plenty of other tuners with TUA603x chips that have this
same aux byte, and none of them have this code to set the it to the default
value.
Could someone with a LG TDVS-H06xF test this?
diff -r 89ee5e4c201a linux/drivers/media/video/tuner-core.c
--- a/linux/drivers/media/video/tuner-core.c Fri Jun 30 14:05:26 2006 -0700
+++ b/linux/drivers/media/video/tuner-core.c Mon Jul 10 02:06:46 2006 -0700
@@ -224,11 +224,12 @@ static void set_type(struct i2c_client *
default_tuner_init(c);
break;
case TUNER_LG_TDVS_H06XF:
- /* Set the Auxiliary Byte. */
- buffer[2] &= ~0x20;
- buffer[2] |= 0x18;
- buffer[3] = 0x20;
- i2c_master_send(c, buffer, 4);
+ /* Set the Auxiliary Byte to default value:
+ ATC = 0: default time constant (2s) for AGC takeover
+ ALx = 0,1,0: AGC takeover point 112dBuV (default). */
+ buffer[0] = 0xdf;
+ buffer[1] = 0x20;
+ i2c_master_send(c, buffer, 2);
default_tuner_init(c);
break;
case TUNER_PHILIPS_TD1316:
diff -r 89ee5e4c201a linux/drivers/media/video/tuner-core.c
--- a/linux/drivers/media/video/tuner-core.c Fri Jun 30 14:05:26 2006 -0700
+++ b/linux/drivers/media/video/tuner-core.c Mon Jul 10 02:07:28 2006 -0700
@@ -223,14 +223,6 @@ static void set_type(struct i2c_client *
i2c_master_send(c, buffer, 4);
default_tuner_init(c);
break;
- case TUNER_LG_TDVS_H06XF:
- /* Set the Auxiliary Byte. */
- buffer[2] &= ~0x20;
- buffer[2] |= 0x18;
- buffer[3] = 0x20;
- i2c_master_send(c, buffer, 4);
- default_tuner_init(c);
- break;
case TUNER_PHILIPS_TD1316:
buffer[0] = 0x0b;
buffer[1] = 0xdc;
_______________________________________________
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb