i2c-smbus.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * i2c-smbus.h - SMBus extensions to the I2C protocol
  4. *
  5. * Copyright (C) 2010-2019 Jean Delvare <[email protected]>
  6. */
  7. #ifndef _LINUX_I2C_SMBUS_H
  8. #define _LINUX_I2C_SMBUS_H
  9. #include <linux/i2c.h>
  10. #include <linux/spinlock.h>
  11. #include <linux/workqueue.h>
  12. /**
  13. * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client
  14. * @irq: IRQ number, if the smbus_alert driver should take care of interrupt
  15. * handling
  16. *
  17. * If irq is not specified, the smbus_alert driver doesn't take care of
  18. * interrupt handling. In that case it is up to the I2C bus driver to either
  19. * handle the interrupts or to poll for alerts.
  20. */
  21. struct i2c_smbus_alert_setup {
  22. int irq;
  23. };
  24. struct i2c_client *i2c_new_smbus_alert_device(struct i2c_adapter *adapter,
  25. struct i2c_smbus_alert_setup *setup);
  26. int i2c_handle_smbus_alert(struct i2c_client *ara);
  27. #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_I2C_SLAVE)
  28. struct i2c_client *i2c_new_slave_host_notify_device(struct i2c_adapter *adapter);
  29. void i2c_free_slave_host_notify_device(struct i2c_client *client);
  30. #else
  31. static inline struct i2c_client *i2c_new_slave_host_notify_device(struct i2c_adapter *adapter)
  32. {
  33. return ERR_PTR(-ENOSYS);
  34. }
  35. static inline void i2c_free_slave_host_notify_device(struct i2c_client *client)
  36. {
  37. }
  38. #endif
  39. #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_DMI)
  40. void i2c_register_spd(struct i2c_adapter *adap);
  41. #else
  42. static inline void i2c_register_spd(struct i2c_adapter *adap) { }
  43. #endif
  44. #endif /* _LINUX_I2C_SMBUS_H */