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

Commit 158a1a05 authored by Fenglin Wu's avatar Fenglin Wu Committed by Guru Das Srinagesh
Browse files

power: smb5: Limit ICL to 1A before bumping QC2 voltage



Set ICL to 1A before bumping QC2 voltage and restore ICL after the
voltage changed. This helps to avoid VBUS collapse on some weak QC2
charger adapters.

CRs-Fixed: 2353627
Change-Id: I7d14ca8786c74ce8bf058776b11c2d713b4ca1b7
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent ca6f898b
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1037,6 +1037,7 @@ static void smblib_uusb_removal(struct smb_charger *chg)
	vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0);
	vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true, SDP_100_MA);
	vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0);
	vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0);

	/* Remove SW thermal regulation WA votes */
	vote(chg->usb_icl_votable, SW_THERM_REGULATION_VOTER, false, 0);
@@ -2191,6 +2192,7 @@ static void smblib_hvdcp_adaptive_voltage_change(struct smb_charger *chg)
		}

		smblib_hvdcp_set_fsw(chg, stat & QC_2P0_STATUS_MASK);
		vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0);
	}

	if (chg->real_charger_type == POWER_SUPPLY_TYPE_USB_HVDCP_3) {
@@ -2290,8 +2292,12 @@ int smblib_dp_dm(struct smb_charger *chg, int val)
			break;
		}

		if (stat & QC_5V_BIT)
		if (stat & QC_5V_BIT) {
			/* Force 1A ICL before requesting higher voltage */
			vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER,
					true, 1000000);
			smblib_hvdcp_set_fsw(chg, QC_9V_BIT);
		}

		rc = smblib_force_vbus_voltage(chg, FORCE_9V_BIT);
		if (rc < 0)
@@ -2311,8 +2317,12 @@ int smblib_dp_dm(struct smb_charger *chg, int val)
			break;
		}

		if ((stat & QC_9V_BIT) || (stat & QC_5V_BIT))
		if ((stat & QC_9V_BIT) || (stat & QC_5V_BIT)) {
			/* Force 1A ICL before requesting higher voltage */
			vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER,
					true, 1000000);
			smblib_hvdcp_set_fsw(chg, QC_12V_BIT);
		}

		rc = smblib_force_vbus_voltage(chg, FORCE_12V_BIT);
		if (rc < 0)
@@ -4796,6 +4806,7 @@ static void typec_src_removal(struct smb_charger *chg)
	vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0);
	vote(chg->usb_icl_votable, OTG_VOTER, false, 0);
	vote(chg->usb_icl_votable, CTM_VOTER, false, 0);
	vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0);

	/* reset usb irq voters */
	vote(chg->usb_irq_enable_votable, PD_VOTER, false, 0);
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ enum print_reason {
#define SW_THERM_REGULATION_VOTER	"SW_THERM_REGULATION_VOTER"
#define JEITA_ARB_VOTER			"JEITA_ARB_VOTER"
#define MOISTURE_VOTER			"MOISTURE_VOTER"
#define HVDCP2_ICL_VOTER		"HVDCP2_ICL_VOTER"

#define BOOST_BACK_STORM_COUNT	3
#define WEAK_CHG_STORM_COUNT	8