]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
usb: host: tegra: disble vbus while going to lp0
authorRohith Seelaboyina <rseelaboyina@nvidia.com>
Tue, 23 Apr 2013 13:15:49 +0000 (18:45 +0530)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 20:10:26 +0000 (13:10 -0700)
disable vbus while going to lp0

Bug 1274508

Change-Id: If0fc94193e17a797e3e76e01b9863141c46248f8
Signed-off-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Reviewed-on: http://git-master/r/221579
(cherry picked from commit ab1b447756b5a25d199a2fb71c6f27110737377b)
Reviewed-on: http://git-master/r/223342
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
drivers/usb/host/ehci-tegra.c

index 9d1f4a2cbd5adbb205bfe85b1a7c0764ed8f2066..cf9b8492667f69a7de0b7b7abbe3c6b6d63c3b94 100644 (file)
@@ -296,12 +296,16 @@ static void tegra_ehci_shutdown(struct usb_hcd *hcd)
 {
        struct ehci_hcd *ehci = hcd_to_ehci(hcd);
        struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
+       struct platform_device *pdev = to_platform_device(hcd->self.controller);
+       struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
        mutex_lock(&tegra->sync_lock);
        if (tegra_usb_phy_hw_accessible(tegra->phy)) {
                spin_lock_irq(&ehci->lock);
                ehci_silence_controller(ehci);
                spin_unlock_irq(&ehci->lock);
        }
+       if (pdata->port_otg)
+               tegra_usb_enable_vbus(tegra->phy, false);
        mutex_unlock(&tegra->sync_lock);
 }
 
@@ -592,19 +596,26 @@ fail_io:
 static int tegra_ehci_resume(struct platform_device *pdev)
 {
        struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
-
+       struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
+       if (pdata->u_data.host.turn_off_vbus_on_lp0 && pdata->port_otg)
+               tegra_usb_enable_vbus(tegra->phy, true);
        return usb_phy_set_suspend(get_usb_phy(tegra->phy), 0);
 }
 
 static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state)
 {
        struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
-
+       int err;
+       struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
        /* bus suspend could have failed because of remote wakeup resume */
        if (tegra->bus_suspended_fail)
                return -EBUSY;
-       else
-               return usb_phy_set_suspend(get_usb_phy(tegra->phy), 1);
+       else {
+               err = usb_phy_set_suspend(get_usb_phy(tegra->phy), 1);
+               if (pdata->u_data.host.turn_off_vbus_on_lp0 && pdata->port_otg)
+                       tegra_usb_enable_vbus(tegra->phy, false);
+               return err;
+       }
 }
 #endif