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

Commit 3d22f4b1 authored by Ashay Jaiswal's avatar Ashay Jaiswal
Browse files

power: smb-lib: fix OTG enable error handling



Fix OTG enable error path and drop stale votes
on USB_ICL votable.

Change-Id: Ia0fce0ef75bb83ece72cc6a5a8f294b2500a0166
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent 5c1f0d88
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -687,6 +687,7 @@ static void smblib_uusb_removal(struct smb_charger *chg)
	vote(chg->pl_enable_votable_indirect, USBIN_I_VOTER, false, 0);
	vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0);
	vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0);
	vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, false, 0);

	cancel_delayed_work_sync(&chg->hvdcp_detect_work);

@@ -1469,6 +1470,8 @@ int smblib_vbus_regulator_enable(struct regulator_dev *rdev)
	rc = _smblib_vbus_regulator_enable(rdev);
	if (rc >= 0)
		chg->otg_en = true;
	else
		vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, false, 0);

unlock:
	mutex_unlock(&chg->otg_oc_lock);
@@ -4046,6 +4049,7 @@ static void smblib_handle_typec_removal(struct smb_charger *chg)
	vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0);
	vote(chg->awake_votable, PL_DELAY_VOTER, false, 0);

	vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, false, 0);
	chg->vconn_attempts = 0;
	chg->otg_attempts = 0;
	chg->pulse_cnt = 0;