summaryrefslogtreecommitdiff
path: root/include/linux/i2c-smbus.h
diff options
context:
space:
mode:
authorAlain Volmat <alain.volmat@st.com>2020-08-03 07:17:55 +0200
committerWolfram Sang <wsa@kernel.org>2020-09-09 10:38:28 +0200
commit2a71593da34d473461f2f5c3dbb53b883596188a (patch)
tree11499f7b30521f57203094e4694ccc33f27c26c2 /include/linux/i2c-smbus.h
parente6277308ac214af04516564c516a0ff5f753d009 (diff)
i2c: smbus: add core function handling SMBus host-notify
SMBus Host-Notify protocol, from the adapter point of view consist of receiving a message from a client, including the client address and some other data. It can be simply handled by creating a new slave device and registering a callback performing the parsing of the message received from the client. This commit introduces two new core functions * i2c_new_slave_host_notify_device * i2c_free_slave_host_notify_device that take care of registration of the new slave device and callback and will call i2c_handle_smbus_host_notify once a Host-Notify event is received. Signed-off-by: Alain Volmat <alain.volmat@st.com> Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'include/linux/i2c-smbus.h')
-rw-r--r--include/linux/i2c-smbus.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h
index 1e4e0de4ef8b..1ef421818d3a 100644
--- a/include/linux/i2c-smbus.h
+++ b/include/linux/i2c-smbus.h
@@ -38,6 +38,18 @@ static inline int of_i2c_setup_smbus_alert(struct i2c_adapter *adap)
return 0;
}
#endif
+#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_I2C_SLAVE)
+struct i2c_client *i2c_new_slave_host_notify_device(struct i2c_adapter *adapter);
+void i2c_free_slave_host_notify_device(struct i2c_client *client);
+#else
+static inline struct i2c_client *i2c_new_slave_host_notify_device(struct i2c_adapter *adapter)
+{
+ return ERR_PTR(-ENOSYS);
+}
+static inline void i2c_free_slave_host_notify_device(struct i2c_client *client)
+{
+}
+#endif
#if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_DMI)
void i2c_register_spd(struct i2c_adapter *adap);