.. | .. |
---|
1 | | -// SPDX-License-Identifier: GPL-1.0+ |
---|
| 1 | +/* SPDX-License-Identifier: GPL-1.0+ */ |
---|
2 | 2 | /* |
---|
3 | 3 | * Renesas USB driver |
---|
4 | 4 | * |
---|
5 | 5 | * Copyright (C) 2011 Renesas Solutions Corp. |
---|
| 6 | + * Copyright (C) 2019 Renesas Electronics Corporation |
---|
6 | 7 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
---|
7 | 8 | */ |
---|
8 | 9 | #ifndef RENESAS_USB_MOD_H |
---|
.. | .. |
---|
84 | 85 | /* |
---|
85 | 86 | * INTSTS0 :: VBINT |
---|
86 | 87 | * |
---|
87 | | - * This function will be used as autonomy mode |
---|
88 | | - * when platform cannot call notify_hotplug. |
---|
| 88 | + * This function will be used as autonomy mode (runtime_pwctrl == 0) |
---|
| 89 | + * when the platform doesn't have own get_vbus function. |
---|
89 | 90 | * |
---|
90 | | - * This callback cannot be member of "struct usbhs_mod" |
---|
91 | | - * because it will be used even though |
---|
92 | | - * host/gadget has not been selected. |
---|
| 91 | + * This callback cannot be member of "struct usbhs_mod" because it |
---|
| 92 | + * will be used even though host/gadget has not been selected. |
---|
93 | 93 | */ |
---|
94 | 94 | int (*irq_vbus)(struct usbhs_priv *priv, |
---|
95 | 95 | struct usbhs_irq_state *irq_state); |
---|
| 96 | + |
---|
| 97 | + /* |
---|
| 98 | + * This function will be used on any gadget mode. To simplify the code, |
---|
| 99 | + * this member is in here. |
---|
| 100 | + */ |
---|
| 101 | + int (*get_vbus)(struct platform_device *pdev); |
---|
96 | 102 | }; |
---|
97 | 103 | |
---|
98 | 104 | /* |
---|
.. | .. |
---|
107 | 113 | void usbhs_mod_remove(struct usbhs_priv *priv); |
---|
108 | 114 | |
---|
109 | 115 | void usbhs_mod_autonomy_mode(struct usbhs_priv *priv); |
---|
| 116 | +void usbhs_mod_non_autonomy_mode(struct usbhs_priv *priv); |
---|
110 | 117 | |
---|
111 | 118 | /* |
---|
112 | 119 | * status functions |
---|
.. | .. |
---|
129 | 136 | mod->func(param); \ |
---|
130 | 137 | }) |
---|
131 | 138 | |
---|
| 139 | +#define usbhs_priv_to_modinfo(priv) (&priv->mod_info) |
---|
| 140 | +#define usbhs_mod_info_call(priv, func, param...) \ |
---|
| 141 | +({ \ |
---|
| 142 | + struct usbhs_mod_info *info; \ |
---|
| 143 | + info = usbhs_priv_to_modinfo(priv); \ |
---|
| 144 | + !info->func ? 0 : \ |
---|
| 145 | + info->func(param); \ |
---|
| 146 | +}) |
---|
| 147 | + |
---|
132 | 148 | /* |
---|
133 | 149 | * host / gadget control |
---|
134 | 150 | */ |
---|