aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorSakethram Bommisetti <sakethram.bommisetti@stericsson.com>2013-04-03 10:45:13 +0200
committerFelipe Balbi <balbi@ti.com>2013-04-03 12:03:07 +0300
commit588233733804aeaf16335a32904aaa4d15b9bddd (patch)
treec84b6cda92bce78d6b027cb0e76b4715ca208e89 /drivers/usb/phy
parent8db12231bccc5ebf414b267af68c5a8c1e4432dd (diff)
usb: phy: ab8500-usb: call phy_dis_work only when necessary
Modify ab8500_usb_set_peripheral() and ab8500_usb_set_host() code to schedule phy_dis_work only when necessary in order to prevent regulator count mismatch during reboot/shutdown. Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy-ab8500-usb.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index a1c103fc26e..749614cf6e2 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -614,17 +614,16 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg,
ab = phy_to_ab(otg->phy);
+ ab->phy.otg->gadget = gadget;
+
/* Some drivers call this function in atomic context.
* Do not update ab8500 registers directly till this
* is fixed.
*/
- if (!gadget) {
- otg->gadget = NULL;
+ if ((ab->mode != USB_IDLE) && (!gadget)) {
+ ab->mode = USB_IDLE;
schedule_work(&ab->phy_dis_work);
- } else {
- otg->gadget = gadget;
- otg->phy->state = OTG_STATE_B_IDLE;
}
return 0;
@@ -639,16 +638,16 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
ab = phy_to_ab(otg->phy);
+ ab->phy.otg->host = host;
+
/* Some drivers call this function in atomic context.
* Do not update ab8500 registers directly till this
* is fixed.
*/
- if (!host) {
- otg->host = NULL;
+ if ((ab->mode != USB_IDLE) && (!host)) {
+ ab->mode = USB_IDLE;
schedule_work(&ab->phy_dis_work);
- } else {
- otg->host = host;
}
return 0;