Skip to content

power: supply: bq27xxx/bq25890 status update fixes

Hans de Goede linux-pm 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest10 patches 1 replyIn review
  2. v19 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Do not use bq->charger in bq25890_external_power_changed(), because it may not be set yet (avoid NULL ptr deref on race)
- Add "power: supply: bq24190: Call power_supply_changed() after updating input current" to the series

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10power: supply: bq27xxx: Fix bq27xxx_battery_update() race conditiondrivers/power/supply/bq27xxx_battery.c+13 -80 replies
2/10power: supply: bq27xxx: Fix I2C IRQ race on removedrivers/power/supply/bq27xxx_battery_i2c.c+2 -10 replies
3/10power: supply: bq27xxx: Fix poll_interval handling and races on removedrivers/power/supply/bq27xxx_battery.c include/linux/power/bq27xxx_battery.h+10 -130 replies
4/10power: supply: bq27xxx: Add cache parameter to bq27xxx_battery_current_and_status()drivers/power/supply/bq27xxx_battery.c+12 -70 replies
5/10power: supply: bq27xxx: Move bq27xxx_battery_update() downdrivers/power/supply/bq27xxx_battery.c+61 -610 replies
6/10power: supply: bq27xxx: Ensure power_supply_changed() is called on current sign changesdrivers/power/supply/bq27xxx_battery.c include/linux/power/bq27xxx_battery.h+15 -10 replies
7/10power: supply: bq27xxx: After charger plug in/out wait 0.5s for things to stabilizedrivers/power/supply/bq27xxx_battery.c+2 -20 replies
8/10power: supply: bq27xxx: Use mod_delayed_work() instead of cancel() + schedule()drivers/power/supply/bq27xxx_battery.c+2 -40 replies
9/10power: supply: bq25890: Call power_supply_changed() after updating input current or voltagedrivers/power/supply/bq25890_charger.c+3 -00 replies
10/10power: supply: bq24190: Call power_supply_changed() after updating input currentdrivers/power/supply/bq24190_charger.c+1 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 00/10] power: supply: bq27xxx/bq25890 status update fixes

Hi all,

Here is v2 if my bq* status update fixes series

Changes in v2:
- Do not use bq->charger in bq25890_external_power_changed(), because it may not be set yet (avoid NULL ptr deref on race)
- Add "power: supply: bq24190: Call power_supply_changed() after updating input current" to the series

The main goal of this series is to fix userspace sometimes not getting notified in a timely manner of charging <-> discharging status changes, causing e.g. battery status icons to lag and the lagging of updates also effects power_supply_leds.c .

While working on this I noticed a number of races surrounding bq27xxx_battery_update(), so patches 1-4 fix those first.

Patches 5-10 take care of the status update lagging issues.

Regards,

Hans

Hans de Goede (10):
power: supply: bq27xxx: Fix bq27xxx_battery_update() race condition
power: supply: bq27xxx: Fix I2C IRQ race on remove
power: supply: bq27xxx: Fix poll_interval handling and races on remove
power: supply: bq27xxx: Add cache parameter to
bq27xxx_battery_current_and_status()
power: supply: bq27xxx: Move bq27xxx_battery_update() down
power: supply: bq27xxx: Ensure power_supply_changed() is called on
current sign changes
power: supply: bq27xxx: After charger plug in/out wait 0.5s for things
to stabilize
power: supply: bq27xxx: Use mod_delayed_work() instead of cancel() +
schedule()
power: supply: bq25890: Call power_supply_changed() after updating
input current or voltage
power: supply: bq24190: Call power_supply_changed() after updating
input current

 drivers/power/supply/bq24190_charger.c     |   1 +
 drivers/power/supply/bq25890_charger.c     |   3 +
 drivers/power/supply/bq27xxx_battery.c     | 181 +++++++++++----------
 drivers/power/supply/bq27xxx_battery_i2c.c |   3 +-
 include/linux/power/bq27xxx_battery.h      |   4 +
 5 files changed, 108 insertions(+), 84 deletions(-)
Signature · 1 line
2.39.1