]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
power: supply: bq24190_charger: Limit over/under voltage fault logging
authorLiam Breck <kernel@networkimprov.net>
Tue, 11 Apr 2017 11:59:54 +0000 (04:59 -0700)
committerSebastian Reichel <sre@kernel.org>
Thu, 13 Apr 2017 23:41:35 +0000 (01:41 +0200)
If the charger is unplugged before the battery is full we may
see an over/under voltage fault. Ignore this rather then emitting
a message or uevent.

This fixes messages like these getting logged on charger unplug + replug:
bq24190-charger 15-006b: Fault: boost 0, charge 1, battery 0, ntc 0
bq24190-charger 15-006b: Fault: boost 0, charge 0, battery 0, ntc 0

Cc: Tony Lindgren <tony@atomide.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Liam Breck <kernel@networkimprov.net>
Acked-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/supply/bq24190_charger.c

index 2c404a59e6137c0c086a497f9379b35cc4e99609..59a7b6cbf5faecd128b6042b894454cc358162d3 100644 (file)
@@ -1222,8 +1222,13 @@ static void bq24190_check_status(struct bq24190_dev_info *bdi)
                }
        } while (f_reg && ++i < 2);
 
+       /* ignore over/under voltage fault after disconnect */
+       if (f_reg == (1 << BQ24190_REG_F_CHRG_FAULT_SHIFT) &&
+           !(ss_reg & BQ24190_REG_SS_PG_STAT_MASK))
+               f_reg = 0;
+
        if (f_reg != bdi->f_reg) {
-               dev_info(bdi->dev,
+               dev_warn(bdi->dev,
                        "Fault: boost %d, charge %d, battery %d, ntc %d\n",
                        !!(f_reg & BQ24190_REG_F_BOOST_FAULT_MASK),
                        !!(f_reg & BQ24190_REG_F_CHRG_FAULT_MASK),