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

Commit 653e9abc authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb5-lib: Report NOT_CHARGING in over voltage condition"

parents 9f6b4236 5f46dd69
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1983,6 +1983,22 @@ int smblib_get_prop_batt_status(struct smb_charger *chg,
		}
	}

	rc = smblib_get_prop_batt_health(chg, &pval);
	if (rc < 0) {
		smblib_err(chg, "Couldn't get batt health rc=%d\n", rc);
		return rc;
	}
	/*
	 * The charger status register shows charging even though the battery
	 * is discharging when the over voltage condition is hit. Report power
	 * supply state as NOT_CHARGING when the battery health reports
	 * over voltage.
	 */
	if (pval.intval == POWER_SUPPLY_HEALTH_OVERVOLTAGE) {
		val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
		return 0;
	}

	if (chg->dbc_usbov) {
		rc = smblib_get_prop_usb_present(chg, &pval);
		if (rc < 0) {