OSDN Git Service

i2c/pca954x: Initialize the mux to disconnected state
authorPetri Gynther <pgynther@google.com>
Wed, 29 Jun 2011 09:36:11 +0000 (11:36 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 9 Jul 2011 06:15:28 +0000 (23:15 -0700)
commit27747f54a2365afc4e7c10ee9540e350b785eb91
tree1714418b81f618ff1e11d86926d2584e634ccd27
parent6e8ab50e5301fb74d9874ba3f66b4c930c72b487
i2c/pca954x: Initialize the mux to disconnected state

commit cd823db8b1161ef0d756514d280715a576d65cc3 upstream.

pca954x power-on default is channel 0 connected. If multiple pca954x
muxes are connected to the same physical I2C bus, the parent bus will
see channel 0 devices behind both muxes by default. This is bad.

Scenario:
            -- pca954x @ 0x70 -- ch 0 (I2C-bus-101) -- EEPROM @ 0x50
            |
I2C-bus-1 ---
            |
            -- pca954x @ 0x71 -- ch 0 (I2C-bus-111) -- EEPROM @ 0x50

1. Load I2C bus driver: creates I2C-bus-1
2. Load pca954x driver: creates virtual I2C-bus-101 and I2C-bus-111
3. Load eeprom driver
4. Try to read EEPROM @ 0x50 on I2C-bus-101. The transaction will also bleed
   onto I2C-bus-111 because pca954x @ 0x71 channel 0 is connected by default.

Fix: Initialize pca954x to disconnected state in pca954x_probe()

Signed-off-by: Petri Gynther <pgynther@google.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/i2c/muxes/pca954x.c