Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8369b8f1 authored by Jack Pham's avatar Jack Pham Committed by Gerrit - the friendly Code Review server
Browse files

usb: phy: hsusb: Add optional VDDCX regulator



When a charger connected, the PHY will currently keep
its VDD regulator vote at the nominal voltage. However,
on some SOCs this may not be sufficient to prevent the
system from entering VDD minimized state. In those cases
the separate VDDCX rail must also be kept at the nominal
voltage. Support this by adding an optional vddcx supply.

Change-Id: I7a18d8c484ac82acdc0038c851a70102661d8a12
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 2e5123a1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ Optional properties:
		    offer additional control apart from the QSCRATCH registers.
		    These handle functions such as controlling the internal
		    reference clock buffer and powering on/off the entire PHY.

 - vddcx-supply: phandle to VDDCX regulator powering digital circuitry
 - qcom,hsphy-init: Init value used to override HSPHY parameters into
   QSCRATCH register. This 32-bit value represents parameters as follows:
		bits 0-5   PARAMETER_OVERRIDE_A
+25 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ struct msm_hsphy {
	bool			sleep_clk_reset;

	struct regulator	*vdd;
	struct regulator	*vddcx;
	struct regulator	*vdda33;
	struct regulator	*vdda18;
	int			vdd_levels[3]; /* none, low, high */
@@ -170,6 +171,10 @@ static int msm_hsusb_config_vdd(struct msm_hsphy *phy, int high)
		return ret;
	}

	if (phy->vddcx)
		regulator_set_voltage(phy->vddcx, phy->vdd_levels[min],
					phy->vdd_levels[2]);

	dev_dbg(phy->phy.dev, "%s: min_vol:%d max_vol:%d\n", __func__,
		phy->vdd_levels[min], phy->vdd_levels[2]);

@@ -796,6 +801,15 @@ static int msm_hsphy_probe(struct platform_device *pdev)
		goto err_ret;
	}

	if (of_get_property(dev->of_node, "vddcx-supply", NULL)) {
		phy->vddcx = devm_regulator_get(dev, "vddcx");
		if (IS_ERR(phy->vddcx)) {
			dev_err(dev, "unable to get vddcx supply\n");
			ret = PTR_ERR(phy->vddcx);
			goto err_ret;
		}
	}

	phy->vdda33 = devm_regulator_get(dev, "vdda33");
	if (IS_ERR(phy->vdda33)) {
		dev_err(dev, "unable to get vdda33 supply\n");
@@ -821,6 +835,13 @@ static int msm_hsphy_probe(struct platform_device *pdev)
		dev_err(dev, "unable to enable the hsusb vdd_dig\n");
		goto unconfig_hs_vdd;
	}
	if (phy->vddcx) {
		ret = regulator_enable(phy->vddcx);
		if (ret) {
			dev_err(dev, "unable to enable vddcx\n");
			goto unconfig_hs_vdd;
		}
	}

	ret = msm_hsusb_ldo_enable(phy, 1);
	if (ret) {
@@ -894,6 +915,8 @@ disable_clk:
disable_hs_ldo:
	msm_hsusb_ldo_enable(phy, 0);
disable_hs_vdd:
	if (phy->vddcx)
		regulator_disable(phy->vddcx);
	regulator_disable(phy->vdd);
unconfig_hs_vdd:
	msm_hsusb_config_vdd(phy, 0);
@@ -915,6 +938,8 @@ static int msm_hsphy_remove(struct platform_device *pdev)
	if (phy->vdda_force_on)
		msm_hsusb_ldo_enable(phy, 0);
	msm_hsusb_ldo_enable(phy, 0);
	if (phy->vddcx)
		regulator_disable(phy->vddcx);
	regulator_disable(phy->vdd);
	msm_hsusb_config_vdd(phy, 0);
	if (!phy->suspended)