]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
power: supply: bq27xxx_battery: Notify also about status changes
authorKrzysztof Kozlowski <krzk@kernel.org>
Fri, 26 Apr 2019 09:59:02 +0000 (11:59 +0200)
committerSebastian Reichel <sre@kernel.org>
Wed, 1 May 2019 22:27:29 +0000 (00:27 +0200)
User-space might be interested in receiving uevents when the charging
starts/stops or if conditions of battery changes (e.g.
over-temperature).  Notify about changes in battery also when the flags
change, not only SoC.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq27xxx_battery.c

index 29b3a40568650695990c0dcb9e5a0f1ca1192cc0..195c18c2f426e6d4d675c92ca5336fcf0166e83a 100644 (file)
@@ -1612,7 +1612,8 @@ void bq27xxx_battery_update(struct bq27xxx_device_info *di)
                        di->charge_design_full = bq27xxx_battery_read_dcap(di);
        }
 
-       if (di->cache.capacity != cache.capacity)
+       if ((di->cache.capacity != cache.capacity) ||
+           (di->cache.flags != cache.flags))
                power_supply_changed(di->bat);
 
        if (memcmp(&di->cache, &cache, sizeof(cache)) != 0)