summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/usb_phy.c
diff options
context:
space:
mode:
authorRakesh Bodla <rbodla@nvidia.com>2012-07-30 15:16:18 +0530
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-07-31 03:48:44 -0700
commit2c752ad14af6316048bf8f06a170445f8e5f01a4 (patch)
tree3d44717647e287f957f81caf76d47acf7c5a1662 /arch/arm/mach-tegra/usb_phy.c
parentb4e9ece3b32afea9ca8d761c285fc9bc4c70b967 (diff)
ARM: tegra: usb: keep usb vdd regulator on
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>
Diffstat (limited to 'arch/arm/mach-tegra/usb_phy.c')
-rw-r--r--arch/arm/mach-tegra/usb_phy.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index 00a44dd2536c..80a3337e58fe 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -136,7 +136,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.
@@ -469,25 +469,30 @@ int tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
clk_disable(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(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(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;
+ }
}
}
- 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;
- }
-
phy->phy_power_on = false;
return err;