diff options
author | Rakesh Bodla <rbodla@nvidia.com> | 2012-08-24 18:13:55 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-08-27 19:45:11 -0700 |
commit | a4c597152f0b69ba1172b3d52d4e9d39ea3bbd53 (patch) | |
tree | f553ef17c9b1cddd7e4be03a4a01440af0ad61b0 /drivers/usb | |
parent | 3745839f5f25ac8de101827813bf305476033d35 (diff) |
usb: otg: tegra: 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.
Bug 1031034
Bug 976849
Change-Id: I3655071af9226e3aef385681fcabc94b9def4233
Signed-off-by: Rakesh Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/127137
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Courbot <acourbot@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/otg/tegra-otg.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/usb/otg/tegra-otg.c b/drivers/usb/otg/tegra-otg.c index 9d614cb78570..22e303ede24e 100644 --- a/drivers/usb/otg/tegra-otg.c +++ b/drivers/usb/otg/tegra-otg.c @@ -182,6 +182,12 @@ static void tegra_stop_host(struct tegra_otg_data *tegra) DBG("%s(%d) End\n", __func__, __LINE__); } +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 tegra_change_otg_state(struct tegra_otg_data *tegra, enum usb_otg_state to) @@ -203,16 +209,24 @@ static void tegra_change_otg_state(struct tegra_otg_data *tegra, tegra_state_name(to)); if (from == OTG_STATE_A_SUSPEND) { - if (to == OTG_STATE_B_PERIPHERAL && otg->gadget) + if (to == OTG_STATE_B_PERIPHERAL && otg->gadget) { usb_gadget_vbus_connect(otg->gadget); - else if (to == OTG_STATE_A_HOST) + tegra_otg_notify_event(otg, USB_EVENT_VBUS); + } + else if (to == OTG_STATE_A_HOST) { tegra_start_host(tegra); + tegra_otg_notify_event(otg, USB_EVENT_ID); + } } else if (from == OTG_STATE_A_HOST) { - if (to == OTG_STATE_A_SUSPEND) + if (to == OTG_STATE_A_SUSPEND) { tegra_stop_host(tegra); + tegra_otg_notify_event(otg, USB_EVENT_NONE); + } } else if (from == OTG_STATE_B_PERIPHERAL && otg->gadget) { - if (to == OTG_STATE_A_SUSPEND) + if (to == OTG_STATE_A_SUSPEND) { usb_gadget_vbus_disconnect(otg->gadget); + tegra_otg_notify_event(otg, USB_EVENT_NONE); + } } } } |