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

Commit a23c3310 authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Harry Yang
Browse files

power: smb-lib: Fix sink/source insertion/removal function ordering



On PM660 the charger buck/boost frequency is configured in
the same register. Present ordering of the sink/source
removal function call causes incorrect charger frequency
configuration.

Fix this by first calling sink_removal and then source_insertion
function. Also, configure the buck frequency to the initial
5V USB value during source insertion.

Change-Id: I0d436f7e0843f2ddaa3d09db05cec403d03b6893
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 21ae1575
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3581,6 +3581,8 @@ static void typec_source_insertion(struct smb_charger *chg)
		&& !is_client_vote_enabled(chg->usb_icl_votable, PD_VOTER)
		&& !is_client_vote_enabled(chg->usb_icl_votable, USB_PSY_VOTER))
		vote(chg->usb_icl_votable, LEGACY_UNKNOWN_VOTER, true, 100000);

	smblib_set_opt_freq_buck(chg, chg->chg_freq.freq_5V);
}

static void typec_sink_insertion(struct smb_charger *chg)
@@ -3656,8 +3658,8 @@ static void smblib_handle_typec_insertion(struct smb_charger *chg,
		typec_source_removal(chg);
		typec_sink_insertion(chg);
	} else {
		typec_source_insertion(chg);
		typec_sink_removal(chg);
		typec_source_insertion(chg);
	}

	rp = smblib_get_prop_ufp_mode(chg);