[i2c] I2C functionality bits
Jean Delvare
khali at linux-fr.org
Thu Nov 2 09:04:12 CET 2006
Hi Till,
On 10/31/2006, Till Harbaum wrote:
> i have nearly finished my "tiny i2c to usb converter" named i2c-tiny-usb.
> I just found out that the ds1621 i had attached to it wasn't detected since
> the old sensors-detect included with suse 9.3 is buggy with respect to 1621
> detection. So i installed the latest lm_sensors. Just to find out that my
> interface wasn't supported at all anymore.
>
> This is due to the fact that my interface is very closely coupled to the
> linux kernel i2c concept.
It better does ;)
> It uses exactly the same messages and flags and e.g. also reports its
> functionality using that 32 bit field. And i soon found out that
> sensors-detect nowadays expects a bunch of functionality before it even
> dares to scan the bus.
sensors-detect is simply checking that the functionalities it is about to
use are available. It did not before, and that was a bug.
> Long explanation, short question: What do these bits exactly mean?
They describe the kind of transactions the bus supports, as well as some
options. Please read Documentation/i2c/functionality (in the 2.6 kernel
tree.)
> My device physically supports a bitbanging i2c and can interpret this
> sequences the kernel sends. But it e.g. doesn't support 10 bit addresses
> (as i haven't a device to test. if someone wants to donate a test device
> just send me an email). What bits should i be setting in the
> functionality vector?
> Especially: What smbus bits should be returned for my pure i2c device?
> I've now added the entire I2C_FUNC_SMBUS_EMUL thing. Is this correct?
If you are doing bit-banging, please don't reimplement it, just use
i2c-algo-bit in your driver. It'll even export the right
functionalities for you (check drivers/i2c/algos/i2c-algo-bit.c to find
out which; it does indeed include I2C_FUNC_SMBUS_EMUL)
You can safely ignore 10-bit devices, we've never seen any.
> With this set, my device works fine:
>
> titan:/home/harbaum/tmp/lm_sensors-2.10.1 # sensors
> ds1621-i2c-2-48
> Adapter: i2c-tiny-usb at bus 004 device 005
> temp: +20.50°C (low = +15.0°C, high = +10.0°C) ALARM (HIGH)
Nice :)
--
Jean Delvare
More information about the i2c
mailing list