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

Commit 12f7b726 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "qcom: battery: update FCC split policy"

parents 6c3c83f4 c7926154
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@

struct pl_data {
	int			pl_mode;
	int			pl_batfet_mode;
	int			slave_pct;
	int			slave_fcc_ua;
	int			restricted_current;
@@ -367,11 +368,11 @@ static void get_fcc_split(struct pl_data *chip, int total_ua,
	*slave_ua = (slave_limited_ua * chip->slave_pct) / 100;

	/*
	 * In USBIN_USBIN configuration with internal rsense parallel
	 * charger's current goes through main charger's BATFET, keep
	 * the main charger's FCC to the votable result.
	 * In stacked BATFET configuration charger's current goes
	 * through main charger's BATFET, keep the main charger's FCC
	 * to the votable result.
	 */
	if (chip->pl_mode == POWER_SUPPLY_PL_USBIN_USBIN)
	if (chip->pl_batfet_mode == POWER_SUPPLY_PL_STACKED_BATFET)
		*master_ua = max(0, total_ua);
	else
		*master_ua = max(0, total_ua - *slave_ua);
@@ -860,6 +861,15 @@ static bool is_parallel_available(struct pl_data *chip)
			return false;
	}

	rc = power_supply_get_property(chip->pl_psy,
		       POWER_SUPPLY_PROP_PARALLEL_BATFET_MODE, &pval);
	if (rc < 0) {
		pr_err("Couldn't get parallel batfet mode rc=%d\n",
				rc);
		return false;
	}
	chip->pl_batfet_mode = pval.intval;

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

	return true;