aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r--include/linux/i2c.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index cae7d618030c..0c37a737a2b2 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -90,7 +90,7 @@ extern s32 i2c_smbus_write_block_data(struct i2c_client * client,
90 const u8 *values); 90 const u8 *values);
91/* Returns the number of read bytes */ 91/* Returns the number of read bytes */
92extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, 92extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client,
93 u8 command, u8 *values); 93 u8 command, u8 length, u8 *values);
94extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client, 94extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
95 u8 command, u8 length, 95 u8 command, u8 length,
96 const u8 *values); 96 const u8 *values);
@@ -150,15 +150,20 @@ struct i2c_driver {
150 150
151/** 151/**
152 * struct i2c_client - represent an I2C slave device 152 * struct i2c_client - represent an I2C slave device
153 * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address;
154 * I2C_CLIENT_PEC indicates it uses SMBus Packet Error Checking
153 * @addr: Address used on the I2C bus connected to the parent adapter. 155 * @addr: Address used on the I2C bus connected to the parent adapter.
154 * @name: Indicates the type of the device, usually a chip name that's 156 * @name: Indicates the type of the device, usually a chip name that's
155 * generic enough to hide second-sourcing and compatible revisions. 157 * generic enough to hide second-sourcing and compatible revisions.
158 * @adapter: manages the bus segment hosting this I2C device
156 * @dev: Driver model device node for the slave. 159 * @dev: Driver model device node for the slave.
160 * @irq: indicates the IRQ generated by this device (if any)
157 * @driver_name: Identifies new-style driver used with this device; also 161 * @driver_name: Identifies new-style driver used with this device; also
158 * used as the module name for hotplug/coldplug modprobe support. 162 * used as the module name for hotplug/coldplug modprobe support.
159 * 163 *
160 * An i2c_client identifies a single device (i.e. chip) connected to an 164 * An i2c_client identifies a single device (i.e. chip) connected to an
161 * i2c bus. The behaviour is defined by the routines of the driver. 165 * i2c bus. The behaviour exposed to Linux is defined by the driver
166 * managing the device.
162 */ 167 */
163struct i2c_client { 168struct i2c_client {
164 unsigned short flags; /* div., see below */ 169 unsigned short flags; /* div., see below */
@@ -180,7 +185,8 @@ struct i2c_client {
180 185
181static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) 186static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
182{ 187{
183 return to_i2c_client(container_of(kobj, struct device, kobj)); 188 struct device * const dev = container_of(kobj, struct device, kobj);
189 return to_i2c_client(dev);
184} 190}
185 191
186static inline void *i2c_get_clientdata (struct i2c_client *dev) 192static inline void *i2c_get_clientdata (struct i2c_client *dev)
@@ -201,7 +207,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
201 * @addr: stored in i2c_client.addr 207 * @addr: stored in i2c_client.addr
202 * @platform_data: stored in i2c_client.dev.platform_data 208 * @platform_data: stored in i2c_client.dev.platform_data
203 * @irq: stored in i2c_client.irq 209 * @irq: stored in i2c_client.irq
204 210 *
205 * I2C doesn't actually support hardware probing, although controllers and 211 * I2C doesn't actually support hardware probing, although controllers and
206 * devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's 212 * devices may be able to use I2C_SMBUS_QUICK to tell whether or not there's
207 * a device at a given address. Drivers commonly need more information than 213 * a device at a given address. Drivers commonly need more information than
@@ -210,7 +216,7 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data)
210 * i2c_board_info is used to build tables of information listing I2C devices 216 * i2c_board_info is used to build tables of information listing I2C devices
211 * that are present. This information is used to grow the driver model tree 217 * that are present. This information is used to grow the driver model tree
212 * for "new style" I2C drivers. For mainboards this is done statically using 218 * for "new style" I2C drivers. For mainboards this is done statically using
213 * i2c_register_board_info(), where @bus_num represents an adapter that isn't 219 * i2c_register_board_info(); bus numbers identify adapters that aren't
214 * yet available. For add-on boards, i2c_new_device() does this dynamically 220 * yet available. For add-on boards, i2c_new_device() does this dynamically
215 * with the adapter already known. 221 * with the adapter already known.
216 */ 222 */
@@ -362,7 +368,6 @@ struct i2c_client_address_data {
362 368
363/* The numbers to use to set I2C bus address */ 369/* The numbers to use to set I2C bus address */
364#define ANY_I2C_BUS 0xffff 370#define ANY_I2C_BUS 0xffff
365#define ANY_I2C_ISA_BUS 9191
366 371
367 372
368/* ----- functions exported by i2c.o */ 373/* ----- functions exported by i2c.o */
@@ -518,8 +523,9 @@ union i2c_smbus_data {
518#define I2C_SMBUS_WORD_DATA 3 523#define I2C_SMBUS_WORD_DATA 3
519#define I2C_SMBUS_PROC_CALL 4 524#define I2C_SMBUS_PROC_CALL 4
520#define I2C_SMBUS_BLOCK_DATA 5 525#define I2C_SMBUS_BLOCK_DATA 5
521#define I2C_SMBUS_I2C_BLOCK_DATA 6 526#define I2C_SMBUS_I2C_BLOCK_BROKEN 6
522#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */ 527#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
528#define I2C_SMBUS_I2C_BLOCK_DATA 8
523 529
524 530
525/* ----- commands for the ioctl like i2c_command call: 531/* ----- commands for the ioctl like i2c_command call: