Linux Audio

Check our new training course

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