summaryrefslogtreecommitdiff
path: root/include/linux/i2c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/i2c.h')
-rw-r--r--include/linux/i2c.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 2ce3efbe9198..dc681a7196f7 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -20,6 +20,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;
@@ -738,6 +739,13 @@ struct i2c_adapter {
struct irq_domain *host_notify_domain;
struct regulator *bus_regulator;
+
+ /*
+ * 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)
@@ -1040,4 +1048,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 */