[i2c] Fwd: I2C probe 10bit address

Jean Delvare khali at linux-fr.org
Sun Nov 19 21:12:27 CET 2006


On Sun, 19 Nov 2006 20:01:46 +0100, Salvatore Benedetto wrote:
> On 11/19/06, Jean Delvare <khali at linux-fr.org> wrote:
> > Indeed, this is the problem. Structure initializers without named
> > fields break as soon as the structure definition changes, and that's
> > what just happened here. If the driver author had been using proper
> > structure initialization:
> >
> > static struct i2c_client_address_data addr_data = {
> >         .normal_i2c             = normal_i2c,
> >         .normal_i2c_range       = normal_i2c_range,
> >         .probe                  = probe,
> >         .probe_range            = probe_range,
> >         .ignore                 = ignore,
> >         .ignore_range           = ignore_range,
> >         .force                  = force,
> > };
> >
> > Then the code would have failed to compile and you would have noticed
> > the problem right away. Even better, the author could have been using
> > the macro doing exactly the above:
> >
> > I2C_CLIENT_INSMOD;
> 
> I'll try to make those changes  myself., but my question is, why is the
> module working on my gentoo box with a 2.6.17.6 vanilla kernel?

There is simply no way the code you quoted would work on 2.6.17.6. You
must have been overlooking something.

> > And it would compile (with a warning) and work. You should report the
> > problem to the usbvision author. BTW, he or she should consider merging
> > his or her code into mainstream, so that users don't have to patch
> > their kernel, with all the incurred trouble you just went through.
> >
> > I don't want to sound negative, but if the usbvision driver actually
> > wasn't updated since 2.6.12, I expect many more problems, as the i2c
> > subsystem received many changes since then. I'm surprised the code
> > compiled at all. Are you really certain there is no newer version
> > available?
> 
> You made me laugh, because I've been using the CVS version of the driver!
> :)

Interesting. Where did you get it from? 'cause the saa7113.c file from
usbvision CVS is here:
http://usbvision.cvs.sourceforge.net/usbvision/usbvision/src/saa7113.c?revision=1.23&view=markup

And it doesn't include the lines of code you quoted. The file
saa7113-new.c, however does contain them, but this file is obviously
meant for Linux 2.4, not 2.6. So it looks to me like you ended up using
the wrong file for your system.

> Anyway, as I already said, this modules compiled and worked on my gentoo box
> with a 2.6.17.6 vanilla kernel. So I'm wondering
> how can it be that the problem? I'm still studying on how the actually I2C
> chip addresses are found. I just recompiled both of my kernels
> (gentoo box and FOX board) with all the I2C debug options on, and the more
> interesting messages I found are
> 
> Nov 19 19:50:51 xartime [4308668.666000] tuner 0-0061: chip found @ 0xc2
> (usbvision #0)
> Nov 19 19:50:51 xartime [4308668.666000] tuner 0-0061: Tuner has no way to
> set tv freq
> Nov 19 19:50:51 xartime [4308668.679000] tuner 0-0061: type set to 5
> (Philips PAL_BG (FI1216 and compatibles))
> 
> but I haven't figure out yet who or what generate that message. I guess

The tuner driver does.

> that's the I2C address of the tuner chip, right?!

It is. Beware that the tuner driver is displaying the address as an
8-bit number, while the actual address is 7-bit, so you need to divide
the hexadecimal value by 2 to get the actual address.

> Because I tried the WinTV on different usb port, but the address is always
> the same. Does it mean that it is an I2C static address?

Yes it is. The SMBus specification includes an address resolution
protocol for dynamically allocated addresses, but Linux doesn't support
that yet, so all addresses are statically allocated.

-- 
Jean Delvare



More information about the i2c mailing list