mtu3_dr.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * mtu3_dr.h - dual role switch and host glue layer header
  4. *
  5. * Copyright (C) 2016 MediaTek Inc.
  6. *
  7. * Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
  8. */
  9. #ifndef _MTU3_DR_H_
  10. #define _MTU3_DR_H_
  11. #if IS_ENABLED(CONFIG_USB_MTU3_HOST) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
  12. int ssusb_host_init(struct ssusb_mtk *ssusb, struct device_node *parent_dn);
  13. void ssusb_host_exit(struct ssusb_mtk *ssusb);
  14. int ssusb_wakeup_of_property_parse(struct ssusb_mtk *ssusb,
  15. struct device_node *dn);
  16. int ssusb_host_enable(struct ssusb_mtk *ssusb);
  17. int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend);
  18. void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable);
  19. #else
  20. static inline int ssusb_host_init(struct ssusb_mtk *ssusb,
  21. struct device_node *parent_dn)
  22. {
  23. return 0;
  24. }
  25. static inline void ssusb_host_exit(struct ssusb_mtk *ssusb)
  26. {}
  27. static inline int ssusb_wakeup_of_property_parse(
  28. struct ssusb_mtk *ssusb, struct device_node *dn)
  29. {
  30. return 0;
  31. }
  32. static inline int ssusb_host_enable(struct ssusb_mtk *ssusb)
  33. {
  34. return 0;
  35. }
  36. static inline int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend)
  37. {
  38. return 0;
  39. }
  40. static inline void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable)
  41. {}
  42. #endif
  43. #if IS_ENABLED(CONFIG_USB_MTU3_GADGET) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
  44. int ssusb_gadget_init(struct ssusb_mtk *ssusb);
  45. void ssusb_gadget_exit(struct ssusb_mtk *ssusb);
  46. #else
  47. static inline int ssusb_gadget_init(struct ssusb_mtk *ssusb)
  48. {
  49. return 0;
  50. }
  51. static inline void ssusb_gadget_exit(struct ssusb_mtk *ssusb)
  52. {}
  53. #endif
  54. #if IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
  55. int ssusb_otg_switch_init(struct ssusb_mtk *ssusb);
  56. void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb);
  57. int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on);
  58. void ssusb_set_force_mode(struct ssusb_mtk *ssusb,
  59. enum mtu3_dr_force_mode mode);
  60. #else
  61. static inline int ssusb_otg_switch_init(struct ssusb_mtk *ssusb)
  62. {
  63. return 0;
  64. }
  65. static inline void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb)
  66. {}
  67. static inline int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on)
  68. {
  69. return 0;
  70. }
  71. static inline void
  72. ssusb_set_force_mode(struct ssusb_mtk *ssusb, enum mtu3_dr_force_mode mode)
  73. {}
  74. #endif
  75. #endif /* _MTU3_DR_H_ */