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

Commit 51ac4386 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: fg-util: Notify FCC and FV to charger only if they're valid



Float voltage (FV) and Fast charging current (FCC) for a battery
is specified under the battery profile device tree. This is read
by the FG driver and notified to the charger driver. If these
parameters are not specified, then they're initialized to -EINVAL
currently. Do not notify these negative numbers to charger driver
which can affect charging parameters.

CRs-Fixed: 2306551
Change-Id: Ib7f6a941a264f154786ef239c6d02a7f8e0fcded
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 47cb4b24
Loading
Loading
Loading
Loading
+19 −16
Original line number Diff line number Diff line
@@ -353,6 +353,7 @@ void fg_notify_charger(struct fg_dev *fg)
	if (!fg->profile_available)
		return;

	if (fg->bp.float_volt_uv > 0) {
		prop.intval = fg->bp.float_volt_uv;
		rc = power_supply_set_property(fg->batt_psy,
				POWER_SUPPLY_PROP_VOLTAGE_MAX, &prop);
@@ -361,17 +362,19 @@ void fg_notify_charger(struct fg_dev *fg)
				rc);
			return;
		}
	}

	if (fg->bp.fastchg_curr_ma > 0) {
		prop.intval = fg->bp.fastchg_curr_ma * 1000;
		rc = power_supply_set_property(fg->batt_psy,
			POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX, &prop);
				POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
				&prop);
		if (rc < 0) {
			pr_err("Error in setting constant_charge_current_max property on batt_psy, rc=%d\n",
				rc);
			return;
		}

	fg_dbg(fg, FG_STATUS, "Notified charger on float voltage and FCC\n");
	}
}

bool batt_psy_initialized(struct fg_dev *fg)