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

Commit eb7e0fbb authored by Azhar Shaikh's avatar Azhar Shaikh
Browse files

usb: phy: msm-hsusb: Allow VDD MIN when DCP charger is connected



VDD and the analog rails are currently not getting turned off if a
charger is connected. This will cause additional power consumption
which can be an issue if the battery is fully charged and no longer
charging. Allow only VDD MIN, but not PHY retention in
msm_hsphy_set_suspend() when a charger is connected.

CRs-fixed: 752229
Change-Id: If27d8d7fd044a821d955cdeb3b3d004a786cfdee
Signed-off-by: default avatarAzhar Shaikh <azhars@codeaurora.org>
parent 2172a6ec
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
@@ -490,12 +490,17 @@ static int msm_hsphy_set_suspend(struct usb_phy *uphy, int suspend)
		}

		/* can turn off regulators if disconnected in device mode */
		if (phy->lpm_flags & PHY_RETENTIONED && !phy->cable_connected) {
			if (phy->ext_vbus_id) {
		if (phy->lpm_flags & PHY_RETENTIONED && !phy->cable_connected
				&& phy->ext_vbus_id) {
			msm_hsusb_ldo_enable(phy, 0);
			phy->lpm_flags |= PHY_PWR_COLLAPSED;
		}

		/* Minimize VDD if charger is connected */
		if ((phy->lpm_flags & PHY_RETENTIONED && !phy->cable_connected)
				|| chg_connected) {
			msm_hsusb_config_vdd(phy, 0);
			phy->lpm_flags |= PHY_VDD_MINIMIZED;
		}

		count = atomic_dec_return(&hsphy_active_count);
@@ -506,13 +511,17 @@ static int msm_hsphy_set_suspend(struct usb_phy *uphy, int suspend)
		}
	} else {
		atomic_inc(&hsphy_active_count);
		if (phy->lpm_flags & PHY_RETENTIONED && !phy->cable_connected) {
		if (phy->lpm_flags & PHY_VDD_MINIMIZED) {
			msm_hsusb_config_vdd(phy, 1);
			if (phy->ext_vbus_id) {
			phy->lpm_flags &= ~PHY_VDD_MINIMIZED;
		}

		if (phy->lpm_flags & PHY_PWR_COLLAPSED) {
			msm_hsusb_ldo_enable(phy, 1);
			phy->lpm_flags &= ~PHY_PWR_COLLAPSED;
		}

		if (phy->lpm_flags & PHY_RETENTIONED) {
			if (phy->csr) {
				/* power on PHY */
				msm_usb_write_readback(phy->csr,
+2 −1
Original line number Diff line number Diff line
@@ -525,6 +525,7 @@ struct msm_otg {
#define XO_SHUTDOWN			BIT(2)
#define CLOCKS_DOWN			BIT(3)
#define PHY_REGULATORS_LPM		BIT(4)
#define PHY_VDD_MINIMIZED		BIT(5)
	int reset_counter;
	unsigned long b_last_se0_sess;
	unsigned long tmouts;