linux-yocto/drivers/power/supply
Jerry Lv f23e6f07d7 power: supply: bq27xxx: Retrieve again when busy
[ Upstream commit f16d9fb6cf ]

Multiple applications may access the battery gauge at the same time, so
the gauge may be busy and EBUSY will be returned. The driver will set a
flag to record the EBUSY state, and this flag will be kept until the next
periodic update. When this flag is set, bq27xxx_battery_get_property()
will just return ENODEV until the flag is updated.

Even if the gauge was busy during the last accessing attempt, returning
ENODEV is not ideal, and can cause confusion in the applications layer.

Instead, retry accessing the I2C to update the flag is as expected, for
the gauge typically recovers from busy state within a few milliseconds.
If still failed to access the gauge, the real error code would be returned
instead of ENODEV (as suggested by Pali Rohár).

Reviewed-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Jerry Lv <Jerry.Lv@axis.com>
Link: https://lore.kernel.org/r/20250415-foo-fix-v2-1-5b45a395e4cc@axis.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:07:32 +01:00
..
88pm860x_battery.c
88pm860x_charger.c
ab8500_bmdata.c
ab8500_btemp.c power: supply: ab8500: Set typing and props 2023-10-06 14:57:06 +02:00
ab8500_chargalg.c power: supply: ab8500: Set typing and props 2023-10-06 14:57:06 +02:00
ab8500_charger.c power: supply: ab8500: Fix error handling in ab8500_charger_init() 2022-12-31 13:32:45 +01:00
ab8500_fg.c power: supply: ab8500: Fix external_power_changed race 2023-06-21 16:00:51 +02:00
ab8500-bm.h
ab8500-chargalg.h
acer_a500_battery.c
act8945a_charger.c
adp5061.c power: supply: adp5061: show unknown capacity_level as text 2022-09-11 12:19:28 +02:00
apm_power.c
axp20x_ac_power.c
axp20x_battery.c power: supply: axp20x_battery: Remove design from min and max voltage 2024-10-17 15:20:48 +02:00
axp20x_usb_power.c
axp288_charger.c power: supply: axp288_charger: Round constant_charge_voltage writes down 2024-08-14 13:52:59 +02:00
axp288_fuel_gauge.c power: supply: axp288_fuel_gauge: Fix external_power_changed race 2023-05-30 14:03:18 +01:00
bd99954-charger.c
bd99954-charger.h
bq27xxx_battery_hdq.c
bq27xxx_battery_i2c.c power: supply: bq27xxx: Retrieve again when busy 2025-06-27 11:07:32 +01:00
bq27xxx_battery.c power: supply: bq27xxx: Retrieve again when busy 2025-06-27 11:07:32 +01:00
bq256xx_charger.c power: supply: bq256xx: fix some problem in bq256xx_hw_init 2024-01-25 15:27:45 -08:00
bq2415x_charger.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
bq2515x_charger.c
bq24190_charger.c power: supply: bq24190: Call power_supply_changed() after updating input current 2023-05-30 14:03:22 +01:00
bq24257_charger.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
bq24735-charger.c
bq25890_charger.c power: supply: bq25890: Call power_supply_changed() after updating input current or voltage 2023-05-30 14:03:21 +01:00
bq25980_charger.c
bq25980_charger.h
charger-manager.c
collie_battery.c
cpcap-battery.c
cpcap-charger.c power: supply: cpcap-charger: fix repeated words in comments 2022-09-11 10:52:05 +02:00
cros_peripheral_charger.c
cros_usbpd-charger.c power: supply: cros_usbpd: provide ID table for avoiding fallback match 2024-06-27 13:46:17 +02:00
cw2015_battery.c power: supply: cw2015: correct time_to_empty units in sysfs 2024-01-25 15:27:45 -08:00
da9030_battery.c
da9052-battery.c
da9150-charger.c power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition 2023-03-30 12:49:01 +02:00
da9150-fg.c power: supply: da9150-fg: fix potential overflow 2025-03-07 16:56:37 +01:00
ds2760_battery.c
ds2780_battery.c
ds2781_battery.c
ds2782_battery.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
generic-adc-battery.c power: supply: generic-adc-battery: fix unit scaling 2023-05-11 23:03:33 +09:00
goldfish_battery.c
gpio-charger.c power: supply: gpio-charger: Fix set charge current limits 2025-01-02 10:30:55 +01:00
ingenic-battery.c
ip5xxx_power.c power: supply: ip5xxx: Fix integer overflow in current_now calculation 2022-11-01 00:02:36 +01:00
ipaq_micro_battery.c
isp1704_charger.c
Kconfig power supply and reset changes for the v6.1 series 2022-10-07 11:48:30 -07:00
lego_ev3_battery.c
lp8727_charger.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
lp8788-charger.c
lt3651-charger.c
ltc2941-battery-gauge.c
ltc4162-l-charger.c
Makefile power supply and reset changes for the v6.1 series 2022-10-07 11:48:30 -07:00
max1721x_battery.c power: supply: max1721x: Fix spelling mistake "Gauage" -> "Gauge" 2022-10-01 21:10:07 +02:00
max8903_charger.c
max8925_power.c
max8997_charger.c
max8998_charger.c
max14577_charger.c
max14656_charger_detector.c
max17040_battery.c
max17042_battery.c power: supply: max17042_battery: Fix SOC threshold calc w/ no current sense 2024-10-17 15:20:49 +02:00
max77650-charger.c
max77693_charger.c power: supply: max77693: Fix wrong conversion of charge input threshold value 2025-04-10 14:33:35 +02:00
max77976_charger.c
mp2629_charger.c
mt6360_charger.c power: supply: mt6360_charger: Fix of_match for usb-otg-vbus regulator 2024-05-17 11:55:55 +02:00
mt6370-charger.c power: supply: mt6370: Fix missing error code in mt6370_chg_toggle_cfo() 2023-10-06 14:56:46 +02:00
olpc_battery.c
pcf50633-charger.c
pda_power.c
pmu_battery.c
power_supply_core.c power: supply: core: Remove might_sleep() from power_supply_put() 2024-12-14 19:53:49 +01:00
power_supply_hwmon.c power: supply: hwmon: Fix missing temp1_max_alarm attribute 2024-10-17 15:21:51 +02:00
power_supply_leds.c power: supply: leds: Fix blink to LED on transition 2023-05-30 14:03:21 +01:00
power_supply_sysfs.c power: supply: Ratelimit no data debug output 2023-06-21 16:00:52 +02:00
power_supply.h
qcom_smbb.c
rk817_charger.c power: supply: rk817: Add missing module alias 2023-10-06 14:57:05 +02:00
rn5t618_power.c
rt5033_battery.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
rt9455_charger.c power: rt9455: hide unused rt9455_boost_voltage_values 2024-05-17 11:55:55 +02:00
rx51_battery.c
s3c_adc_battery.c
samsung-sdi-battery.c
samsung-sdi-battery.h
sbs-battery.c
sbs-charger.c power: supply: sbs-charger: Fix INHIBITED bit for Status reg 2023-05-30 14:03:22 +01:00
sbs-manager.c
sc27xx_fuel_gauge.c power: supply: sc27xx: Fix external_power_changed race 2023-06-21 16:00:51 +02:00
sc2731_charger.c
smb347-charger.c i2c: Make remove callback return void 2022-08-16 12:46:26 +02:00
surface_battery.c
surface_charger.c
test_power.c
tosa_battery.c
tps65090-charger.c
tps65217_charger.c power: supply: tps65217: Fix comments typo 2022-09-11 12:09:10 +02:00
twl4030_charger.c
twl4030_madc_battery.c
ucs1002_power.c power: supply: ucs1002: fix error code in ucs1002_get_property() 2023-10-06 14:56:48 +02:00
ug3105_battery.c
wilco-charger.c
wm97xx_battery.c
wm831x_backup.c
wm831x_power.c
wm8350_power.c
z2_battery.c power: supply: z2_battery: Fix possible memleak in z2_batt_probe() 2022-12-31 13:32:44 +01:00