From: Hakan Berg <[email protected]>

When the charging safety timer is elapsed the battery health is shown as "Good".
This is misleading and also hard to distingiush problems reported on "phone
discharges although charger is attached".

When safety timer elapses that is an indication of a fault in the battery of
some kind. Hence report as POWER_SUPPLY_HEALTH_UNSPEC_FAILURE.

Signed-off-by: Hakan Berg <[email protected]>
Signed-off-by: Mathieu Poirier <[email protected]>
Reviewed-by: Arun MURTHY <[email protected]>
Reviewed-by: Karl KOMIEROWSKI <[email protected]>
---
 drivers/power/abx500_chargalg.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
index 4db0ef0..1df238f 100644
--- a/drivers/power/abx500_chargalg.c
+++ b/drivers/power/abx500_chargalg.c
@@ -1711,6 +1711,10 @@ static int abx500_chargalg_get_property(struct 
power_supply *psy,
                                val->intval = POWER_SUPPLY_HEALTH_COLD;
                        else
                                val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
+               } else if (di->charge_state == STATE_SAFETY_TIMER_EXPIRED ||
+                       di->charge_state ==
+                       STATE_SAFETY_TIMER_EXPIRED_INIT) {
+                       val->intval = POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
                } else {
                        val->intval = POWER_SUPPLY_HEALTH_GOOD;
                }
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to