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

Commit b12e1610 authored by Anirudh Ghayal's avatar Anirudh Ghayal Committed by Gerrit - the friendly Code Review server
Browse files

power: qg-soc: Allow SOC to increase only if we are charging



The current logic checks only for input presence to allow increase
in SOC. This check does not work well during hard JEITA conditions,
where input is present but device is not charging. Fix this
by making sure that we are indeed charging to allow SOC to scale up.

Change-Id: I649cbc136f404e44c78c6443d5586cbdeb0fd768
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent dac68980
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -159,6 +159,8 @@ static void get_next_update_time(struct qpnp_qg *chip)

static bool is_scaling_required(struct qpnp_qg *chip)
{
	bool input_present = is_input_present(chip);

	if (!chip->profile_loaded)
		return false;

@@ -175,10 +177,16 @@ static bool is_scaling_required(struct qpnp_qg *chip)
		return false;


	if (chip->catch_up_soc > chip->msoc && !is_input_present(chip))
	if (chip->catch_up_soc > chip->msoc && !input_present)
		/* input is not present and SOC has increased */
		return false;

	if (chip->catch_up_soc > chip->msoc && input_present &&
			(chip->charge_status != POWER_SUPPLY_STATUS_CHARGING &&
			chip->charge_status != POWER_SUPPLY_STATUS_FULL))
		/* USB is present, but not charging */
		return false;

	return true;
}