diff options
Diffstat (limited to 'include/linux/usb/otg.h')
-rw-r--r-- | include/linux/usb/otg.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 52bb917641f0..f8302d036a76 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef __LINUX_USB_OTG_H | 9 | #ifndef __LINUX_USB_OTG_H |
10 | #define __LINUX_USB_OTG_H | 10 | #define __LINUX_USB_OTG_H |
11 | 11 | ||
12 | #include <linux/notifier.h> | ||
13 | |||
12 | /* OTG defines lots of enumeration states before device reset */ | 14 | /* OTG defines lots of enumeration states before device reset */ |
13 | enum usb_otg_state { | 15 | enum usb_otg_state { |
14 | OTG_STATE_UNDEFINED = 0, | 16 | OTG_STATE_UNDEFINED = 0, |
@@ -33,6 +35,14 @@ enum usb_otg_state { | |||
33 | OTG_STATE_A_VBUS_ERR, | 35 | OTG_STATE_A_VBUS_ERR, |
34 | }; | 36 | }; |
35 | 37 | ||
38 | enum usb_xceiv_events { | ||
39 | USB_EVENT_NONE, /* no events or cable disconnected */ | ||
40 | USB_EVENT_VBUS, /* vbus valid event */ | ||
41 | USB_EVENT_ID, /* id was grounded */ | ||
42 | USB_EVENT_CHARGER, /* usb dedicated charger */ | ||
43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ | ||
44 | }; | ||
45 | |||
36 | #define USB_OTG_PULLUP_ID (1 << 0) | 46 | #define USB_OTG_PULLUP_ID (1 << 0) |
37 | #define USB_OTG_PULLDOWN_DP (1 << 1) | 47 | #define USB_OTG_PULLDOWN_DP (1 << 1) |
38 | #define USB_OTG_PULLDOWN_DM (1 << 2) | 48 | #define USB_OTG_PULLDOWN_DM (1 << 2) |
@@ -70,6 +80,9 @@ struct otg_transceiver { | |||
70 | struct otg_io_access_ops *io_ops; | 80 | struct otg_io_access_ops *io_ops; |
71 | void __iomem *io_priv; | 81 | void __iomem *io_priv; |
72 | 82 | ||
83 | /* for notification of usb_xceiv_events */ | ||
84 | struct blocking_notifier_head notifier; | ||
85 | |||
73 | /* to pass extra port status to the root hub */ | 86 | /* to pass extra port status to the root hub */ |
74 | u16 port_status; | 87 | u16 port_status; |
75 | u16 port_change; | 88 | u16 port_change; |
@@ -110,9 +123,19 @@ struct otg_transceiver { | |||
110 | /* for board-specific init logic */ | 123 | /* for board-specific init logic */ |
111 | extern int otg_set_transceiver(struct otg_transceiver *); | 124 | extern int otg_set_transceiver(struct otg_transceiver *); |
112 | 125 | ||
126 | #if defined(CONFIG_NOP_USB_XCEIV) || defined(CONFIG_NOP_USB_XCEIV_MODULE) | ||
113 | /* sometimes transceivers are accessed only through e.g. ULPI */ | 127 | /* sometimes transceivers are accessed only through e.g. ULPI */ |
114 | extern void usb_nop_xceiv_register(void); | 128 | extern void usb_nop_xceiv_register(void); |
115 | extern void usb_nop_xceiv_unregister(void); | 129 | extern void usb_nop_xceiv_unregister(void); |
130 | #else | ||
131 | static inline void usb_nop_xceiv_register(void) | ||
132 | { | ||
133 | } | ||
134 | |||
135 | static inline void usb_nop_xceiv_unregister(void) | ||
136 | { | ||
137 | } | ||
138 | #endif | ||
116 | 139 | ||
117 | /* helpers for direct access thru low-level io interface */ | 140 | /* helpers for direct access thru low-level io interface */ |
118 | static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) | 141 | static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) |
@@ -203,6 +226,18 @@ otg_start_srp(struct otg_transceiver *otg) | |||
203 | return otg->start_srp(otg); | 226 | return otg->start_srp(otg); |
204 | } | 227 | } |
205 | 228 | ||
229 | /* notifiers */ | ||
230 | static inline int | ||
231 | otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | ||
232 | { | ||
233 | return blocking_notifier_chain_register(&otg->notifier, nb); | ||
234 | } | ||
235 | |||
236 | static inline void | ||
237 | otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | ||
238 | { | ||
239 | blocking_notifier_chain_unregister(&otg->notifier, nb); | ||
240 | } | ||
206 | 241 | ||
207 | /* for OTG controller drivers (and maybe other stuff) */ | 242 | /* for OTG controller drivers (and maybe other stuff) */ |
208 | extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); | 243 | extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); |