[PATCH v3 0/2] power: supply: bq25630: scope the battery information
From: Linmao Li
Date: Wed Jul 29 2026 - 21:20:08 EST
data->batinfo is only read by bq25630_setup(), but it is fetched in
bq25630_probe() and kept in the driver data for the lifetime of the
device.
Patch 1 moves the get/put pair into bq25630_setup() and drops the member.
Patch 2 then uses the new power_supply_desc::init callback so the charger
registers are programmed before the device is exposed to the system.
Patch 2 depends on commit c1eb5905fdce ("power: supply: Add registration
init callback"), which is in the power-supply tree but not in linux-next
yet. The series is therefore based on power-supply/for-next.
Changes in v3:
- Use dev_err() instead of dev_err_probe() for the battery info failure in
bq25630_setup(). The function is currently only reached from probe(), but
that should not be baked in as a policy, and the rest of the function
already uses dev_err() (Waqar Hameed).
- Rebased onto current power-supply/for-next.
Note that v2 went out with a broken charset in the Content-Type header,
which made git am fail. That was a send-email misconfiguration on my side,
not a change in the patches themselves; it is fixed for this posting.
Thanks to Waqar Hameed for reporting it.
Changes in v2:
- Move the battery information get/put pair into bq25630_setup().
- Remove the now-unused batinfo member from the driver data.
- Use power_supply_desc::init to complete the hardware setup before the
power supply is exposed.
- Split the changes into two patches.
Link to v2:
https://lore.kernel.org/linux-pm/20260728024558.3611522-1-lilinmao@xxxxxxxxxx/
Link to v1:
https://lore.kernel.org/linux-pm/20260727093738.2611185-1-lilinmao@xxxxxxxxxx/
Compile-tested on power-supply/for-next with CONFIG_CHARGER_BQ25630=m; both
patches build cleanly with W=1. Not tested on hardware.
Linmao Li (2):
power: supply: bq25630: Scope battery information to bq25630_setup()
power: supply: bq25630: Initialize hardware before exposing the power
supply
drivers/power/supply/bq25630_charger.c | 56 +++++++++++++-------------
1 file changed, 29 insertions(+), 27 deletions(-)
base-commit: 5584ad5706e594c7648655171785aa4fffdd3db5
--
2.25.1