diff options
Diffstat (limited to 'include/linux/i2c.h')
| -rw-r--r-- | include/linux/i2c.h | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 254cd34eeae2..b79387fd57da 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
| @@ -140,9 +140,14 @@ extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, | |||
| 140 | and probably just as fast. | 140 | and probably just as fast. |
| 141 | Note that we use i2c_adapter here, because you do not need a specific | 141 | Note that we use i2c_adapter here, because you do not need a specific |
| 142 | smbus adapter to call this function. */ | 142 | smbus adapter to call this function. */ |
| 143 | extern s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | 143 | s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, |
| 144 | unsigned short flags, char read_write, u8 command, | 144 | unsigned short flags, char read_write, u8 command, |
| 145 | int size, union i2c_smbus_data *data); | 145 | int protocol, union i2c_smbus_data *data); |
| 146 | |||
| 147 | /* Unlocked flavor */ | ||
| 148 | s32 __i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | ||
| 149 | unsigned short flags, char read_write, u8 command, | ||
| 150 | int protocol, union i2c_smbus_data *data); | ||
| 146 | 151 | ||
| 147 | /* Now follow the 'nice' access routines. These also document the calling | 152 | /* Now follow the 'nice' access routines. These also document the calling |
| 148 | conventions of i2c_smbus_xfer. */ | 153 | conventions of i2c_smbus_xfer. */ |
| @@ -226,7 +231,6 @@ enum i2c_alert_protocol { | |||
| 226 | /** | 231 | /** |
| 227 | * struct i2c_driver - represent an I2C device driver | 232 | * struct i2c_driver - represent an I2C device driver |
| 228 | * @class: What kind of i2c device we instantiate (for detect) | 233 | * @class: What kind of i2c device we instantiate (for detect) |
| 229 | * @attach_adapter: Callback for bus addition (deprecated) | ||
| 230 | * @probe: Callback for device binding - soon to be deprecated | 234 | * @probe: Callback for device binding - soon to be deprecated |
| 231 | * @probe_new: New callback for device binding | 235 | * @probe_new: New callback for device binding |
| 232 | * @remove: Callback for device unbinding | 236 | * @remove: Callback for device unbinding |
| @@ -263,11 +267,6 @@ enum i2c_alert_protocol { | |||
| 263 | struct i2c_driver { | 267 | struct i2c_driver { |
| 264 | unsigned int class; | 268 | unsigned int class; |
| 265 | 269 | ||
| 266 | /* Notifies the driver that a new bus has appeared. You should avoid | ||
| 267 | * using this, it will be removed in a near future. | ||
| 268 | */ | ||
| 269 | int (*attach_adapter)(struct i2c_adapter *) __deprecated; | ||
| 270 | |||
| 271 | /* Standard driver model interfaces */ | 270 | /* Standard driver model interfaces */ |
| 272 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); | 271 | int (*probe)(struct i2c_client *, const struct i2c_device_id *); |
| 273 | int (*remove)(struct i2c_client *); | 272 | int (*remove)(struct i2c_client *); |
| @@ -559,6 +558,7 @@ struct i2c_lock_operations { | |||
| 559 | * @scl_fall_ns: time SCL signal takes to fall in ns; t(f) in the I2C specification | 558 | * @scl_fall_ns: time SCL signal takes to fall in ns; t(f) in the I2C specification |
| 560 | * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns | 559 | * @scl_int_delay_ns: time IP core additionally needs to setup SCL in ns |
| 561 | * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification | 560 | * @sda_fall_ns: time SDA signal takes to fall in ns; t(f) in the I2C specification |
| 561 | * @sda_hold_ns: time IP core additionally needs to hold SDA in ns | ||
| 562 | */ | 562 | */ |
| 563 | struct i2c_timings { | 563 | struct i2c_timings { |
| 564 | u32 bus_freq_hz; | 564 | u32 bus_freq_hz; |
| @@ -566,6 +566,7 @@ struct i2c_timings { | |||
| 566 | u32 scl_fall_ns; | 566 | u32 scl_fall_ns; |
| 567 | u32 scl_int_delay_ns; | 567 | u32 scl_int_delay_ns; |
| 568 | u32 sda_fall_ns; | 568 | u32 sda_fall_ns; |
| 569 | u32 sda_hold_ns; | ||
| 569 | }; | 570 | }; |
| 570 | 571 | ||
| 571 | /** | 572 | /** |
| @@ -576,12 +577,14 @@ struct i2c_timings { | |||
| 576 | * recovery. Populated internally for generic GPIO recovery. | 577 | * recovery. Populated internally for generic GPIO recovery. |
| 577 | * @set_scl: This sets/clears the SCL line. Mandatory for generic SCL recovery. | 578 | * @set_scl: This sets/clears the SCL line. Mandatory for generic SCL recovery. |
| 578 | * Populated internally for generic GPIO recovery. | 579 | * Populated internally for generic GPIO recovery. |
| 579 | * @get_sda: This gets current value of SDA line. Optional for generic SCL | 580 | * @get_sda: This gets current value of SDA line. This or set_sda() is mandatory |
| 580 | * recovery. Populated internally, if sda_gpio is a valid GPIO, for generic | 581 | * for generic SCL recovery. Populated internally, if sda_gpio is a valid |
| 581 | * GPIO recovery. | 582 | * GPIO, for generic GPIO recovery. |
| 582 | * @set_sda: This sets/clears the SDA line. Optional for generic SCL recovery. | 583 | * @set_sda: This sets/clears the SDA line. This or get_sda() is mandatory for |
| 583 | * Populated internally, if sda_gpio is a valid GPIO, for generic GPIO | 584 | * generic SCL recovery. Populated internally, if sda_gpio is a valid GPIO, |
| 584 | * recovery. | 585 | * for generic GPIO recovery. |
| 586 | * @get_bus_free: Returns the bus free state as seen from the IP core in case it | ||
| 587 | * has a more complex internal logic than just reading SDA. Optional. | ||
| 585 | * @prepare_recovery: This will be called before starting recovery. Platform may | 588 | * @prepare_recovery: This will be called before starting recovery. Platform may |
| 586 | * configure padmux here for SDA/SCL line or something else they want. | 589 | * configure padmux here for SDA/SCL line or something else they want. |
| 587 | * @unprepare_recovery: This will be called after completing recovery. Platform | 590 | * @unprepare_recovery: This will be called after completing recovery. Platform |
| @@ -596,6 +599,7 @@ struct i2c_bus_recovery_info { | |||
| 596 | void (*set_scl)(struct i2c_adapter *adap, int val); | 599 | void (*set_scl)(struct i2c_adapter *adap, int val); |
| 597 | int (*get_sda)(struct i2c_adapter *adap); | 600 | int (*get_sda)(struct i2c_adapter *adap); |
| 598 | void (*set_sda)(struct i2c_adapter *adap, int val); | 601 | void (*set_sda)(struct i2c_adapter *adap, int val); |
| 602 | int (*get_bus_free)(struct i2c_adapter *adap); | ||
| 599 | 603 | ||
| 600 | void (*prepare_recovery)(struct i2c_adapter *adap); | 604 | void (*prepare_recovery)(struct i2c_adapter *adap); |
| 601 | void (*unprepare_recovery)(struct i2c_adapter *adap); | 605 | void (*unprepare_recovery)(struct i2c_adapter *adap); |
| @@ -653,6 +657,10 @@ struct i2c_adapter_quirks { | |||
| 653 | I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR) | 657 | I2C_AQ_COMB_READ_SECOND | I2C_AQ_COMB_SAME_ADDR) |
| 654 | /* clock stretching is not supported */ | 658 | /* clock stretching is not supported */ |
| 655 | #define I2C_AQ_NO_CLK_STRETCH BIT(4) | 659 | #define I2C_AQ_NO_CLK_STRETCH BIT(4) |
| 660 | /* message cannot have length of 0 */ | ||
| 661 | #define I2C_AQ_NO_ZERO_LEN_READ BIT(5) | ||
| 662 | #define I2C_AQ_NO_ZERO_LEN_WRITE BIT(6) | ||
| 663 | #define I2C_AQ_NO_ZERO_LEN (I2C_AQ_NO_ZERO_LEN_READ | I2C_AQ_NO_ZERO_LEN_WRITE) | ||
| 656 | 664 | ||
| 657 | /* | 665 | /* |
| 658 | * i2c_adapter is the structure used to identify a physical i2c bus along | 666 | * i2c_adapter is the structure used to identify a physical i2c bus along |
| @@ -754,18 +762,6 @@ i2c_unlock_bus(struct i2c_adapter *adapter, unsigned int flags) | |||
| 754 | adapter->lock_ops->unlock_bus(adapter, flags); | 762 | adapter->lock_ops->unlock_bus(adapter, flags); |
| 755 | } | 763 | } |
| 756 | 764 | ||
| 757 | static inline void | ||
| 758 | i2c_lock_adapter(struct i2c_adapter *adapter) | ||
| 759 | { | ||
| 760 | i2c_lock_bus(adapter, I2C_LOCK_ROOT_ADAPTER); | ||
| 761 | } | ||
| 762 | |||
| 763 | static inline void | ||
| 764 | i2c_unlock_adapter(struct i2c_adapter *adapter) | ||
| 765 | { | ||
| 766 | i2c_unlock_bus(adapter, I2C_LOCK_ROOT_ADAPTER); | ||
| 767 | } | ||
| 768 | |||
| 769 | /*flags for the client struct: */ | 765 | /*flags for the client struct: */ |
| 770 | #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ | 766 | #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ |
| 771 | #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ | 767 | #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ |
