linux-yocto/drivers/power/supply
Jerry Lv 6336d96ae8 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:05:28 +01:00
..
88pm860x_battery.c
88pm860x_charger.c
ab8500_bmdata.c
ab8500_btemp.c power: supply: ab8500: Fix external_power_changed race 2023-06-21 15:59:12 +02:00
ab8500_chargalg.c power: ab8500_chargalg: Use CLOCK_MONOTONIC 2022-04-08 14:23:39 +02:00
ab8500_charger.c power: supply: ab8500: Fix error handling in ab8500_charger_init() 2022-12-31 13:14:32 +01:00
ab8500_fg.c power: supply: ab8500: Fix external_power_changed race 2023-06-21 15:59:12 +02:00
ab8500-bm.h
ab8500-chargalg.h
acer_a500_battery.c
act8945a_charger.c
adp5061.c power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type() 2022-10-26 12:35:47 +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:10:50 +02:00
axp20x_usb_power.c
axp288_charger.c power: supply: axp288_charger: Round constant_charge_voltage writes down 2024-08-19 05:45:46 +02:00
axp288_fuel_gauge.c power: supply: axp288_fuel_gauge: Drop BIOS version check from "T3 MRD" DMI quirk 2022-06-14 18:36:06 +02: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:05:28 +01:00
bq27xxx_battery.c power: supply: bq27xxx: Retrieve again when busy 2025-06-27 11:05:28 +01:00
bq256xx_charger.c power: supply: bq256xx: fix some problem in bq256xx_hw_init 2024-01-25 14:52:50 -08:00
bq2415x_charger.c
bq2515x_charger.c
bq24190_charger.c power: supply: bq24190_charger: replace deprecated strncpy with strscpy 2024-08-19 05:45:33 +02:00
bq24257_charger.c
bq24735-charger.c
bq25890_charger.c
bq25980_charger.c
bq25980_charger.h
charger-manager.c extcon: Fix extcon_get_extcon_dev() error handling 2022-06-14 18:36:21 +02:00
collie_battery.c
cpcap-battery.c
cpcap-charger.c
cros_peripheral_charger.c
cros_usbpd-charger.c power: supply: cros_usbpd: provide ID table for avoiding fallback match 2024-07-05 09:14:27 +02:00
cw2015_battery.c power: supply: cw2015: correct time_to_empty units in sysfs 2024-01-25 14:52:50 -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:47:43 +02:00
da9150-fg.c power: supply: da9150-fg: fix potential overflow 2025-03-13 12:50:53 +01:00
ds2760_battery.c
ds2780_battery.c
ds2781_battery.c
ds2782_battery.c
generic-adc-battery.c power: supply: generic-adc-battery: fix unit scaling 2023-05-11 23:00:36 +09:00
goldfish_battery.c
gpio-charger.c power: supply: gpio-charger: Fix set charge current limits 2025-01-09 13:28:42 +01:00
ingenic-battery.c
ipaq_micro_battery.c
isp1704_charger.c
Kconfig
lego_ev3_battery.c
lp8727_charger.c
lp8788-charger.c
lt3651-charger.c
ltc2941-battery-gauge.c
ltc4162-l-charger.c
Makefile
max1721x_battery.c
max8903_charger.c
max8925_power.c
max8997_charger.c extcon: Fix extcon_get_extcon_dev() error handling 2022-06-14 18:36:21 +02:00
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:10:50 +02:00
max77650-charger.c
max77693_charger.c power: supply: max77693: Fix wrong conversion of charge input threshold value 2025-04-10 14:32:00 +02:00
mp2629_charger.c
mt6360_charger.c power: supply: mt6360_charger: Fix of_match for usb-otg-vbus regulator 2024-05-17 11:50:46 +02:00
olpc_battery.c
pcf50633-charger.c
pda_power.c
pm2301_charger.h
pmu_battery.c
power_supply_core.c power: supply: core: Remove might_sleep() from power_supply_put() 2024-12-14 19:51:08 +01:00
power_supply_hwmon.c power: supply: hwmon: Fix missing temp1_max_alarm attribute 2024-10-17 15:11:35 +02:00
power_supply_leds.c power: supply: leds: Fix blink to LED on transition 2023-05-30 13:55:32 +01:00
power_supply_sysfs.c power: supply: Ratelimit no data debug output 2023-06-21 15:59:12 +02:00
power_supply.h
qcom_smbb.c
rn5t618_power.c
rt5033_battery.c
rt9455_charger.c power: rt9455: hide unused rt9455_boost_voltage_values 2024-05-17 11:50:46 +02:00
rx51_battery.c
s3c_adc_battery.c
sbs-battery.c
sbs-charger.c power: supply: sbs-charger: Fix INHIBITED bit for Status reg 2023-05-30 13:55:32 +01:00
sbs-manager.c
sc27xx_fuel_gauge.c power: supply: sc27xx: Fix external_power_changed race 2023-06-21 15:59:12 +02:00
sc2731_charger.c
smb347-charger.c
surface_battery.c
surface_charger.c
test_power.c
tosa_battery.c
tps65090-charger.c
tps65217_charger.c
twl4030_charger.c
twl4030_madc_battery.c
ucs1002_power.c power: supply: ucs1002: fix error code in ucs1002_get_property() 2023-10-06 13:18:13 +02:00
wilco-charger.c
wm97xx_battery.c
wm831x_backup.c
wm831x_power.c
wm8350_power.c power: supply: wm8350-power: Add missing free in free_charger_irq 2022-04-08 14:23:37 +02:00
z2_battery.c power: supply: z2_battery: Fix possible memleak in z2_batt_probe() 2022-12-31 13:14:32 +01:00