blob: 760fe7d69c6bc0a7480bf48879ebef6c688bd204 [file] [log] [blame]
Olivier Deprez157378f2022-04-04 15:47:50 +02001/* SPDX-License-Identifier: GPL-2.0 */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
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
15int ssusb_host_init(struct ssusb_mtk *ssusb, struct device_node *parent_dn);
16void ssusb_host_exit(struct ssusb_mtk *ssusb);
17int ssusb_wakeup_of_property_parse(struct ssusb_mtk *ssusb,
18 struct device_node *dn);
19int ssusb_host_enable(struct ssusb_mtk *ssusb);
20int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend);
21void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable);
22
23#else
24
25static inline int ssusb_host_init(struct ssusb_mtk *ssusb,
26
27 struct device_node *parent_dn)
28{
29 return 0;
30}
31
32static inline void ssusb_host_exit(struct ssusb_mtk *ssusb)
33{}
34
35static inline int ssusb_wakeup_of_property_parse(
36 struct ssusb_mtk *ssusb, struct device_node *dn)
37{
38 return 0;
39}
40
41static inline int ssusb_host_enable(struct ssusb_mtk *ssusb)
42{
43 return 0;
44}
45
46static inline int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend)
47{
48 return 0;
49}
50
51static inline void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable)
52{}
53
54#endif
55
56
57#if IS_ENABLED(CONFIG_USB_MTU3_GADGET) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
58int ssusb_gadget_init(struct ssusb_mtk *ssusb);
59void ssusb_gadget_exit(struct ssusb_mtk *ssusb);
60#else
61static inline int ssusb_gadget_init(struct ssusb_mtk *ssusb)
62{
63 return 0;
64}
65
66static inline void ssusb_gadget_exit(struct ssusb_mtk *ssusb)
67{}
68#endif
69
70
71#if IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
72int ssusb_otg_switch_init(struct ssusb_mtk *ssusb);
73void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb);
David Brazdil0f672f62019-12-10 10:32:29 +000074void ssusb_mode_switch(struct ssusb_mtk *ssusb, int to_host);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000075int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on);
76void ssusb_set_force_mode(struct ssusb_mtk *ssusb,
77 enum mtu3_dr_force_mode mode);
78
79#else
80
81static inline int ssusb_otg_switch_init(struct ssusb_mtk *ssusb)
82{
83 return 0;
84}
85
86static inline void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb)
87{}
88
David Brazdil0f672f62019-12-10 10:32:29 +000089static inline void ssusb_mode_switch(struct ssusb_mtk *ssusb, int to_host)
90{}
91
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000092static inline int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on)
93{
94 return 0;
95}
96
97static inline void
98ssusb_set_force_mode(struct ssusb_mtk *ssusb, enum mtu3_dr_force_mode mode)
99{}
100
101#endif
102
103#endif /* _MTU3_DR_H_ */