diff options
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r-- | include/linux/i2c.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index a670ae129f4b..0d996b722b75 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -19,6 +19,7 @@ #include <linux/irqdomain.h> /* for Host Notify IRQ */ #include <linux/of.h> /* for struct device_node */ #include <linux/swab.h> /* for swab16 */ +#include <linux/workqueue.h> #include <uapi/linux/i2c.h> extern struct bus_type i2c_bus_type; @@ -366,6 +367,7 @@ enum i2c_slave_event { I2C_SLAVE_WRITE_REQUESTED, I2C_SLAVE_READ_PROCESSED, I2C_SLAVE_WRITE_RECEIVED, + I2C_SLAVE_GCALL_REQUESTED, I2C_SLAVE_STOP, }; @@ -723,6 +725,13 @@ struct i2c_adapter { const struct i2c_adapter_quirks *quirks; struct irq_domain *host_notify_domain; + + /* + * These will be used by root adpaters only. For muxes, each mux core + * has these individually. + */ + struct mutex hold_lock; /* mutex for bus holding */ + struct delayed_work unhold_work; }; #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) @@ -1019,4 +1028,22 @@ static inline struct i2c_adapter *i2c_acpi_find_adapter_by_handle(acpi_handle ha } #endif /* CONFIG_ACPI */ +enum i2c_hold_msg_type { + I2C_HOLD_MSG_NONE, + I2C_HOLD_MSG_SET, + I2C_HOLD_MSG_RESET +}; + +static inline enum i2c_hold_msg_type i2c_check_hold_msg(u16 flags, u16 len, u16 *buf) +{ + if (flags & I2C_M_HOLD && len == sizeof(u16)) { + if (*buf) + return I2C_HOLD_MSG_SET; + + return I2C_HOLD_MSG_RESET; + } + + return I2C_HOLD_MSG_NONE; +} + #endif /* _LINUX_I2C_H */ |