[i2c] driver support for smbus mux

Trent Piepho xyzzy at speakeasy.org
Wed Apr 30 23:38:52 CEST 2008


On Tue, 29 Apr 2008, Darren Zhang wrote:
> In my system the I2C bus is multiplexed into 4 segments using an analog
> multiplexer.
> When I use i2cdetect, only devices before the i2c mux can be detected.
> I wonder if this kind of hardware configuration is supported in the latest
> 2.6 kernal
> s.t. I can use i2ctools (i2cdetect/i2cdump/i2cset) to access devices behind
> the i2c mux?
> Any suggestion appreciated.

Lot of DVB cards have the same issue, with stuff behind a i2c gateway to
shield it from the noise of i2c traffic for other chips.

You could always program the MUX (with i2c-dev or write a driver), scan
the bus, change the mux, scan again, etc.

I've thought that it might be useful in some cases to create a "virtual"
i2c bus for what's behind the i2c gate or on each branch of the mux.

What you do is write a driver for the mux chip that registers four new i2c
busses.  This driver's i2c transfer function just sets the mux to the
proper channel (if it's not already there) and then passes on it's
arguments to the i2c transfer of the bus the mux is on.

You'd need to make sure the mux driver has a common mutex for all four
virtual busses, as I think the i2c layer mutex is per bus and wouldn't stop
simultaneous transactions on multiple virtual busses at once.



More information about the i2c mailing list