Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * mtu3_dr.h - dual role switch and host glue layer header
0004  *
0005  * Copyright (C) 2016 MediaTek Inc.
0006  *
0007  * Author: Chunfeng Yun <chunfeng.yun@mediatek.com>
0008  */
0009 
0010 #ifndef _MTU3_DR_H_
0011 #define _MTU3_DR_H_
0012 
0013 #if IS_ENABLED(CONFIG_USB_MTU3_HOST) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
0014 
0015 int ssusb_host_init(struct ssusb_mtk *ssusb, struct device_node *parent_dn);
0016 void ssusb_host_exit(struct ssusb_mtk *ssusb);
0017 int ssusb_wakeup_of_property_parse(struct ssusb_mtk *ssusb,
0018                 struct device_node *dn);
0019 int ssusb_host_resume(struct ssusb_mtk *ssusb, bool p0_skipped);
0020 int ssusb_host_suspend(struct ssusb_mtk *ssusb);
0021 void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable);
0022 
0023 #else
0024 
0025 static inline int ssusb_host_init(struct ssusb_mtk *ssusb,
0026 
0027     struct device_node *parent_dn)
0028 {
0029     return 0;
0030 }
0031 
0032 static inline void ssusb_host_exit(struct ssusb_mtk *ssusb)
0033 {}
0034 
0035 static inline int ssusb_wakeup_of_property_parse(
0036     struct ssusb_mtk *ssusb, struct device_node *dn)
0037 {
0038     return 0;
0039 }
0040 
0041 static inline int ssusb_host_resume(struct ssusb_mtk *ssusb, bool p0_skipped)
0042 {
0043     return 0;
0044 }
0045 
0046 static inline int ssusb_host_suspend(struct ssusb_mtk *ssusb)
0047 {
0048     return 0;
0049 }
0050 
0051 static inline void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable)
0052 {}
0053 
0054 #endif
0055 
0056 
0057 #if IS_ENABLED(CONFIG_USB_MTU3_GADGET) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
0058 int ssusb_gadget_init(struct ssusb_mtk *ssusb);
0059 void ssusb_gadget_exit(struct ssusb_mtk *ssusb);
0060 int ssusb_gadget_suspend(struct ssusb_mtk *ssusb, pm_message_t msg);
0061 int ssusb_gadget_resume(struct ssusb_mtk *ssusb, pm_message_t msg);
0062 bool ssusb_gadget_ip_sleep_check(struct ssusb_mtk *ssusb);
0063 
0064 #else
0065 static inline int ssusb_gadget_init(struct ssusb_mtk *ssusb)
0066 {
0067     return 0;
0068 }
0069 
0070 static inline void ssusb_gadget_exit(struct ssusb_mtk *ssusb)
0071 {}
0072 
0073 static inline int
0074 ssusb_gadget_suspend(struct ssusb_mtk *ssusb, pm_message_t msg)
0075 {
0076     return 0;
0077 }
0078 
0079 static inline int
0080 ssusb_gadget_resume(struct ssusb_mtk *ssusb, pm_message_t msg)
0081 {
0082     return 0;
0083 }
0084 
0085 static inline bool ssusb_gadget_ip_sleep_check(struct ssusb_mtk *ssusb)
0086 {
0087     return true;
0088 }
0089 
0090 #endif
0091 
0092 
0093 #if IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE)
0094 int ssusb_otg_switch_init(struct ssusb_mtk *ssusb);
0095 void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb);
0096 void ssusb_mode_switch(struct ssusb_mtk *ssusb, int to_host);
0097 int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on);
0098 void ssusb_set_force_mode(struct ssusb_mtk *ssusb,
0099               enum mtu3_dr_force_mode mode);
0100 
0101 #else
0102 
0103 static inline int ssusb_otg_switch_init(struct ssusb_mtk *ssusb)
0104 {
0105     return 0;
0106 }
0107 
0108 static inline void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb)
0109 {}
0110 
0111 static inline void ssusb_mode_switch(struct ssusb_mtk *ssusb, int to_host)
0112 {}
0113 
0114 static inline int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on)
0115 {
0116     return 0;
0117 }
0118 
0119 static inline void
0120 ssusb_set_force_mode(struct ssusb_mtk *ssusb, enum mtu3_dr_force_mode mode)
0121 {}
0122 
0123 #endif
0124 
0125 #endif      /* _MTU3_DR_H_ */