mtu3_dr.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * mtu3_dr.h - dual role switch and host glue layer header
  3. *
  4. * Copyright (C) 2016 MediaTek Inc.
  5. *
  6. * Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
  7. *
  8. * This software is licensed under the terms of the GNU General Public
  9. * License version 2, as published by the Free Software Foundation, and
  10. * may be copied, distributed, and modified under those terms.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #ifndef _MTU3_DR_H_
  19. #define _MTU3_DR_H_
  20. #if IS_ENABLED(CONFIG_USB_MTU3_HOST) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
  21. int ssusb_host_init(struct ssusb_mtk *ssusb, struct device_node *parent_dn);
  22. void ssusb_host_exit(struct ssusb_mtk *ssusb);
  23. int ssusb_wakeup_of_property_parse(struct ssusb_mtk *ssusb,
  24. struct device_node *dn);
  25. int ssusb_host_enable(struct ssusb_mtk *ssusb);
  26. int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend);
  27. int ssusb_wakeup_enable(struct ssusb_mtk *ssusb);
  28. void ssusb_wakeup_disable(struct ssusb_mtk *ssusb);
  29. #else
  30. static inline int ssusb_host_init(struct ssusb_mtk *ssusb,
  31. struct device_node *parent_dn)
  32. {
  33. return 0;
  34. }
  35. static inline void ssusb_host_exit(struct ssusb_mtk *ssusb)
  36. {}
  37. static inline int ssusb_wakeup_of_property_parse(
  38. struct ssusb_mtk *ssusb, struct device_node *dn)
  39. {
  40. return 0;
  41. }
  42. static inline int ssusb_host_enable(struct ssusb_mtk *ssusb)
  43. {
  44. return 0;
  45. }
  46. static inline int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend)
  47. {
  48. return 0;
  49. }
  50. static inline int ssusb_wakeup_enable(struct ssusb_mtk *ssusb)
  51. {
  52. return 0;
  53. }
  54. static inline void ssusb_wakeup_disable(struct ssusb_mtk *ssusb)
  55. {}
  56. #endif
  57. #if IS_ENABLED(CONFIG_USB_MTU3_GADGET) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
  58. int ssusb_gadget_init(struct ssusb_mtk *ssusb);
  59. void ssusb_gadget_exit(struct ssusb_mtk *ssusb);
  60. #else
  61. static inline int ssusb_gadget_init(struct ssusb_mtk *ssusb)
  62. {
  63. return 0;
  64. }
  65. static inline void ssusb_gadget_exit(struct ssusb_mtk *ssusb)
  66. {}
  67. #endif
  68. #if IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
  69. int ssusb_otg_switch_init(struct ssusb_mtk *ssusb);
  70. void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb);
  71. int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on);
  72. #else
  73. static inline int ssusb_otg_switch_init(struct ssusb_mtk *ssusb)
  74. {
  75. return 0;
  76. }
  77. static inline void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb)
  78. {}
  79. static inline int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on)
  80. {
  81. return 0;
  82. }
  83. #endif
  84. #endif /* _MTU3_DR_H_ */