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

Commit 09a81ac8 authored by Jack Pham's avatar Jack Pham
Browse files

usb: phy: msm-hsusb: Add workaround to keep LDOs on during LPM



There is a known HW issue on some targets that results in current
leakage through the PicoPHY if the VDD rail is ~1V and both the
1.8V and 3.1V rails are collapsed.

The recommended workaround is to leave the 1.8V/3.1V rails ON when
entering low power mode. Since the regulator enable() and disable()
calls are reference counted, this is easily done by making an
additional call to regulator_enable() to ensure the refcount is
nonzero. Add a device tree flag to enable this workaround.

Finally when the VDD voltage is minimized to its retention level
(~0.5 V) only then will the analog LDOs be allowed to be collapsed
to 0V as there will not be any leakage through the PHY. This case
specifically will be handled by the power management firmware in
order to achieve maximal power savings.

Change-Id: I6c2bee2ef93a15773365478ff9e09d92aa6b82dd
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 54627cf6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ Optional properties:
   If omitted, defaults to 1
 - qcom,sleep-clk-reset: If present, the HSUSB PHY sleep clock supports the clk_reset
   operation, and should be called during initialization.
 - qcom,vdda-force-on: If present, HW requires a workaround that forces 1.8V and 3.1V
		       regulator supplies to be left on even when PHY enters into
		       low power mode.

Example:
	hsphy@f9200000 {
		compatible = "qcom,usb-hsphy";
+19 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ struct msm_hsphy {
	int			vdd_levels[3]; /* none, low, high */
	u32			lpm_flags;
	bool			suspended;
	bool			vdda_force_on;

	/* Using external VBUS/ID notification */
	bool			ext_vbus_id;
@@ -854,6 +855,20 @@ static int msm_hsphy_probe(struct platform_device *pdev)
	phy->set_pllbtune = of_property_read_bool(dev->of_node,
						 "qcom,set-pllbtune");

	/*
	 * If this workaround flag is enabled, the HW requires the 1.8 and 3.x
	 * regulators to be kept ON when entering suspend. The easiest way to
	 * do that is to call regulator_enable() an additional time here,
	 * since it will keep the regulators' reference counts nonzero.
	 */
	phy->vdda_force_on = of_property_read_bool(dev->of_node,
						"qcom,vdda-force-on");
	if (phy->vdda_force_on) {
		ret = msm_hsusb_ldo_enable(phy, 1);
		if (ret)
			goto disable_clk;
	}

	platform_set_drvdata(pdev, phy);

	if (of_property_read_bool(dev->of_node, "qcom,vbus-valid-override"))
@@ -895,6 +910,10 @@ static int msm_hsphy_remove(struct platform_device *pdev)

	usb_remove_phy(&phy->phy);
	clk_disable_unprepare(phy->sleep_clk);

	/* Undo the additional regulator enable */
	if (phy->vdda_force_on)
		msm_hsusb_ldo_enable(phy, 0);
	msm_hsusb_ldo_enable(phy, 0);
	regulator_disable(phy->vdd);
	msm_hsusb_config_vdd(phy, 0);