xref: /openbmc/linux/drivers/usb/mtu3/mtu3_dr.h (revision 9dae47aba0a055f761176d9297371d5bb24289ec)
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 
10 #ifndef _MTU3_DR_H_
11 #define _MTU3_DR_H_
12 
13 #if IS_ENABLED(CONFIG_USB_MTU3_HOST) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
14 
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_enable(struct ssusb_mtk *ssusb);
20 int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend);
21 int ssusb_wakeup_enable(struct ssusb_mtk *ssusb);
22 void ssusb_wakeup_disable(struct ssusb_mtk *ssusb);
23 
24 #else
25 
26 static inline int ssusb_host_init(struct ssusb_mtk *ssusb,
27 
28 	struct device_node *parent_dn)
29 {
30 	return 0;
31 }
32 
33 static inline void ssusb_host_exit(struct ssusb_mtk *ssusb)
34 {}
35 
36 static inline int ssusb_wakeup_of_property_parse(
37 	struct ssusb_mtk *ssusb, struct device_node *dn)
38 {
39 	return 0;
40 }
41 
42 static inline int ssusb_host_enable(struct ssusb_mtk *ssusb)
43 {
44 	return 0;
45 }
46 
47 static inline int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend)
48 {
49 	return 0;
50 }
51 
52 static inline int ssusb_wakeup_enable(struct ssusb_mtk *ssusb)
53 {
54 	return 0;
55 }
56 
57 static inline void ssusb_wakeup_disable(struct ssusb_mtk *ssusb)
58 {}
59 
60 #endif
61 
62 
63 #if IS_ENABLED(CONFIG_USB_MTU3_GADGET) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
64 int ssusb_gadget_init(struct ssusb_mtk *ssusb);
65 void ssusb_gadget_exit(struct ssusb_mtk *ssusb);
66 #else
67 static inline int ssusb_gadget_init(struct ssusb_mtk *ssusb)
68 {
69 	return 0;
70 }
71 
72 static inline void ssusb_gadget_exit(struct ssusb_mtk *ssusb)
73 {}
74 #endif
75 
76 
77 #if IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
78 int ssusb_otg_switch_init(struct ssusb_mtk *ssusb);
79 void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb);
80 int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on);
81 void ssusb_set_force_mode(struct ssusb_mtk *ssusb,
82 			  enum mtu3_dr_force_mode mode);
83 
84 #else
85 
86 static inline int ssusb_otg_switch_init(struct ssusb_mtk *ssusb)
87 {
88 	return 0;
89 }
90 
91 static inline void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb)
92 {}
93 
94 static inline int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on)
95 {
96 	return 0;
97 }
98 
99 static inline void
100 ssusb_set_force_mode(struct ssusb_mtk *ssusb, enum mtu3_dr_force_mode mode)
101 {}
102 
103 #endif
104 
105 #endif		/* _MTU3_DR_H_ */
106