i2c-smbus.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 <jdelvare@suse.de>
  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_OF)
  28. int of_i2c_setup_smbus_alert(struct i2c_adapter *adap);
  29. #else
  30. static inline int of_i2c_setup_smbus_alert(struct i2c_adapter *adap)
  31. {
  32. return 0;
  33. }
  34. #endif
  35. #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_I2C_SLAVE)
  36. struct i2c_client *i2c_new_slave_host_notify_device(struct i2c_adapter *adapter);
  37. void i2c_free_slave_host_notify_device(struct i2c_client *client);
  38. #else
  39. static inline struct i2c_client *i2c_new_slave_host_notify_device(struct i2c_adapter *adapter)
  40. {
  41. return ERR_PTR(-ENOSYS);
  42. }
  43. static inline void i2c_free_slave_host_notify_device(struct i2c_client *client)
  44. {
  45. }
  46. #endif
  47. #if IS_ENABLED(CONFIG_I2C_SMBUS) && IS_ENABLED(CONFIG_DMI)
  48. void i2c_register_spd(struct i2c_adapter *adap);
  49. #else
  50. static inline void i2c_register_spd(struct i2c_adapter *adap) { }
  51. #endif
  52. #endif /* _LINUX_I2C_SMBUS_H */