summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorSubbaraman Narayanamurthy <subbaram@codeaurora.org>2016-10-21 17:30:46 -0700
committerSubbaraman Narayanamurthy <subbaram@codeaurora.org>2016-10-24 10:35:08 -0700
commitf410c9200446e502e55456b0beda774a602bb3cf (patch)
tree0a975e2354fb0a89afff6870e8b2289c226ff391 /drivers/power
parentb9c370a5829b97b2f5d3a163fa9e28108188ed3d (diff)
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>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/qcom-charger/smb-lib.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/power/qcom-charger/smb-lib.c b/drivers/power/qcom-charger/smb-lib.c
index 5785e42e0140..de4391024970 100644
--- a/drivers/power/qcom-charger/smb-lib.c
+++ b/drivers/power/qcom-charger/smb-lib.c
@@ -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)