smb-lib: update displaying battery overvoltage in health property
Currently, smb2 charger is configured to not end the charging cycle when battery overvoltage occurs. However, when the battery overvoltage status is read, it will be displayed through health property. Improve this by reading the battery voltage and check whether it is within 40mV headroom above float voltage. If it is above that threshold then continue with displaying overvoltage status. CRs-Fixed: 1079363 Change-Id: I45847f446c91c80a5110d80b59a0ae4b8e2c40e5 Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
parent
b9c370a582
commit
f410c92004
1 changed files with 14 additions and 3 deletions
|
@ -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,9 +1213,19 @@ 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");
|
||||
val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
|
||||
goto done;
|
||||
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)
|
||||
|
|
Loading…
Add table
Reference in a new issue