[PATCH v1 0/4] power: supply: bq25890: add input voltage limit

From: Vincent Cloutier

Date: Sun Sep 27 2026 - 10:56:13 EST


From: Vincent Cloutier <vincent@xxxxxxxxxxx>

Hi,

Add an optional input-voltage-limit-microvolt firmware property for
selecting and programming an absolute VINDPM threshold. The Librem 5 uses
a BQ25895 charger; the board patch sets the 3.9 V threshold tested on the
phone. This provides useful standalone fixed-threshold configuration.

Purism's newer charging work pairs a 4.2 V threshold with Input Current
Optimizer support to improve operation with weak sources and resistive
cables. Those changes shipped in 6.12.79pureos1 as commit 3bd0fc6da9d0
("arm64: dts: imx8mq-librem5: Bump VINDPM to 4.2V") and commit ca7bb9bc4d24
("power: supply: bq25890: Support Input Current Optimizer"), and remain in
the inspected downstream 6.18 branches. That additional optimization is
follow-up work which can build on the generic configuration added here.

The BQ25896 resets FORCE_VINDPM and VINDPM when an input source is
inserted. Its source-detection and VINDPM-selection stages generate
separate interrupts, so the driver compares both fields with the requested
values whenever the charger is online, before returning for unchanged
charger state. It repeats the comparison during resume in case an input
insertion occurred while suspended. Registers are written only on a
mismatch, avoiding an interrupt loop. Successful restoration is reported as
a handled interrupt even when the tracked state is unchanged, without a
redundant power-supply change notification.

VINDPM programming and restoration require the explicit voltage-limit
property. linux,read-back-settings continues to bypass initialization
properties and does not enable restoration of a firmware-set threshold.

The binding and driver changes revisit this 2019 posting:
https://lore.kernel.org/all/20190520180712.32405-1-angus@xxxxxxxx/

This version addresses that review by using one property. Its presence
selects absolute VINDPM without supplying a default. The earlier review
suggested input-voltage-min-microvolt; the current bq256xx and sgm41542
bindings instead use input-voltage-limit-microvolt.

Patch 1 removes the invalid monitored-battery reference from the same
charger node. This cleanup is independent and can be applied separately.
It retains Angus Ainslie's original authorship and sign-off and adds my
submitter sign-off. Patches 2 through 4 are authored by me.

The series passes a focused arm64 W=1 driver build, BQ25890 binding and
example validation, Librem 5r2/r3/r4 DTB builds, and targeted CHECK_DTBS=y.
Host-side register-mock tests of the driver functions verify opt-in
behavior through initialization, online IRQ handling, and resume,
including read-back configurations with firmware-set absolute VINDPM.
They also check IRQ results, notification counts, and register I/O failures.
Earlier Librem 5r4 testing validated the property and BQ25895 board
setting: REG0D remained 0x8d on an attached boot, unplug, and flipped
replug. This validates initial BQ25895 programming and retention, but
cannot exercise the BQ25896 input-insertion restoration path. No BQ25896
hardware was available to test that path.

Angus Ainslie (Purism) (1):
arm64: dts: imx8mq-librem5: Remove invalid monitored-battery

Vincent Cloutier (3):
dt-bindings: power: supply: bq25890: Add input voltage limit
power: supply: bq25890: Add input voltage limit
arm64: dts: imx8mq-librem5: Set BQ25895 input voltage limit

.../devicetree/bindings/power/supply/bq25890.yaml | 9 +++
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 2 +-
drivers/power/supply/bq25890_charger.c | 74 +++++++++++++++++++++-
3 files changed, 83 insertions(+), 2 deletions(-)


base-commit: 4477a78374a57c3809b172ad30cceabda48c47c6
--
2.55.0