]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ARM: tegra: usb: keep usb vdd regulator on
authorRakesh Bodla <rbodla@nvidia.com>
Mon, 30 Jul 2012 09:46:18 +0000 (15:16 +0530)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 19:15:13 +0000 (12:15 -0700)
Adding the conditions during which USB vdd
regulator should be kept ON.

Bug 1024425
Bug 1012078
Bug 1018538

Change-Id: I3319c91ecc02891ea4467f73be2b84a3817dab36
Signed-off-by: Rakesh Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/119279
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Rebase-Id: R201d48f28aa1a592959ab034498cb4c1a732533e

drivers/usb/phy/phy-tegra-usb.c

index 34f6c903e67c04016549417ba223d268e4db99d3..24ab619979f3834d80839cd25e2db1b0dbfae944 100644 (file)
@@ -150,7 +150,7 @@ static irqreturn_t usb_phy_dev_vbus_pmu_irq_thr(int irq, void *pdata)
 
        if (phy->vdd_reg && !phy->vdd_reg_on) {
                regulator_enable(phy->vdd_reg);
-               phy->vdd_reg_on = 1;
+               phy->vdd_reg_on = true;
                /*
                 * Optimal time to get the regulator turned on
                 * before detecting vbus interrupt.
@@ -328,26 +328,30 @@ int tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
        clk_disable_unprepare(phy->sys_clk);
        if (phy->pdata->op_mode == TEGRA_USB_OPMODE_HOST) {
                if (!phy->pdata->u_data.host.hot_plug &&
-                       !phy->pdata->u_data.host.remote_wakeup_supported)
+                       !phy->pdata->u_data.host.remote_wakeup_supported) {
                        clk_disable_unprepare(phy->ctrlr_clk);
+                       phy->ctrl_clk_on = false;
+                       if (phy->vdd_reg && phy->vdd_reg_on) {
+                               regulator_disable(phy->vdd_reg);
+                               phy->vdd_reg_on = false;
+                       }
+               }
        } else {
-               /* In device mode clock is turned on by pmu irq handler
-                * if pmu irq is not available clocks will not be turned off/on
+               /* In device mode clock regulator/clocks will be turned off
+                * only if pmu interrupt is present on the board and host mode
+                * support through OTG is supported on the board.
                 */
-               if (phy->pdata->u_data.dev.vbus_pmu_irq) {
+               if (phy->pdata->u_data.dev.vbus_pmu_irq &&
+                       phy->pdata->builtin_host_disabled) {
                        clk_disable_unprepare(phy->ctrlr_clk);
                        phy->ctrl_clk_on = false;
+                       if (phy->vdd_reg && phy->vdd_reg_on) {
+                               regulator_disable(phy->vdd_reg);
+                               phy->vdd_reg_on = false;
+                       }
                }
        }
 
-#ifndef CONFIG_ARCH_TEGRA_2x_SOC
-       if (phy->vdd_reg && phy->vdd_reg_on)
-               if (phy->pdata->has_hostpc || phy->pdata->builtin_host_disabled) {
-                       regulator_disable(phy->vdd_reg);
-                       phy->vdd_reg_on = false;
-       }
-#endif
-
        phy->phy_power_on = false;
 
        return err;