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

Commit 833fba97 authored by Guru Das Srinagesh's avatar Guru Das Srinagesh Committed by Umang Agrawal
Browse files

qcom: battery: Modify FCC split logic to use slave's limit



Currently, the parallel (slave) charger's share of FCC is limited by
only the BCL. Since SMB1354 can only supply a max of 2.5A FCC, this can
result in a "loss" of current in situations where it is allocated > 2.5A
of current as a result of the existing FCC split logic.

For example, if the SMB1354 is allocated 3A, the total FCC (main +
charger) will be short by 0.5A (3 - 2.5) because of the charger's FCC
limit.

Therefore, modify FCC split logic to use the parallel charger's FCC
limit to further restrict parallel's portion of FCC. This will ensure
that any current that exceeds 2.5A will be part of the main's share.

CRs-Fixed: 2170280
Change-Id: I01cd13d509a37963370c4dc2c815500fd1e821b9
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
Signed-off-by: default avatarUmang Agrawal <uagrawal@codeaurora.org>
parent fb86f293
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ struct pl_data {
	int			charge_type;
	int			total_settled_ua;
	int			pl_settled_ua;
	int			pl_fcc_max;
	u32			wa_flags;
	struct class		qcom_batt_class;
	struct wakeup_source	*pl_ws;
@@ -426,6 +427,7 @@ static void get_fcc_split(struct pl_data *chip, int total_ua,
	effective_total_ua = max(0, total_ua + hw_cc_delta_ua);
	slave_limited_ua = min(effective_total_ua, bcl_ua);
	*slave_ua = (slave_limited_ua * chip->slave_pct) / 100;
	*slave_ua = min(*slave_ua, chip->pl_fcc_max);

	/*
	 * In stacked BATFET configuration charger's current goes
@@ -943,6 +945,12 @@ static bool is_parallel_available(struct pl_data *chip)
					&pval);
	chip->pl_min_icl_ua = pval.intval;

	chip->pl_fcc_max = INT_MAX;
	rc = power_supply_get_property(chip->pl_psy,
			POWER_SUPPLY_PROP_PARALLEL_FCC_MAX, &pval);
	if (!rc)
		chip->pl_fcc_max = pval.intval;

	vote(chip->pl_disable_votable, PARALLEL_PSY_VOTER, false, 0);

	return true;