external_notify.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. *
  4. * header file supporting usb notify layer
  5. * external notify call chain information
  6. *
  7. * Copyright (C) 2016-2023 Samsung Electronics
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. */
  24. /* usb notify layer v4.0 */
  25. #ifndef __EXTERNAL_NOTIFY_H__
  26. #define __EXTERNAL_NOTIFY_H__
  27. #include <linux/notifier.h>
  28. /* external notifier call chain command */
  29. enum external_notify_cmd {
  30. EXTERNAL_NOTIFY_3S_NODEVICE = 1,
  31. EXTERNAL_NOTIFY_DEVICE_CONNECT,
  32. EXTERNAL_NOTIFY_HOSTBLOCK_PRE,
  33. EXTERNAL_NOTIFY_HOSTBLOCK_POST,
  34. EXTERNAL_NOTIFY_MDMBLOCK_PRE,
  35. EXTERNAL_NOTIFY_MDMBLOCK_POST,
  36. EXTERNAL_NOTIFY_POWERROLE,
  37. EXTERNAL_NOTIFY_DEVICEADD,
  38. EXTERNAL_NOTIFY_HOSTBLOCK_EARLY,
  39. EXTERNAL_NOTIFY_VBUS_RESET,
  40. EXTERNAL_NOTIFY_POSSIBLE_USB,
  41. };
  42. /* external notifier call sequence,
  43. * largest priority number device will be called first.
  44. */
  45. enum external_notify_device {
  46. EXTERNAL_NOTIFY_DEV_MUIC,
  47. EXTERNAL_NOTIFY_DEV_CHARGER,
  48. EXTERNAL_NOTIFY_DEV_PDIC,
  49. EXTERNAL_NOTIFY_DEV_MANAGER,
  50. };
  51. enum external_notify_condev {
  52. EXTERNAL_NOTIFY_NONE = 0,
  53. EXTERNAL_NOTIFY_GPAD,
  54. EXTERNAL_NOTIFY_LANHUB,
  55. };
  56. #ifdef CONFIG_USB_EXTERNAL_NOTIFY
  57. extern int send_external_notify(unsigned long cmd, int data);
  58. extern int usb_external_notify_register(struct notifier_block *nb,
  59. notifier_fn_t notifier, int listener);
  60. extern int usb_external_notify_unregister(struct notifier_block *nb);
  61. extern void external_notifier_init(void);
  62. #else
  63. static inline int send_external_notify(unsigned long cmd,
  64. int data) {return 0; }
  65. static inline int usb_external_notify_register(struct notifier_block *nb,
  66. notifier_fn_t notifier, int listener) {return 0; }
  67. static inline int usb_external_notify_unregister(struct notifier_block *nb)
  68. {return 0; }
  69. static inline void external_notifier_init(void) {}
  70. #endif
  71. #endif /* __EXTERNAL_NOTIFY_H__ */