[lm-sensors] [PATCH] I2C: i2c_bit_add_bus should initialize SDA and SCL lines

Krzysztof Halasa khc at pm.waw.pl
Sun Jun 11 00:27:14 CEST 2006


"Mark M. Hoffman" <mhoffman at lightlink.com> writes:

> SCL and SDA must be pulled high by hardware.  If a driver inits to
> setting them low, that's a bug in the driver.

Thanks for your response.

The question is rather who inits the lines: a) the hw driver,
b) the I2C algorithm driver.

With a) every hw driver has to know how to init them (duplicated
code but there might be positive side).

With b) I2C algorithm driver inits the lines and hw driver
doesn't worry about but it might have some limitations such
as unknown SCL state.

I understand the current case is a) - right?

The other question is _how_ to init the lines. There are 4 possible
hardware initial conditions:

a)  0   0 (outputs zeroed by default)
b)  0   1 (uncommon but may be left in this state by previous operations)
c)  1   0 (ditto)
d)  1   1 (I/O lines configured as input by default)

The internal state of devices connected to the bus is potentially
unknown. Some implementations just start with STOP to eliminate
this problem, I don't know what Linux driver is supposed to do.

(Other implementation I know are rather specialized and thus they
know their hardware init state, Linux I2C algorithm handles many
devices with potentially different initial state of hardware lines).

To summarize questions:
- is it the hw driver who has to init the bus
- how to init the bus (depending on init state)
Krzysztof Halasa

More information about the lm-sensors mailing list