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

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

Merge "qpnp-fg-gen3: Fix storing nominal capacity to actual capacity"

parents 6cc1473d 01109ac3
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -506,8 +506,7 @@ static int fg_get_cc_soc_sw(struct fg_chip *chip, int *val)
#define BATT_TEMP_DENR		1
static int fg_get_battery_temp(struct fg_chip *chip, int *val)
{
	int rc = 0;
	u16 temp = 0;
	int rc = 0, temp;
	u8 buf[2];

	rc = fg_read(chip, BATT_INFO_BATT_TEMP_LSB(chip), buf, 2);
@@ -925,10 +924,11 @@ static int fg_load_learned_cap_from_sram(struct fg_chip *chip)
	}

	chip->cl.learned_cc_uah = act_cap_mah * 1000;

	if (chip->cl.learned_cc_uah != chip->cl.nom_cap_uah) {
		if (chip->cl.learned_cc_uah == 0)
			chip->cl.learned_cc_uah = chip->cl.nom_cap_uah;

	if (chip->cl.learned_cc_uah != chip->cl.nom_cap_uah) {
		delta_cc_uah = abs(chip->cl.learned_cc_uah -
					chip->cl.nom_cap_uah);
		pct_nom_cap_uah = div64_s64((int64_t)chip->cl.nom_cap_uah *
+14 −3
Original line number Diff line number Diff line
@@ -1199,6 +1199,7 @@ int smblib_get_prop_batt_charge_type(struct smb_charger *chg,
int smblib_get_prop_batt_health(struct smb_charger *chg,
				union power_supply_propval *val)
{
	union power_supply_propval pval;
	int rc;
	u8 stat;

@@ -1212,10 +1213,20 @@ int smblib_get_prop_batt_health(struct smb_charger *chg,
		   stat);

	if (stat & CHARGER_ERROR_STATUS_BAT_OV_BIT) {
		smblib_err(chg, "battery over-voltage\n");
		rc = smblib_get_prop_batt_voltage_now(chg, &pval);
		if (!rc) {
			/*
			 * If Vbatt is within 40mV above Vfloat, then don't
			 * treat it as overvoltage.
			 */
			if (pval.intval >=
				get_effective_result(chg->fv_votable) + 40000) {
				val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
				smblib_err(chg, "battery over-voltage\n");
				goto done;
			}
		}
	}

	if (stat & BAT_TEMP_STATUS_TOO_COLD_BIT)
		val->intval = POWER_SUPPLY_HEALTH_COLD;