summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/usb_phy.c
diff options
context:
space:
mode:
authorRohan Somvanshi <rsomvanshi@nvidia.com>2012-07-04 10:43:10 +0000
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-07-05 07:40:49 -0700
commit4df8c74291952f18d43fb608290db0ce7cc27d42 (patch)
tree0b13c11d9d741302e7952235ca9f148c657a5310 /arch/arm/mach-tegra/usb_phy.c
parent66ff68bcb9a2f5e5a110907f5c91f1cd2a2792c3 (diff)
ARM: tegra: usb: turn off power during suspend
Turn off regulators along with clocks during suspend Bug 991262 Reviewed-on: http://git-master/r/108820 (cherry picked from commit 41ae7ac21a2c08da0e4312b8395b380a704fa16c) Change-Id: Ib49eec5d91571d75881f4d252d956dece1d37d60 Signed-off-by: Rakesh Bodla <rbodla@nvidia.com> Reviewed-on: http://git-master/r/105364 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'arch/arm/mach-tegra/usb_phy.c')
-rw-r--r--arch/arm/mach-tegra/usb_phy.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index b072283da294..f6e64f08c30a 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -2,7 +2,7 @@
* arch/arm/mach-tegra/usb_phy.c
*
* Copyright (C) 2010 Google, Inc.
- * Copyright (C) 2010 - 2011 NVIDIA Corporation
+ * Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved.
*
* Author:
* Erik Gilling <konkers@google.com>
@@ -32,6 +32,7 @@
#include <linux/platform_data/tegra_usb.h>
#include "tegra_usb_phy.h"
#include <mach/iomap.h>
+#include <fuse.h>
#define ERR(stuff...) pr_err("usb_phy: " stuff)
#define WARNING(stuff...) pr_warning("usb_phy: " stuff)
@@ -133,6 +134,16 @@ static irqreturn_t usb_phy_dev_vbus_pmu_irq_thr(int irq, void *pdata)
{
struct tegra_usb_phy *phy = pdata;
+ if (phy->vdd_reg && !phy->vdd_reg_on) {
+ regulator_enable(phy->vdd_reg);
+ phy->vdd_reg_on = 1;
+ /*
+ * Optimal time to get the regulator turned on
+ * before detecting vbus interrupt.
+ */
+ mdelay(15);
+ }
+
/* clk is disabled during phy power off and not here*/
if (!phy->ctrl_clk_on) {
clk_enable(phy->ctrlr_clk);
@@ -339,9 +350,6 @@ struct tegra_usb_phy *tegra_usb_phy_open(struct platform_device *pdev)
}
}
- if (phy->vdd_reg)
- regulator_enable(phy->vdd_reg);
-
return phy;
fail_init:
@@ -405,7 +413,6 @@ void tegra_usb_phy_close(struct tegra_usb_phy *phy)
}
if (phy->vdd_reg) {
- regulator_disable(phy->vdd_reg);
regulator_put(phy->vdd_reg);
}
@@ -473,6 +480,18 @@ int tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
}
}
+ if (phy->vdd_reg && phy->vdd_reg_on) {
+#ifndef CONFIG_ARCH_TEGRA_2x_SOC
+ regulator_disable(phy->vdd_reg);
+ phy->vdd_reg_on = false;
+#else
+ if (tegra_get_revision() >= TEGRA_REVISION_A03) {
+ regulator_disable(phy->vdd_reg);
+ phy->vdd_reg_on = false;
+ }
+#endif
+ }
+
phy->phy_power_on = false;
return err;
@@ -487,6 +506,11 @@ int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
if (phy->phy_power_on)
return status;
+ if (phy->vdd_reg && !phy->vdd_reg_on) {
+ regulator_enable(phy->vdd_reg);
+ phy->vdd_reg_on = true;
+ }
+
/* In device mode clock is turned on by pmu irq handler
* if pmu irq is not available clocks will not be turned off/on
*/