forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/usb/renesas_usbhs/mod.h
....@@ -1,8 +1,9 @@
1
-// SPDX-License-Identifier: GPL-1.0+
1
+/* SPDX-License-Identifier: GPL-1.0+ */
22 /*
33 * Renesas USB driver
44 *
55 * Copyright (C) 2011 Renesas Solutions Corp.
6
+ * Copyright (C) 2019 Renesas Electronics Corporation
67 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
78 */
89 #ifndef RENESAS_USB_MOD_H
....@@ -84,15 +85,20 @@
8485 /*
8586 * INTSTS0 :: VBINT
8687 *
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.
8990 *
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.
9393 */
9494 int (*irq_vbus)(struct usbhs_priv *priv,
9595 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);
96102 };
97103
98104 /*
....@@ -107,6 +113,7 @@
107113 void usbhs_mod_remove(struct usbhs_priv *priv);
108114
109115 void usbhs_mod_autonomy_mode(struct usbhs_priv *priv);
116
+void usbhs_mod_non_autonomy_mode(struct usbhs_priv *priv);
110117
111118 /*
112119 * status functions
....@@ -129,6 +136,15 @@
129136 mod->func(param); \
130137 })
131138
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
+
132148 /*
133149 * host / gadget control
134150 */