1 /* SPDX-License-Identifier: GPL-2.0 */
3 * mtu3_dr.h - dual role switch and host glue layer header
5 * Copyright (C) 2016 MediaTek Inc.
7 * Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
13 #if IS_ENABLED(CONFIG_USB_MTU3_HOST) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
15 int ssusb_host_init(struct ssusb_mtk *ssusb, struct device_node *parent_dn);
16 void ssusb_host_exit(struct ssusb_mtk *ssusb);
17 int ssusb_wakeup_of_property_parse(struct ssusb_mtk *ssusb,
18 struct device_node *dn);
19 int ssusb_host_resume(struct ssusb_mtk *ssusb, bool p0_skipped);
20 int ssusb_host_suspend(struct ssusb_mtk *ssusb);
21 void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable);
25 static inline int ssusb_host_init(struct ssusb_mtk *ssusb,
27 struct device_node *parent_dn)
32 static inline void ssusb_host_exit(struct ssusb_mtk *ssusb)
35 static inline int ssusb_wakeup_of_property_parse(
36 struct ssusb_mtk *ssusb, struct device_node *dn)
41 static inline int ssusb_host_resume(struct ssusb_mtk *ssusb, bool p0_skipped)
46 static inline int ssusb_host_suspend(struct ssusb_mtk *ssusb)
51 static inline void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable)
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 int ssusb_gadget_suspend(struct ssusb_mtk *ssusb, pm_message_t msg);
61 int ssusb_gadget_resume(struct ssusb_mtk *ssusb, pm_message_t msg);
62 bool ssusb_gadget_ip_sleep_check(struct ssusb_mtk *ssusb);
65 static inline int ssusb_gadget_init(struct ssusb_mtk *ssusb)
70 static inline void ssusb_gadget_exit(struct ssusb_mtk *ssusb)
74 ssusb_gadget_suspend(struct ssusb_mtk *ssusb, pm_message_t msg)
80 ssusb_gadget_resume(struct ssusb_mtk *ssusb, pm_message_t msg)
85 static inline bool ssusb_gadget_ip_sleep_check(struct ssusb_mtk *ssusb)
93 #if IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
94 int ssusb_otg_switch_init(struct ssusb_mtk *ssusb);
95 void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb);
96 void ssusb_mode_switch(struct ssusb_mtk *ssusb, int to_host);
97 int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on);
98 void ssusb_set_force_mode(struct ssusb_mtk *ssusb,
99 enum mtu3_dr_force_mode mode);
103 static inline int ssusb_otg_switch_init(struct ssusb_mtk *ssusb)
108 static inline void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb)
111 static inline void ssusb_mode_switch(struct ssusb_mtk *ssusb, int to_host)
114 static inline int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on)
120 ssusb_set_force_mode(struct ssusb_mtk *ssusb, enum mtu3_dr_force_mode mode)
125 #endif /* _MTU3_DR_H_ */