Skip to content

Commit

Permalink
power: supply: bq27xxx_battery: Notify also about status changes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
krzk authored and sre committed May 1, 2019
1 parent 231a13d commit 243f8ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/power/supply/bq27xxx_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 243f8ff

Please sign in to comment.