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

Commit 8b223833 authored by Harry Yang's avatar Harry Yang
Browse files

power: smb5-lib: Suspend USBIN once moisture detected



Currently, when moisture is detected, all SW does is simply put to
sink mode to prevent fast erosion on CC pins.

There are other concerns with charging safety on phone with moisture, like
observable charger type mis-detections and possible input current overdraw,
etc.

Address it by suspending USBIN (hence charging will be disabled)
on moisture detection.

Change-Id: Ia6092f75c1a5f511e415454d2737024ab62d6072
Signed-off-by: default avatarHarry Yang <harryy@codeaurora.org>
parent 2ff59c37
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5432,6 +5432,7 @@ static bool smblib_src_lpd(struct smb_charger *chg)
				pval.intval, rc);
		chg->lpd_reason = LPD_MOISTURE_DETECTED;
		chg->moisture_present =  true;
		vote(chg->usb_icl_votable, LPD_VOTER, true, 0);
		alarm_start_relative(&chg->lpd_recheck_timer,
						ms_to_ktime(60000));
		power_supply_changed(chg->usb_psy);
@@ -5568,6 +5569,7 @@ static void typec_src_removal(struct smb_charger *chg)
	vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0);
	vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0);
	vote(chg->usb_icl_votable, THERMAL_THROTTLE_VOTER, false, 0);
	vote(chg->usb_icl_votable, LPD_VOTER, false, 0);

	/* reset usb irq voters */
	vote(chg->limited_irq_disable_votable, CHARGER_TYPE_VOTER,
@@ -6928,6 +6930,7 @@ static void smblib_lpd_ra_open_work(struct work_struct *work)

		chg->lpd_reason = LPD_MOISTURE_DETECTED;
		chg->moisture_present =  true;
		vote(chg->usb_icl_votable, LPD_VOTER, true, 0);

	} else {
		/* Floating cable, disable water detection irq temporarily */