include/linux/i2c.h
changeset 2 d1f6d8b6f81c
parent 0 aa628870c1d3
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
   149 	/* tells the driver that a client is about to be deleted & gives it
   149 	/* tells the driver that a client is about to be deleted & gives it
   150 	 * the chance to remove its private data. Also, if the client struct
   150 	 * the chance to remove its private data. Also, if the client struct
   151 	 * has been dynamically allocated by the driver in the function above,
   151 	 * has been dynamically allocated by the driver in the function above,
   152 	 * it must be freed here.  (LEGACY I2C DRIVERS ONLY)
   152 	 * it must be freed here.  (LEGACY I2C DRIVERS ONLY)
   153 	 */
   153 	 */
   154 	int (*detach_client)(struct i2c_client *);
   154 	int (*detach_client)(struct i2c_client *) __deprecated;
   155 
   155 
   156 	/* Standard driver model interfaces, for "new style" i2c drivers.
   156 	/* Standard driver model interfaces, for "new style" i2c drivers.
   157 	 * With the driver model, device enumeration is NEVER done by drivers;
   157 	 * With the driver model, device enumeration is NEVER done by drivers;
   158 	 * it's done by infrastructure.  (NEW STYLE DRIVERS ONLY)
   158 	 * it's done by infrastructure.  (NEW STYLE DRIVERS ONLY)
   159 	 */
   159 	 */
   359 	/* data fields that are valid for all devices	*/
   359 	/* data fields that are valid for all devices	*/
   360 	u8 level; 			/* nesting level for lockdep */
   360 	u8 level; 			/* nesting level for lockdep */
   361 	struct mutex bus_lock;
   361 	struct mutex bus_lock;
   362 	struct mutex clist_lock;
   362 	struct mutex clist_lock;
   363 
   363 
   364 	int timeout;
   364 	int timeout;			/* in jiffies */
   365 	int retries;
   365 	int retries;
   366 	struct device dev;		/* the adapter device */
   366 	struct device dev;		/* the adapter device */
   367 
   367 
   368 	int nr;
   368 	int nr;
   369 	struct list_head clients;	/* DEPRECATED */
   369 	struct list_head clients;	/* DEPRECATED */
   391 /* i2c adapter classes (bitmask) */
   391 /* i2c adapter classes (bitmask) */
   392 #define I2C_CLASS_HWMON		(1<<0)	/* lm_sensors, ... */
   392 #define I2C_CLASS_HWMON		(1<<0)	/* lm_sensors, ... */
   393 #define I2C_CLASS_TV_ANALOG	(1<<1)	/* bttv + friends */
   393 #define I2C_CLASS_TV_ANALOG	(1<<1)	/* bttv + friends */
   394 #define I2C_CLASS_TV_DIGITAL	(1<<2)	/* dvb cards */
   394 #define I2C_CLASS_TV_DIGITAL	(1<<2)	/* dvb cards */
   395 #define I2C_CLASS_DDC		(1<<3)	/* DDC bus on graphics adapters */
   395 #define I2C_CLASS_DDC		(1<<3)	/* DDC bus on graphics adapters */
   396 #define I2C_CLASS_CAM_ANALOG	(1<<4)	/* camera with analog CCD */
       
   397 #define I2C_CLASS_CAM_DIGITAL	(1<<5)	/* most webcams */
       
   398 #define I2C_CLASS_SOUND		(1<<6)	/* sound devices */
       
   399 #define I2C_CLASS_SPD		(1<<7)	/* SPD EEPROMs and similar */
   396 #define I2C_CLASS_SPD		(1<<7)	/* SPD EEPROMs and similar */
   400 #define I2C_CLASS_ALL		(UINT_MAX) /* all of the above */
       
   401 
   397 
   402 /* i2c_client_address_data is the struct for holding default client
   398 /* i2c_client_address_data is the struct for holding default client
   403  * addresses for a driver and for the parameters supplied on the
   399  * addresses for a driver and for the parameters supplied on the
   404  * command line
   400  * command line
   405  */
   401  */
   431 static inline int i2c_add_driver(struct i2c_driver *driver)
   427 static inline int i2c_add_driver(struct i2c_driver *driver)
   432 {
   428 {
   433 	return i2c_register_driver(THIS_MODULE, driver);
   429 	return i2c_register_driver(THIS_MODULE, driver);
   434 }
   430 }
   435 
   431 
   436 extern int i2c_attach_client(struct i2c_client *);
   432 /* These are deprecated, your driver should use the standard .probe()
   437 extern int i2c_detach_client(struct i2c_client *);
   433  * and .remove() methods instead. */
       
   434 extern int __deprecated i2c_attach_client(struct i2c_client *);
       
   435 extern int __deprecated i2c_detach_client(struct i2c_client *);
   438 
   436 
   439 extern struct i2c_client *i2c_use_client(struct i2c_client *client);
   437 extern struct i2c_client *i2c_use_client(struct i2c_client *client);
   440 extern void i2c_release_client(struct i2c_client *client);
   438 extern void i2c_release_client(struct i2c_client *client);
   441 
   439 
   442 /* call the i2c_client->command() of all attached clients with
   440 /* call the i2c_client->command() of all attached clients with