diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/i2c.h | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r-- | include/linux/i2c.h | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 4bae0b72ed3c..a6c652ef516d 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #ifdef __KERNEL__ | 30 | #ifdef __KERNEL__ |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/i2c-id.h> | ||
33 | #include <linux/mod_devicetable.h> | 32 | #include <linux/mod_devicetable.h> |
34 | #include <linux/device.h> /* for struct device */ | 33 | #include <linux/device.h> /* for struct device */ |
35 | #include <linux/sched.h> /* for completion */ | 34 | #include <linux/sched.h> /* for completion */ |
@@ -57,9 +56,10 @@ struct i2c_board_info; | |||
57 | * transmit an arbitrary number of messages without interruption. | 56 | * transmit an arbitrary number of messages without interruption. |
58 | * @count must be be less than 64k since msg.len is u16. | 57 | * @count must be be less than 64k since msg.len is u16. |
59 | */ | 58 | */ |
60 | extern int i2c_master_send(struct i2c_client *client, const char *buf, | 59 | extern int i2c_master_send(const struct i2c_client *client, const char *buf, |
60 | int count); | ||
61 | extern int i2c_master_recv(const struct i2c_client *client, char *buf, | ||
61 | int count); | 62 | int count); |
62 | extern int i2c_master_recv(struct i2c_client *client, char *buf, int count); | ||
63 | 63 | ||
64 | /* Transfer num messages. | 64 | /* Transfer num messages. |
65 | */ | 65 | */ |
@@ -78,23 +78,25 @@ extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | |||
78 | /* Now follow the 'nice' access routines. These also document the calling | 78 | /* Now follow the 'nice' access routines. These also document the calling |
79 | conventions of i2c_smbus_xfer. */ | 79 | conventions of i2c_smbus_xfer. */ |
80 | 80 | ||
81 | extern s32 i2c_smbus_read_byte(struct i2c_client *client); | 81 | extern s32 i2c_smbus_read_byte(const struct i2c_client *client); |
82 | extern s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value); | 82 | extern s32 i2c_smbus_write_byte(const struct i2c_client *client, u8 value); |
83 | extern s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command); | 83 | extern s32 i2c_smbus_read_byte_data(const struct i2c_client *client, |
84 | extern s32 i2c_smbus_write_byte_data(struct i2c_client *client, | 84 | u8 command); |
85 | extern s32 i2c_smbus_write_byte_data(const struct i2c_client *client, | ||
85 | u8 command, u8 value); | 86 | u8 command, u8 value); |
86 | extern s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command); | 87 | extern s32 i2c_smbus_read_word_data(const struct i2c_client *client, |
87 | extern s32 i2c_smbus_write_word_data(struct i2c_client *client, | 88 | u8 command); |
89 | extern s32 i2c_smbus_write_word_data(const struct i2c_client *client, | ||
88 | u8 command, u16 value); | 90 | u8 command, u16 value); |
89 | /* Returns the number of read bytes */ | 91 | /* Returns the number of read bytes */ |
90 | extern s32 i2c_smbus_read_block_data(struct i2c_client *client, | 92 | extern s32 i2c_smbus_read_block_data(const struct i2c_client *client, |
91 | u8 command, u8 *values); | 93 | u8 command, u8 *values); |
92 | extern s32 i2c_smbus_write_block_data(struct i2c_client *client, | 94 | extern s32 i2c_smbus_write_block_data(const struct i2c_client *client, |
93 | u8 command, u8 length, const u8 *values); | 95 | u8 command, u8 length, const u8 *values); |
94 | /* Returns the number of read bytes */ | 96 | /* Returns the number of read bytes */ |
95 | extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, | 97 | extern s32 i2c_smbus_read_i2c_block_data(const struct i2c_client *client, |
96 | u8 command, u8 length, u8 *values); | 98 | u8 command, u8 length, u8 *values); |
97 | extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, | 99 | extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client, |
98 | u8 command, u8 length, | 100 | u8 command, u8 length, |
99 | const u8 *values); | 101 | const u8 *values); |
100 | #endif /* I2C */ | 102 | #endif /* I2C */ |
@@ -102,8 +104,8 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, | |||
102 | /** | 104 | /** |
103 | * struct i2c_driver - represent an I2C device driver | 105 | * struct i2c_driver - represent an I2C device driver |
104 | * @class: What kind of i2c device we instantiate (for detect) | 106 | * @class: What kind of i2c device we instantiate (for detect) |
105 | * @attach_adapter: Callback for bus addition (for legacy drivers) | 107 | * @attach_adapter: Callback for bus addition (deprecated) |
106 | * @detach_adapter: Callback for bus removal (for legacy drivers) | 108 | * @detach_adapter: Callback for bus removal (deprecated) |
107 | * @probe: Callback for device binding | 109 | * @probe: Callback for device binding |
108 | * @remove: Callback for device unbinding | 110 | * @remove: Callback for device unbinding |
109 | * @shutdown: Callback for device shutdown | 111 | * @shutdown: Callback for device shutdown |
@@ -141,11 +143,11 @@ struct i2c_driver { | |||
141 | unsigned int class; | 143 | unsigned int class; |
142 | 144 | ||
143 | /* Notifies the driver that a new bus has appeared or is about to be | 145 | /* Notifies the driver that a new bus has appeared or is about to be |
144 | * removed. You should avoid using this if you can, it will probably | 146 | * removed. You should avoid using this, it will be removed in a |
145 | * be removed in a near future. | 147 | * near future. |
146 | */ | 148 | */ |
147 | int (*attach_adapter)(struct i2c_adapter *); | 149 | int (*attach_adapter)(struct i2c_adapter *) __deprecated; |
148 | int (*detach_adapter)(struct i2c_adapter *); | 150 | int (*detach_adapter)(struct i2c_adapter *) __deprecated; |
149 | 151 | ||
150 | /* Standard driver model interfaces */ | 152 | /* Standard driver model interfaces */ |
151 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); | 153 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); |
@@ -255,9 +257,7 @@ struct i2c_board_info { | |||
255 | unsigned short addr; | 257 | unsigned short addr; |
256 | void *platform_data; | 258 | void *platform_data; |
257 | struct dev_archdata *archdata; | 259 | struct dev_archdata *archdata; |
258 | #ifdef CONFIG_OF | ||
259 | struct device_node *of_node; | 260 | struct device_node *of_node; |
260 | #endif | ||
261 | int irq; | 261 | int irq; |
262 | }; | 262 | }; |
263 | 263 | ||
@@ -353,7 +353,6 @@ struct i2c_algorithm { | |||
353 | */ | 353 | */ |
354 | struct i2c_adapter { | 354 | struct i2c_adapter { |
355 | struct module *owner; | 355 | struct module *owner; |
356 | unsigned int id; | ||
357 | unsigned int class; /* classes to allow probing for */ | 356 | unsigned int class; /* classes to allow probing for */ |
358 | const struct i2c_algorithm *algo; /* the algorithm to access the bus */ | 357 | const struct i2c_algorithm *algo; /* the algorithm to access the bus */ |
359 | void *algo_data; | 358 | void *algo_data; |
@@ -384,13 +383,19 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) | |||
384 | dev_set_drvdata(&dev->dev, data); | 383 | dev_set_drvdata(&dev->dev, data); |
385 | } | 384 | } |
386 | 385 | ||
387 | static inline int i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) | 386 | static inline struct i2c_adapter * |
387 | i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) | ||
388 | { | 388 | { |
389 | return adapter->dev.parent != NULL | 389 | struct device *parent = adapter->dev.parent; |
390 | && adapter->dev.parent->bus == &i2c_bus_type | 390 | |
391 | && adapter->dev.parent->type == &i2c_adapter_type; | 391 | if (parent != NULL && parent->type == &i2c_adapter_type) |
392 | return to_i2c_adapter(parent); | ||
393 | else | ||
394 | return NULL; | ||
392 | } | 395 | } |
393 | 396 | ||
397 | int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *)); | ||
398 | |||
394 | /* Adapter locking functions, exported for shared pin cases */ | 399 | /* Adapter locking functions, exported for shared pin cases */ |
395 | void i2c_lock_adapter(struct i2c_adapter *); | 400 | void i2c_lock_adapter(struct i2c_adapter *); |
396 | void i2c_unlock_adapter(struct i2c_adapter *); | 401 | void i2c_unlock_adapter(struct i2c_adapter *); |
@@ -403,10 +408,8 @@ void i2c_unlock_adapter(struct i2c_adapter *); | |||
403 | 408 | ||
404 | /* i2c adapter classes (bitmask) */ | 409 | /* i2c adapter classes (bitmask) */ |
405 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ | 410 | #define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ |
406 | #define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ | ||
407 | #define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ | ||
408 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ | 411 | #define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ |
409 | #define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ | 412 | #define I2C_CLASS_SPD (1<<7) /* Memory modules */ |
410 | 413 | ||
411 | /* Internal numbers to terminate lists */ | 414 | /* Internal numbers to terminate lists */ |
412 | #define I2C_CLIENT_END 0xfffeU | 415 | #define I2C_CLIENT_END 0xfffeU |
@@ -444,7 +447,7 @@ extern void i2c_release_client(struct i2c_client *client); | |||
444 | extern void i2c_clients_command(struct i2c_adapter *adap, | 447 | extern void i2c_clients_command(struct i2c_adapter *adap, |
445 | unsigned int cmd, void *arg); | 448 | unsigned int cmd, void *arg); |
446 | 449 | ||
447 | extern struct i2c_adapter *i2c_get_adapter(int id); | 450 | extern struct i2c_adapter *i2c_get_adapter(int nr); |
448 | extern void i2c_put_adapter(struct i2c_adapter *adap); | 451 | extern void i2c_put_adapter(struct i2c_adapter *adap); |
449 | 452 | ||
450 | 453 | ||