[i2c] Documentation/i2c/dev-interface
Jean Delvare
khali at linux-fr.org
Tue Sep 11 09:59:45 CEST 2007
Hi David,
On 9/10/2007, "David Brownell" <david-b at pacbell.net> wrote:
>The $SUBJECT document says:
>
>> You can do SMBus level transactions (see documentation file smbus-protocol
>> for details) through the following functions:
>> __s32 i2c_smbus_write_quick(int file, __u8 value);
>> __s32 i2c_smbus_read_byte(int file);
>> __s32 i2c_smbus_write_byte(int file, __u8 value);
>> __s32 i2c_smbus_read_byte_data(int file, __u8 command);
>> __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value);
>> __s32 i2c_smbus_read_word_data(int file, __u8 command);
>> __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value);
>> __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value);
>> __s32 i2c_smbus_read_block_data(int file, __u8 command, __u8 *values);
>> __s32 i2c_smbus_write_block_data(int file, __u8 command, __u8 length,
>> __u8 *values);
>
>
>Where are those defined? Such functions don't seem to exist
>in in a library on any of my Linux distros.
These are inline functions defined in i2c-dev.h. This header file (which
is different from the one in the kernel tree) is currently distributed
with the lm-sensors package, for historical reasons. This is explained
at the beginning of $SUBJECT.
Soon we'll have a dedicated i2c-tools package and that header file will
be part of it:
http://www.lm-sensors.org/browser/i2c-tools/trunk/include/linux/i2c-dev.h
As a side note, these functions would probably be better provided as a
static library, as some of them are a bit too large to be inlined IMHO.
But this is not my priority at the moment.
It can be argued that the rest of the file should be generated or
extracted from the i2c kernel headers themselves, now that we have a
clean way to do this.
>I get the impression that part of the text is very old. Last
>updated mid-2005, and maybe that part dates from some old 2.4
>stuff that's no longer relevant.
Well the part you quoted is up-to-date as far as I can see, except for
missing functions.
>Also, a clear omission is the SMBus "block write-block read
>process call" primitive...
Most probably because nobody uses it ;) I2C block read and write
functions are missing as well. Care to submit a patch?
Thanks,
--
Jean Delvare
More information about the i2c
mailing list