Greg Kroah-Hartman | 5fd54ac | 2017-11-03 11:28:30 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Chunfeng Yun | b3f4e72 | 2016-10-19 10:28:25 +0800 | [diff] [blame] | 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> |
Chunfeng Yun | b3f4e72 | 2016-10-19 10:28:25 +0800 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef _MTU3_DR_H_ |
| 11 | #define _MTU3_DR_H_ |
| 12 | |
Chunfeng Yun | d0ed062 | 2016-10-19 10:28:26 +0800 | [diff] [blame] | 13 | #if IS_ENABLED(CONFIG_USB_MTU3_HOST) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE) |
Chunfeng Yun | b3f4e72 | 2016-10-19 10:28:25 +0800 | [diff] [blame] | 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); |
Chunfeng Yun | f0ede2c | 2018-01-03 16:53:18 +0800 | [diff] [blame] | 21 | void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable); |
Chunfeng Yun | b3f4e72 | 2016-10-19 10:28:25 +0800 | [diff] [blame] | 22 | |
| 23 | #else |
| 24 | |
| 25 | static inline int ssusb_host_init(struct ssusb_mtk *ssusb, |
| 26 | |
| 27 | struct device_node *parent_dn) |
| 28 | { |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | static inline void ssusb_host_exit(struct ssusb_mtk *ssusb) |
| 33 | {} |
| 34 | |
| 35 | static inline int ssusb_wakeup_of_property_parse( |
| 36 | struct ssusb_mtk *ssusb, struct device_node *dn) |
| 37 | { |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | static inline int ssusb_host_enable(struct ssusb_mtk *ssusb) |
| 42 | { |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | static inline int ssusb_host_disable(struct ssusb_mtk *ssusb, bool suspend) |
| 47 | { |
| 48 | return 0; |
| 49 | } |
| 50 | |
Arnd Bergmann | b926c1d | 2018-01-10 17:45:21 +0100 | [diff] [blame] | 51 | static inline void ssusb_wakeup_set(struct ssusb_mtk *ssusb, bool enable) |
Chunfeng Yun | b3f4e72 | 2016-10-19 10:28:25 +0800 | [diff] [blame] | 52 | {} |
| 53 | |
| 54 | #endif |
| 55 | |
| 56 | |
Chunfeng Yun | d0ed062 | 2016-10-19 10:28:26 +0800 | [diff] [blame] | 57 | #if IS_ENABLED(CONFIG_USB_MTU3_GADGET) || IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE) |
Chunfeng Yun | b3f4e72 | 2016-10-19 10:28:25 +0800 | [diff] [blame] | 58 | int ssusb_gadget_init(struct ssusb_mtk *ssusb); |
| 59 | void ssusb_gadget_exit(struct ssusb_mtk *ssusb); |
| 60 | #else |
| 61 | static inline int ssusb_gadget_init(struct ssusb_mtk *ssusb) |
| 62 | { |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | static inline void ssusb_gadget_exit(struct ssusb_mtk *ssusb) |
| 67 | {} |
| 68 | #endif |
| 69 | |
Chunfeng Yun | d0ed062 | 2016-10-19 10:28:26 +0800 | [diff] [blame] | 70 | |
| 71 | #if IS_ENABLED(CONFIG_USB_MTU3_DUAL_ROLE) |
| 72 | int ssusb_otg_switch_init(struct ssusb_mtk *ssusb); |
| 73 | void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb); |
| 74 | int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on); |
Chunfeng Yun | c776f2c | 2017-10-13 17:10:42 +0800 | [diff] [blame] | 75 | void ssusb_set_force_mode(struct ssusb_mtk *ssusb, |
| 76 | enum mtu3_dr_force_mode mode); |
Chunfeng Yun | d0ed062 | 2016-10-19 10:28:26 +0800 | [diff] [blame] | 77 | |
| 78 | #else |
| 79 | |
| 80 | static inline int ssusb_otg_switch_init(struct ssusb_mtk *ssusb) |
| 81 | { |
| 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | static inline void ssusb_otg_switch_exit(struct ssusb_mtk *ssusb) |
| 86 | {} |
| 87 | |
| 88 | static inline int ssusb_set_vbus(struct otg_switch_mtk *otg_sx, int is_on) |
| 89 | { |
| 90 | return 0; |
| 91 | } |
| 92 | |
Chunfeng Yun | c776f2c | 2017-10-13 17:10:42 +0800 | [diff] [blame] | 93 | static inline void |
| 94 | ssusb_set_force_mode(struct ssusb_mtk *ssusb, enum mtu3_dr_force_mode mode) |
| 95 | {} |
| 96 | |
Chunfeng Yun | d0ed062 | 2016-10-19 10:28:26 +0800 | [diff] [blame] | 97 | #endif |
| 98 | |
Chunfeng Yun | b3f4e72 | 2016-10-19 10:28:25 +0800 | [diff] [blame] | 99 | #endif /* _MTU3_DR_H_ */ |