Trent Piepho wrote: > 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. This was sent to the wrong mailing list... it should have gone to the video4linux list. I'm not going to bother adding cc's , since we already seem to have this issue resolved, for the most part. > 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]. 0x20 for analog, 0x50 for digital. > 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. We need it -- this is a hybrid tuner, and we must set that byte to ensure that the tuner is set to analog mode on startup. > Could someone with a LG TDVS-H06xF test this? I didnt test this yet, but I'm not crazy about that "0xdf" value .... iirc, based on my usb sniffs, we might be better with 0x9f -- I think that's what the usb windows driver sends, but I have to double check. We cannot simple omit this case -- it is needed for switching back to analog mode after using digital mode. I've known about this for a while, but kept forgetting to fix this until now. A patch similar to that below could be applied, but let me go back and test a few things first. > 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: > > Mike Krufky _______________________________________________ linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb