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 * This software is licensed under the terms of the GNU General Public 10 * License version 2, as published by the Free Software Foundation, and 11 * may be copied, distributed, and modified under those terms. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 */ 19 20 #ifndef _MTU3_DR_H_ 21 #define _MTU3_DR_H_ 22 23 #if IS_ENABLED(CONFIG_USB_MTU3_HOST) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE) 24 25 int ssusb_host_init(struct ssusb_mtk *ssusb, struct device_node *parent_dn); 26 void ssusb_host_exit(struct ssusb_mtk *ssusb); 27 int ssusb_wakeup_of_property_parse(struct ssusb_mtk *ssusb, 28 struct device_node *dn); 29 int ssusb_host_enable(struct ssusb_mtk *ssusb); 30 int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend); 31 int ssusb_wakeup_enable(struct ssusb_mtk *ssusb); 32 void ssusb_wakeup_disable(struct ssusb_mtk *ssusb); 33 34 #else 35 36 static inline int ssusb_host_init(struct ssusb_mtk *ssusb, 37 38 struct device_node *parent_dn) 39 { 40 return 0; 41 } 42 43 static inline void ssusb_host_exit(struct ssusb_mtk *ssusb) 44 {} 45 46 static inline int ssusb_wakeup_of_property_parse( 47 struct ssusb_mtk *ssusb, struct device_node *dn) 48 { 49 return 0; 50 } 51 52 static inline int ssusb_host_enable(struct ssusb_mtk *ssusb) 53 { 54 return 0; 55 } 56 57 static inline int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend) 58 { 59 return 0; 60 } 61 62 static inline int ssusb_wakeup_enable(struct ssusb_mtk *ssusb) 63 { 64 return 0; 65 } 66 67 static inline void ssusb_wakeup_disable(struct ssusb_mtk *ssusb) 68 {} 69 70 #endif 71 72 73 #if IS_ENABLED(CONFIG_USB_MTU3_GADGET) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE) 74 int ssusb_gadget_init(struct ssusb_mtk *ssusb); 75 void ssusb_gadget_exit(struct ssusb_mtk *ssusb); 76 #else 77 static inline int ssusb_gadget_init(struct ssusb_mtk *ssusb) 78 { 79 return 0; 80 } 81 82 static inline void ssusb_gadget_exit(struct ssusb_mtk *ssusb) 83 {} 84 #endif 85 86 87 #if IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE) 88 int ssusb_otg_switch_init(struct ssusb_mtk *ssusb); 89 void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb); 90 int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on); 91 void ssusb_set_force_mode(struct ssusb_mtk *ssusb, 92 enum mtu3_dr_force_mode mode); 93 94 #else 95 96 static inline int ssusb_otg_switch_init(struct ssusb_mtk *ssusb) 97 { 98 return 0; 99 } 100 101 static inline void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb) 102 {} 103 104 static inline int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on) 105 { 106 return 0; 107 } 108 109 static inline void 110 ssusb_set_force_mode(struct ssusb_mtk *ssusb, enum mtu3_dr_force_mode mode) 111 {} 112 113 #endif 114 115 #endif /* _MTU3_DR_H_ */ 116