Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * i2c-smbus.h - SMBus extensions to the I2C protocol
0004  *
0005  * Copyright (C) 2010-2019 Jean Delvare <jdelvare@suse.de>
0006  */
0007 
0008 #ifndef _LINUX_I2C_SMBUS_H
0009 #define _LINUX_I2C_SMBUS_H
0010 
0011 #include <linux/i2c.h>
0012 #include <linux/spinlock.h>
0013 #include <linux/workqueue.h>
0014 
0015 
0016 /**
0017  * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client
0018  * @irq: IRQ number, if the smbus_alert driver should take care of interrupt
0019  *      handling
0020  *
0021  * If irq is not specified, the smbus_alert driver doesn't take care of
0022  * interrupt handling. In that case it is up to the I2C bus driver to either
0023  * handle the interrupts or to poll for alerts.
0024  */
0025 struct i2c_smbus_alert_setup {
0026     int         irq;
0027 };
0028 
0029 struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter,
0030                           struct i2c_smbus_alert_setup *setup);
0031 int i2c_handle_smbus_alert(struct i2c_client *ara);
0032 
0033 #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_I2C_SLAVE)
0034 struct i2c_client *i2c_new_slave_host_notify_device(struct i2c_adapter *adapter);
0035 void i2c_free_slave_host_notify_device(struct i2c_client *client);
0036 #else
0037 static inline struct i2c_client *i2c_new_slave_host_notify_device(struct i2c_adapter *adapter)
0038 {
0039     return ERR_PTR(-ENOSYS);
0040 }
0041 static inline void i2c_free_slave_host_notify_device(struct i2c_client *client)
0042 {
0043 }
0044 #endif
0045 
0046 #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_DMI)
0047 void i2c_register_spd(struct i2c_adapter *adap);
0048 #else
0049 static inline void i2c_register_spd(struct i2c_adapter *adap) { }
0050 #endif
0051 
0052 #endif /* _LINUX_I2C_SMBUS_H */