[i2c] the class field of i2c adapters
Mike Frysinger
vapier.adi at gmail.com
Mon Feb 5 23:50:57 CET 2007
so i understand the adapter functionality field and the checks an i2c
client has in its probe function to make sure the adapter its hooked
up to supports all of its required functionality, but i cant seem to
find any documentation on the adapter class i2c field ...
my guess is that it is filled in for adapters which are hard wired in
a final product and are never used for any other purpose ? so if you
have an I2C adapter that sits on like a motherboard and it only has
hardware sensors hooked up to it, you would set its class to
I2C_CLASS_HWMON ? and if you have a generic I2C adapter that can hook
up to anything you would use I2C_CLASS_ALL (aka I2C on the cpu itself)
?
struct i2c_adapter {
...
unsigned int class;
...
};
/* i2c adapter classes (bitmask) */
#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
#define I2C_CLASS_DDC (1<<3) /* i2c-matroxfb ? */
#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
#define I2C_CLASS_SOUND (1<<6) /* sound devices */
#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
a lot of i2c clients actually check this field in the driver-specific
attach_adapter function ... like here:
w83791d.c-static int w83791d_attach_adapter(struct i2c_adapter *adapter)
w83791d.c-{
w83791d.c: if (!(adapter->class & I2C_CLASS_HWMON))
w83791d.c- return 0;
w83791d.c- return i2c_probe(adapter, &addr_data, w83791d_detect);
w83791d.c-}
-mike
More information about the i2c
mailing list