summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-05-16 16:08:12 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-05-16 16:08:12 -0700
commitc9c69ae5d8b7eecc42aa1f3fe7c1e0eb8909e01e (patch)
tree91c20e0f7b0726016fda14591d01769be640dbdd /drivers
parentd4d28cb0ef94e7088cf6a9bddbcbbc9c2581fd26 (diff)
parent1974aed8292dd68f8680d92411601b5a13f600db (diff)
Merge "usb: phy: qusb: Support specifying vdda33 levels from device tree"
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/phy/phy-msm-qusb-v2.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/usb/phy/phy-msm-qusb-v2.c b/drivers/usb/phy/phy-msm-qusb-v2.c
index 6fb91134b0c5..5df091a5454b 100644
--- a/drivers/usb/phy/phy-msm-qusb-v2.c
+++ b/drivers/usb/phy/phy-msm-qusb-v2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -90,6 +90,7 @@ struct qusb_phy {
struct regulator *vdda18;
struct regulator *vdda12;
int vdd_levels[3]; /* none, low, high */
+ int vdda33_levels[3];
int init_seq_len;
int *qusb_phy_init_seq;
int host_init_seq_len;
@@ -236,8 +237,8 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on,
goto disable_vdda18;
}
- ret = regulator_set_voltage(qphy->vdda33, QUSB2PHY_3P3_VOL_MIN,
- QUSB2PHY_3P3_VOL_MAX);
+ ret = regulator_set_voltage(qphy->vdda33, qphy->vdda33_levels[0],
+ qphy->vdda33_levels[2]);
if (ret) {
dev_err(qphy->phy.dev,
"Unable to set voltage for vdda33:%d\n", ret);
@@ -262,7 +263,7 @@ disable_vdda33:
dev_err(qphy->phy.dev, "Unable to disable vdda33:%d\n", ret);
unset_vdd33:
- ret = regulator_set_voltage(qphy->vdda33, 0, QUSB2PHY_3P3_VOL_MAX);
+ ret = regulator_set_voltage(qphy->vdda33, 0, qphy->vdda33_levels[2]);
if (ret)
dev_err(qphy->phy.dev,
"Unable to set (0) voltage for vdda33:%d\n", ret);
@@ -455,6 +456,15 @@ static int qusb_phy_init(struct usb_phy *phy)
if (ret)
return ret;
+ /* bump up vdda33 voltage to operating level*/
+ ret = regulator_set_voltage(qphy->vdda33, qphy->vdda33_levels[1],
+ qphy->vdda33_levels[2]);
+ if (ret) {
+ dev_err(qphy->phy.dev,
+ "Unable to set voltage for vdda33:%d\n", ret);
+ return ret;
+ }
+
qusb_phy_enable_clocks(qphy, true);
/* Perform phy reset */
@@ -1016,6 +1026,19 @@ static int qusb_phy_probe(struct platform_device *pdev)
return ret;
}
+ ret = of_property_read_u32_array(dev->of_node,
+ "qcom,vdda33-voltage-level",
+ (u32 *) qphy->vdda33_levels,
+ ARRAY_SIZE(qphy->vdda33_levels));
+ if (ret == -EINVAL) {
+ qphy->vdda33_levels[0] = QUSB2PHY_3P3_VOL_MIN;
+ qphy->vdda33_levels[1] = QUSB2PHY_3P3_VOL_MIN;
+ qphy->vdda33_levels[2] = QUSB2PHY_3P3_VOL_MAX;
+ } else if (ret) {
+ dev_err(dev, "error reading qcom,vdda33-voltage-level property\n");
+ return ret;
+ }
+
qphy->vdd = devm_regulator_get(dev, "vdd");
if (IS_ERR(qphy->vdd)) {
dev_err(dev, "unable to get vdd supply\n");