[i2c] How to find an i2c_adapter in the system
khali at linux-fr.org
Wed Nov 21 16:03:22 CET 2007
On Tue, 20 Nov 2007 16:16:35 -0800, David Brownell wrote:
> On Tuesday 20 November 2007, Jean Delvare wrote:
> > It might make sense to arbitrarily reserve I2C bus number 0 and 1 for
> > the mainboard SMBus on x86. That would only require minor changes to
> > i2c-boardinfo (basically, initialize __i2c_first_dynamic_bus_num to 2
> > instead of 0, and change i2c-i801 and friends to use
> > i2c_add_numbered_adapter instead of i2c_add_adapter.) Not necessarily
> > very clean, but that should work. David, what do you think?
> Would that be a PC-specific change?
Not sure yet.
> I could imagine it working,
> but it'd be good to know what ACPI and PC design specs say.
I'm not sure what you mean here? What could these specs say that would
affect our decision?
> Also, wouldn't some servers have more than two SMBus adapters?
Ah, good question. I've never seen PC motherboards with more than two
SMBus masters, however I remember that the Tyan S4882 has a multiplexed
SMBus, so it has a total of 5 i2c_adapters. In theory, there's nothing
preventing a given mother board to multiplex its SMBus even more. OTOH,
as long as none of these special boards need to register new-style I2C
devices at boot time, it doesn't really matter.
I would prefer to set __i2c_first_dynamic_bus_num dynamically depending
on the system, however I can't think of a way to implement this. By the
time we have the information, other i2c_adapters may have been
registered (for example by the framebuffer drivers, which are loaded
relatively early in the boot process.) If anyone has an idea, please
For now, the only driver which needs this is the one Hendrik is working
on. As this appears to be a rather specific case, I don't expect too
many similar cases in the future, so it might be acceptable to simply
add platform-style code to instantiate the I2C device early in the boot
process for the specific machines that need it (which will in turn
reserve i2c-0 for static allocation) and change i2c-i801 to use
i2c_add_numbered_adapter()... The problem is that the i2c-i801 driver
is used in many other systems where no I2C device will be registered,
meaning that i2c-0 won't be reserved and i2c_add_numbered_adapter()
will fail. So we'd need a "best-effort" variant of
i2c_add_numbered_adapter(), which tries to get a specific number if
possible but doesn't fail if it cannot. That's not particularly
> How do the various flavors of MS-Windows manage SMBus ... purely
> through ACPI? Or not-at-all?
As far as I know, they do not handle it at all. Only vendor-specific
tools care about the SMBus (hardware monitoring applications or
laptop-specific applications) so they know exactly what chips are
available and how to access them.
More information about the i2c