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

Commit 379e5185 authored by Ashay Jaiswal's avatar Ashay Jaiswal Committed by Gerrit - the friendly Code Review server
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 aaf4841e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -669,6 +669,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);

@@ -1451,6 +1452,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);
@@ -3980,6 +3983,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;