[i2c] "hotplug" i2c

Jean Delvare khali at linux-fr.org
Tue Nov 20 23:07:23 CET 2007


Hi Ivan,

On Sat, 13 Oct 2007 00:07:12 +0300, Ivan Kuten wrote:
> I'm looking for some advice on "hotplug" i2c topic and possible way to implement it.
> Some details:
> 
> We have i2c slave chip connected via pluggable cable to the main board. Chip presence
> is determined by having i2c "ping" communication with a chip from CPU. When kernel has
> bootup and i2c driver registered - it's OK we can unplug cable and plug it back,
> only having "can't get i2c bus" messages when cable unplugged.
> 
> But what to do if board booting without cable plugged? i2c core tries several times
> to find chip - and then give up. Next when cable get plugged - we have nothing, because
> driver failed to register.
> 
> Is there is any approach in i2c to handle this situation? I know something like
> this is get handled when you insert USB stick - and there is notification to userspace
> that say automounter daemon can mount partition.
> 
> I wonder what is a correct approach to handle this for i2c.

Hotplug isn't supported by the Linux i2c subsystem at all. I'm not even
sure if the I2C specification mentions hotplug at all. This is the
first time I hear about someone trying to do this.

The only safe way to achieve what you're trying to do would be to
remove the i2c bus itself before you disconnect the i2c chip, and wait
until the i2c chip is connected again before you re-enable the
underlying i2c bus. But I don't think you can automate this. While USB
devices can notify the host when they are plugged in, I2C devices have
no way to let the bus master(s) know that they are there.

-- 
Jean Delvare



More information about the i2c mailing list