]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
usb: otg: tegra: Acquire temopary wakelock
authorRohith Seelaboyina <rseelaboyina@nvidia.com>
Fri, 13 Sep 2013 09:40:47 +0000 (15:10 +0530)
committerAjay Nandakumar <anandakumarm@nvidia.com>
Tue, 1 Oct 2013 08:35:05 +0000 (14:05 +0530)
Acquire temporary wakelock to resume roothub
in the case when interrupt is seen and otg port is in
host mode and bus is suspended and device is entering lp0.

Bug 1341131

Change-Id: If206756624fb89544c53a34ae934ed6c581fe5e8
Signed-off-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Reviewed-on: http://git-master/r/274260
(cherry picked from commit ab586818b5e23fccec89d1b1aa4865a8dc0df1d3)
Reviewed-on: http://git-master/r/274342
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
(cherry picked from commit d76cb524887a1cadf79f62510a1aa57153bbc3d4)
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
drivers/usb/phy/tegra-otg.c

index 0930ea0b184c2ee7789c4839c3348f97b6543458..f05d37024f7d05cc4662586906f808822ea58d1b 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/extcon.h>
 #include <linux/gpio.h>
 #include <linux/regulator/consumer.h>
+#include <linux/usb/hcd.h>
 
 #include <mach/pm_domains.h>
 #include <mach/tegra_usb_pad_ctrl.h>
@@ -422,6 +423,8 @@ static irqreturn_t tegra_otg_irq(int irq, void *data)
        struct tegra_otg *tegra = data;
        unsigned long flags;
        unsigned long val;
+       struct usb_hcd *hcd = bus_to_hcd(tegra->phy.otg->host);
+       enum usb_otg_state state = tegra->phy.state;
 
        spin_lock_irqsave(&tegra->lock, flags);
        val = otg_readl(tegra, USB_PHY_WAKEUP);
@@ -436,6 +439,14 @@ static irqreturn_t tegra_otg_irq(int irq, void *data)
                        schedule_work(&tegra->work);
                }
        }
+
+       /* Re-acquire wakelock to service the device connected */
+       /* Abort the suspend */
+
+       if (state == OTG_STATE_A_HOST) {
+               if (hcd && hcd->state == HC_STATE_SUSPENDED)
+                       tegra_otg_notify_event(tegra, USB_EVENT_ID);
+       }
        spin_unlock_irqrestore(&tegra->lock, flags);
 
        return IRQ_HANDLED;