host_notify.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Host notify class driver
  4. *
  5. * Copyright (C) 2011-2023 Samsung, Inc.
  6. * Author: Dongrak Shin <[email protected]>
  7. *
  8. */
  9. /* usb notify layer v4.0 */
  10. #ifndef __LINUX_HOST_NOTIFY_H__
  11. #define __LINUX_HOST_NOTIFY_H__
  12. enum host_uevent_state {
  13. NOTIFY_HOST_NONE,
  14. NOTIFY_HOST_ADD,
  15. NOTIFY_HOST_REMOVE,
  16. NOTIFY_HOST_OVERCURRENT,
  17. NOTIFY_HOST_LOWBATT,
  18. NOTIFY_HOST_BLOCK,
  19. NOTIFY_HOST_UNKNOWN,
  20. NOTIFY_HOST_SOURCE,
  21. NOTIFY_HOST_SINK,
  22. };
  23. enum host_uevent_type {
  24. NOTIFY_UNKNOWN_STATE,
  25. NOTIFY_HOST_STATE,
  26. NOTIFY_POWER_STATE,
  27. };
  28. enum otg_hostnotify_mode {
  29. NOTIFY_NONE_MODE,
  30. NOTIFY_HOST_MODE,
  31. NOTIFY_PERIPHERAL_MODE,
  32. NOTIFY_TEST_MODE,
  33. };
  34. enum booster_power {
  35. NOTIFY_POWER_OFF,
  36. NOTIFY_POWER_ON,
  37. };
  38. enum set_command {
  39. NOTIFY_SET_OFF,
  40. NOTIFY_SET_ON,
  41. };
  42. struct host_notify_dev {
  43. const char *name;
  44. struct device *dev;
  45. int index;
  46. int host_state;
  47. int host_change;
  48. int power_state;
  49. int power_change;
  50. int mode;
  51. int booster;
  52. int (*set_mode)(bool on);
  53. int (*set_booster)(bool on);
  54. };
  55. #ifdef CONFIG_USB_HOST_NOTIFY
  56. extern int host_state_notify(struct host_notify_dev *ndev, int state);
  57. extern int host_notify_dev_register(struct host_notify_dev *ndev);
  58. extern void host_notify_dev_unregister(struct host_notify_dev *ndev);
  59. #else
  60. static inline int host_state_notify(struct host_notify_dev *ndev, int state)
  61. {return 0; }
  62. static inline int host_notify_dev_register(struct host_notify_dev *ndev)
  63. {return 0; }
  64. static inline void host_notify_dev_unregister(struct host_notify_dev *ndev) {}
  65. #endif
  66. #endif /* __LINUX_HOST_NOTIFY_H__ */