diff options
Diffstat (limited to 'include/linux/i2c.h')
| -rw-r--r-- | include/linux/i2c.h | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 5e19a7ba69b2..7863a59bd598 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -105,14 +105,14 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, | |||
| 105 | * A driver is capable of handling one or more physical devices present on | 105 | * A driver is capable of handling one or more physical devices present on |
| 106 | * I2C adapters. This information is used to inform the driver of adapter | 106 | * I2C adapters. This information is used to inform the driver of adapter |
| 107 | * events. | 107 | * events. |
| 108 | * | ||
| 109 | * The driver.owner field should be set to the module owner of this driver. | ||
| 110 | * The driver.name field should be set to the name of this driver. | ||
| 108 | */ | 111 | */ |
| 109 | 112 | ||
| 110 | struct i2c_driver { | 113 | struct i2c_driver { |
| 111 | struct module *owner; | ||
| 112 | char name[32]; | ||
| 113 | int id; | 114 | int id; |
| 114 | unsigned int class; | 115 | unsigned int class; |
| 115 | unsigned int flags; /* div., see below */ | ||
| 116 | 116 | ||
| 117 | /* Notifies the driver that a new bus has appeared. This routine | 117 | /* Notifies the driver that a new bus has appeared. This routine |
| 118 | * can be used by the driver to test if the bus meets its conditions | 118 | * can be used by the driver to test if the bus meets its conditions |
| @@ -250,18 +250,7 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) | |||
| 250 | dev_set_drvdata (&dev->dev, data); | 250 | dev_set_drvdata (&dev->dev, data); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | /*flags for the driver struct: */ | ||
| 254 | #define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */ | ||
| 255 | #if 0 | ||
| 256 | /* this flag is gone -- there is a (optional) driver->detach_adapter | ||
| 257 | * callback now which can be used instead */ | ||
| 258 | # define I2C_DF_DUMMY 0x02 | ||
| 259 | #endif | ||
| 260 | |||
| 261 | /*flags for the client struct: */ | 253 | /*flags for the client struct: */ |
| 262 | #define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */ | ||
| 263 | #define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */ | ||
| 264 | /* on an i2c_client */ | ||
| 265 | #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ | 254 | #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ |
| 266 | #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ | 255 | #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ |
| 267 | /* Must equal I2C_M_TEN below */ | 256 | /* Must equal I2C_M_TEN below */ |
| @@ -302,26 +291,20 @@ struct i2c_client_address_data { | |||
| 302 | extern int i2c_add_adapter(struct i2c_adapter *); | 291 | extern int i2c_add_adapter(struct i2c_adapter *); |
| 303 | extern int i2c_del_adapter(struct i2c_adapter *); | 292 | extern int i2c_del_adapter(struct i2c_adapter *); |
| 304 | 293 | ||
| 305 | extern int i2c_add_driver(struct i2c_driver *); | 294 | extern int i2c_register_driver(struct module *, struct i2c_driver *); |
| 306 | extern int i2c_del_driver(struct i2c_driver *); | 295 | extern int i2c_del_driver(struct i2c_driver *); |
| 307 | 296 | ||
| 297 | static inline int i2c_add_driver(struct i2c_driver *driver) | ||
| 298 | { | ||
| 299 | return i2c_register_driver(THIS_MODULE, driver); | ||
| 300 | } | ||
| 301 | |||
| 308 | extern int i2c_attach_client(struct i2c_client *); | 302 | extern int i2c_attach_client(struct i2c_client *); |
| 309 | extern int i2c_detach_client(struct i2c_client *); | 303 | extern int i2c_detach_client(struct i2c_client *); |
| 310 | 304 | ||
| 311 | /* New function: This is to get an i2c_client-struct for controlling the | 305 | /* Should be used to make sure that client-struct is valid and that it |
| 312 | client either by using i2c_control-function or having the | 306 | is okay to access the i2c-client. |
| 313 | client-module export functions that can be used with the i2c_client | 307 | returns -ENODEV if client has gone in the meantime */ |
| 314 | -struct. */ | ||
| 315 | extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id, | ||
| 316 | struct i2c_client *prev); | ||
| 317 | |||
| 318 | /* Should be used with new function | ||
| 319 | extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *); | ||
| 320 | to make sure that client-struct is valid and that it is okay to access | ||
| 321 | the i2c-client. | ||
| 322 | returns -EACCES if client doesn't allow use (default) | ||
| 323 | returns -EBUSY if client doesn't allow multiple use (default) and | ||
| 324 | usage_count >0 */ | ||
| 325 | extern int i2c_use_client(struct i2c_client *); | 308 | extern int i2c_use_client(struct i2c_client *); |
| 326 | extern int i2c_release_client(struct i2c_client *); | 309 | extern int i2c_release_client(struct i2c_client *); |
| 327 | 310 | ||
