aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@nokia.com>2009-12-17 06:01:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-03-02 17:53:21 -0500
commite9a20171dfa0aa134d2211126d1310f2daea52cf (patch)
tree15f03c9ff4428969d3de55b1ad465074c8fd4cd0 /include
parent8bc1d21776bb012e41ed062c6d842cfe7c82998a (diff)
USB: otg: add notifier support
The notifier will be used to communicate usb events to other drivers like the charger chip. This can be used as source of information to kick usb charger detection as described by the USB Battery Charging Specification 1.1 and/or to pass bMaxPower field of selected usb_configuration to charger chip in order to use that information as input current on the charging profile setup. Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/usb/otg.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 52bb917641f0..6c0b676b27d8 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 */
13enum usb_otg_state { 15enum 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
38enum 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;
@@ -203,6 +216,18 @@ otg_start_srp(struct otg_transceiver *otg)
203 return otg->start_srp(otg); 216 return otg->start_srp(otg);
204} 217}
205 218
219/* notifiers */
220static inline int
221otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
222{
223 return blocking_notifier_chain_register(&otg->notifier, nb);
224}
225
226static inline void
227otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
228{
229 blocking_notifier_chain_unregister(&otg->notifier, nb);
230}
206 231
207/* for OTG controller drivers (and maybe other stuff) */ 232/* for OTG controller drivers (and maybe other stuff) */
208extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 233extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);