diff options
author | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2012-11-14 11:02:43 +0100 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2012-11-14 11:02:43 +0100 |
commit | b938ada0cc3cfe20c7f0a5ddc2a9cb5ff6e6d673 (patch) | |
tree | 1db9a3deb5cbe25344b7fe616e756e0e5a04fceb /drivers | |
parent | 58d8976f2b8482eba2a0368a6b9989eaf7f882dd (diff) |
usb: otg: colibri_t20: notify USB events to otg core
Notify USB connection events to otg core. These notifications will be
used by drivers (e.g. otg wakelock driver) who registered for the
events.
See a4c597152f0b69ba1172b3d52d4e9d39ea3bbd53.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/otg/colibri-otg.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/usb/otg/colibri-otg.c b/drivers/usb/otg/colibri-otg.c index edcac80c9d79..54d792536363 100644 --- a/drivers/usb/otg/colibri-otg.c +++ b/drivers/usb/otg/colibri-otg.c @@ -70,6 +70,13 @@ void tegra_stop_host(struct colibri_otg_data *tegra) } } +static void tegra_otg_notify_event(struct otg_transceiver *otg, + enum usb_xceiv_events event) +{ + otg->last_event = event; + atomic_notifier_call_chain(&otg->notifier, event, NULL); +} + static void irq_work(struct work_struct *work) { struct colibri_otg_data *tegra = @@ -98,14 +105,21 @@ static void irq_work(struct work_struct *work) tegra_state_name(from), tegra_state_name(to)); if (to == OTG_STATE_B_PERIPHERAL) { - if (from == OTG_STATE_A_HOST) + if (from == OTG_STATE_A_HOST) { tegra_stop_host(tegra); - if (otg->gadget) + tegra_otg_notify_event(otg, USB_EVENT_NONE); + } + if (otg->gadget) { usb_gadget_vbus_connect(otg->gadget); + tegra_otg_notify_event(otg, USB_EVENT_VBUS); + } } else if (to == OTG_STATE_A_HOST) { - if (otg->gadget && (from == OTG_STATE_B_PERIPHERAL)) + if (otg->gadget && (from == OTG_STATE_B_PERIPHERAL)) { usb_gadget_vbus_disconnect(otg->gadget); + tegra_otg_notify_event(otg, USB_EVENT_NONE); + } tegra_start_host(tegra); + tegra_otg_notify_event(otg, USB_EVENT_ID); } } } |