* [PATCH v2 0/7] Add support for the X-Powers AXP2101 PMIC
@ 2026-11-15 17:11 Olivier Louvignes
2026-11-15 17:11 ` [PATCH v2 1/7] dt-bindings: mfd: x-powers,axp152: Add the AXP2101 Olivier Louvignes
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Olivier Louvignes @ 2026-11-15 17:11 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai
Cc: Olivier Louvignes, Conor Dooley, Krzysztof Kozlowski,
Liam Girdwood, Mark Brown, Rob Herring, Sebastian Reichel,
devicetree, linux-kernel, linux-pm, mfd
This adds the AXP2101 to the axp20x drivers: the MFD core with its
registers and interrupts, the regulators, the USB power supply and the
battery charger. The PMIC is on the HiBy R1, a music player built on an
Ingenic X1600. It follows how the AXP717 was added: the existing
drivers are extended, and the two power supplies get their own
compatibles because their registers differ.
Not handled yet: the PMIC's own fuel gauge (the R1 uses a CW2015, and the
AXP2101's reads 0% without a battery model), the power key, the ADC
channels, the TS pin, and writing the input current limit.
Sources: there is no datasheet behind this. The register map comes from
the GPL-2.0 AXP2101 driver of the hiby-custom-kernel project
(github.com/Jepl4r/hiby-custom-kernel), an open replacement for HiBy's
closed module, and was checked against the chip on a running R1.
Tested on the R1, on v7.3 with out-of-tree board patches:
- The rails the stock firmware turns on (DCDC1-4 at 3.3, 1.1, 1.8 and
1.2 V, ALDO2 3.3 V, ALDO3 1.1 V, ALDO4 3.3 V, BLDO1 and BLDO2 2.8 V)
read back at their stock voltages, and the regulator registers
0x80-0x9a stay byte for byte as the stock firmware left them. No
voltage was changed from Linux. BLDO1 and BLDO2 (2.8 V, the LCD
supplies) are switched on and off from Linux by the panel driver, which
claims them: bits 4 and 5 of register 0x90 clear and set again with
the screen blanking and unblanking, about 20 cycles over 8 boots, with
the selectors (0x96 and 0x97) staying at 0x17. That does not change a
voltage, since the registers already held 2.8 V. DCDC5, ALDO1, DLDO1-2
and CPUSLDO are off on the R1 and only come from the register map.
- "poweroff -f" turns the R1 off, through COMM_CFG.
- Unplugging and replugging USB gives one VBUS_REMOVAL and one
VBUS_PLUGIN interrupt, and the USB supply goes online 1, 0, 1.
- The charger registers read back as the stock firmware's values after
boot, and the battery status is Full on USB, Discharging unplugged and
Charging after a replug.
The series is on for-mfd-next (c92739a23a80, after v7.4-rc1), builds
with W=1, passes checkpatch --strict, and the three bindings pass
dt_binding_check.
Open questions: whether extending the axp20x drivers is what you want
here (the alternative is a driver of its own), and whether programming
the charger from the monitored battery at probe, read-only afterwards,
is acceptable for the battery supply.
Changes since v1:
- mfd binding: axp2101 placed by the order each allOf list already
follows (Krzysztof).
- usb-power binding: the AXP2101's input-current-limit-microamp
constrained to the six values it has (Krzysztof, and the Sashiko
review).
- mfd: axp2101_cells is const (Sashiko review).
- Acked-by from Mark Brown on the regulator patch and from Krzysztof on
the battery binding.
- Rebased on for-mfd-next after v7.4-rc1; no change to the code.
v1: https://lore.kernel.org/all/20261023100401.67592-1-olivier@mgcrea.io/
Olivier Louvignes (7):
dt-bindings: mfd: x-powers,axp152: Add the AXP2101
mfd: axp20x: Add support for the AXP2101
regulator: axp20x: Add support for the AXP2101
dt-bindings: power: supply: axp20x-usb-power: Add the AXP2101
power: supply: axp20x_usb_power: Add support for the AXP2101
dt-bindings: power: supply: axp20x-battery: Add the AXP2101
power: supply: axp20x_battery: Add support for the AXP2101
.../bindings/mfd/x-powers,axp152.yaml | 3 +
.../x-powers,axp20x-battery-power-supply.yaml | 1 +
.../x-powers,axp20x-usb-power-supply.yaml | 12 +
drivers/mfd/axp20x-i2c.c | 2 +
drivers/mfd/axp20x.c | 107 ++++++++-
drivers/power/supply/axp20x_battery.c | 221 ++++++++++++++++++
drivers/power/supply/axp20x_usb_power.c | 86 +++++++
drivers/regulator/axp20x-regulator.c | 88 +++++++
include/linux/mfd/axp20x.h | 114 +++++++++
9 files changed, 632 insertions(+), 2 deletions(-)
base-commit: c92739a23a80f5f0a7c6f3c10aa792102d252ac4
--
2.54.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/7] dt-bindings: mfd: x-powers,axp152: Add the AXP2101
2026-11-15 17:11 [PATCH v2 0/7] Add support for the X-Powers AXP2101 PMIC Olivier Louvignes
@ 2026-11-15 17:11 ` Olivier Louvignes
2026-11-15 17:20 ` sashiko-bot
2026-11-15 17:11 ` [PATCH v2 4/7] dt-bindings: power: supply: axp20x-usb-power: " Olivier Louvignes
2026-11-15 17:11 ` [PATCH v2 6/7] dt-bindings: power: supply: axp20x-battery: " Olivier Louvignes
2 siblings, 1 reply; 6+ messages in thread
From: Olivier Louvignes @ 2026-11-15 17:11 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai
Cc: Olivier Louvignes, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
mfd, devicetree, linux-kernel
The AXP2101's interrupt line is optional, as for the AXP313A and the
AXP15060: the driver then registers only the regulators. It has no DCDC
frequency setting.
Signed-off-by: Olivier Louvignes <olivier@mgcrea.io>
---
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
index 45f015d63df1..024de5553d6b 100644
--- a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
+++ b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
@@ -69,6 +69,7 @@ allOf:
contains:
enum:
- x-powers,axp15060
+ - x-powers,axp2101
- x-powers,axp305
- x-powers,axp313a
- x-powers,axp323
@@ -85,6 +86,7 @@ allOf:
- x-powers,axp313a
- x-powers,axp323
- x-powers,axp15060
+ - x-powers,axp2101
- x-powers,axp717
then:
@@ -108,6 +110,7 @@ properties:
- x-powers,axp806
- x-powers,axp809
- x-powers,axp813
+ - x-powers,axp2101
- x-powers,axp15060
- items:
- const: x-powers,axp228
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 4/7] dt-bindings: power: supply: axp20x-usb-power: Add the AXP2101
2026-11-15 17:11 [PATCH v2 0/7] Add support for the X-Powers AXP2101 PMIC Olivier Louvignes
2026-11-15 17:11 ` [PATCH v2 1/7] dt-bindings: mfd: x-powers,axp152: Add the AXP2101 Olivier Louvignes
@ 2026-11-15 17:11 ` Olivier Louvignes
2026-11-15 17:19 ` sashiko-bot
2026-11-15 17:11 ` [PATCH v2 6/7] dt-bindings: power: supply: axp20x-battery: " Olivier Louvignes
2 siblings, 1 reply; 6+ messages in thread
From: Olivier Louvignes @ 2026-11-15 17:11 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai
Cc: Olivier Louvignes, Sebastian Reichel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-pm, devicetree,
linux-kernel
The AXP2101's USB power supply reports whether VBUS is present and the
input current limit, like the AXP717's; its registers differ, so it gets
its own compatible.
Signed-off-by: Olivier Louvignes <olivier@mgcrea.io>
---
.../supply/x-powers,axp20x-usb-power-supply.yaml | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml
index 2ec036405ae4..439b3ea6a7f5 100644
--- a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml
+++ b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml
@@ -25,6 +25,7 @@ properties:
- x-powers,axp223-usb-power-supply
- x-powers,axp717-usb-power-supply
- x-powers,axp813-usb-power-supply
+ - x-powers,axp2101-usb-power-supply
- items:
- const: x-powers,axp803-usb-power-supply
- const: x-powers,axp813-usb-power-supply
@@ -101,4 +102,15 @@ allOf:
enum: [100000, 500000, 900000, 1500000, 2000000, 2500000,
3000000, 3500000, 4000000]
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - x-powers,axp2101-usb-power-supply
+ then:
+ properties:
+ input-current-limit-microamp:
+ enum: [100000, 500000, 900000, 1000000, 1500000, 2000000]
+
additionalProperties: false
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 6/7] dt-bindings: power: supply: axp20x-battery: Add the AXP2101
2026-11-15 17:11 [PATCH v2 0/7] Add support for the X-Powers AXP2101 PMIC Olivier Louvignes
2026-11-15 17:11 ` [PATCH v2 1/7] dt-bindings: mfd: x-powers,axp152: Add the AXP2101 Olivier Louvignes
2026-11-15 17:11 ` [PATCH v2 4/7] dt-bindings: power: supply: axp20x-usb-power: " Olivier Louvignes
@ 2026-11-15 17:11 ` Olivier Louvignes
2 siblings, 0 replies; 6+ messages in thread
From: Olivier Louvignes @ 2026-11-15 17:11 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai
Cc: Olivier Louvignes, Krzysztof Kozlowski, Sebastian Reichel,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-pm,
devicetree, linux-kernel
The AXP2101's charger is programmed from the monitored battery and its
registers differ from the other models', so it gets its own compatible.
Signed-off-by: Olivier Louvignes <olivier@mgcrea.io>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
.../power/supply/x-powers,axp20x-battery-power-supply.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
index a90d558e7f86..6a0a0c3f052b 100644
--- a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
+++ b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
@@ -21,6 +21,7 @@ properties:
- const: x-powers,axp209-battery-power-supply
- const: x-powers,axp221-battery-power-supply
- const: x-powers,axp717-battery-power-supply
+ - const: x-powers,axp2101-battery-power-supply
- items:
- const: x-powers,axp803-battery-power-supply
- const: x-powers,axp813-battery-power-supply
--
2.39.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 4/7] dt-bindings: power: supply: axp20x-usb-power: Add the AXP2101
2026-11-15 17:11 ` [PATCH v2 4/7] dt-bindings: power: supply: axp20x-usb-power: " Olivier Louvignes
@ 2026-11-15 17:19 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-15 17:19 UTC (permalink / raw)
To: Olivier Louvignes; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dt-bindings: power: supply: piling per-compatible if-then onto
axp20x schema
--
commit b91180032c14c7d6f98055be9d7c8629fe0f89d7
Author: Olivier Louvignes <olivier@mgcrea.io>
dt-bindings: power: supply: axp20x-usb-power-supply: Add the AXP2101
This commit adds the x-powers,axp2101-usb-power-supply compatible string
and its supported input-current-limit-microamp values to the AXP20x USB
power supply Device Tree binding schema.
> diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml
> index 2ec036405ae47..439b3ea6a7f5b 100644
> --- a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml
> @@ -25,6 +25,7 @@ properties:
> - x-powers,axp223-usb-power-supply
> - x-powers,axp717-usb-power-supply
> - x-powers,axp813-usb-power-supply
> + - x-powers,axp2101-usb-power-supply
> - items:
> - const: x-powers,axp803-usb-power-supply
> - const: x-powers,axp813-usb-power-supply
> @@ -101,4 +102,15 @@ allOf:
> enum: [100000, 500000, 900000, 1500000, 2000000, 2500000,
> 3000000, 3500000, 4000000]
>
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - x-powers,axp2101-usb-power-supply
> + then:
> + properties:
> + input-current-limit-microamp:
> + enum: [100000, 500000, 900000, 1000000, 1500000, 2000000]
> +
> additionalProperties: false
[Severity: Low]
This schema only defines compatible and input-current-limit-microamp, yet
allOf now has six separate per-compatible if-then blocks because almost
every AXP variant supports a different set of current limits. Should this
binding be split into separate schema documents rather than piling on more
per-variant conditionals?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261115171150.64431-1-olivier@mgcrea.io?part=4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/7] dt-bindings: mfd: x-powers,axp152: Add the AXP2101
2026-11-15 17:11 ` [PATCH v2 1/7] dt-bindings: mfd: x-powers,axp152: Add the AXP2101 Olivier Louvignes
@ 2026-11-15 17:20 ` sashiko-bot
0 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-11-15 17:20 UTC (permalink / raw)
To: Olivier Louvignes; +Cc: mfd, devicetree, robh, conor+dt, lee
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] dt-bindings: mfd: x-powers,axp152: x-powers,dcdc-freq: false at
wrong level
- [Low] dt-bindings: mfd: x-powers,axp152: unwieldy per-compatible
conditionals
--
commit 520d0c5b7e3c77d62056e2ccbc2df67bc5ef33a7
Author: Olivier Louvignes <olivier@mgcrea.io>
dt-bindings: mfd: x-powers,axp152: Add the AXP2101
This commit adds the x-powers,axp2101 compatible string to the X-Powers AXP
PMIC binding with optional interrupts and no DCDC frequency setting.
> diff --git a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
> index 45f015d63df16..024de5553d6b7 100644
> --- a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
> +++ b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
> @@ -69,6 +69,7 @@ allOf:
> contains:
> enum:
> - x-powers,axp15060
> + - x-powers,axp2101
> - x-powers,axp305
> - x-powers,axp313a
> - x-powers,axp323
> @@ -85,6 +86,7 @@ allOf:
> - x-powers,axp313a
> - x-powers,axp323
> - x-powers,axp15060
> + - x-powers,axp2101
> - x-powers,axp717
>
> then:
[Severity: Low]
Does adding x-powers,axp2101 to this allOf rule actually forbid
x-powers,dcdc-freq under the regulators child node?
x-powers,dcdc-freq is defined and parsed under properties -> regulators ->
properties, whereas the then clause of this block sets x-powers,dcdc-freq:
false at the top-level PMIC node:
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml:allOf:
then:
properties:
x-powers,dcdc-freq: false
Because the first allOf entry's else branch defines x-powers,dcdc-freq under
properties -> regulators -> properties with a 1800 to 4050 kHz range, schema
validation still permits x-powers,dcdc-freq inside the regulators node for
x-powers,axp2101. Nesting x-powers,dcdc-freq: false under properties ->
regulators -> properties in this then block would disallow it as intended.
> @@ -108,6 +110,7 @@ properties:
> - x-powers,axp806
> - x-powers,axp809
> - x-powers,axp813
> + - x-powers,axp2101
> - x-powers,axp15060
> - items:
> - const: x-powers,axp228
[Severity: Low]
This isn't a bug, but x-powers,axp152.yaml already aggregates nearly twenty
PMIC variants with five per-compatible if-then blocks in allOf. Rather than
extending these conditional lists further (and inserting x-powers,axp2101 out
of numerical order after x-powers,axp813), would it be cleaner to split new
variants into a separate binding schema document?
Also, the commit message explains the optional interrupt line in terms of
Linux driver behavior ("the driver then registers only the regulators") and
gives no background on the AXP2101 hardware. Describing the PMIC and why the
interrupt line may be omitted in hardware or board wiring would make the
binding description clearer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261115171150.64431-1-olivier@mgcrea.io?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-11-15 17:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 17:11 [PATCH v2 0/7] Add support for the X-Powers AXP2101 PMIC Olivier Louvignes
2026-11-15 17:11 ` [PATCH v2 1/7] dt-bindings: mfd: x-powers,axp152: Add the AXP2101 Olivier Louvignes
2026-11-15 17:20 ` sashiko-bot
2026-11-15 17:11 ` [PATCH v2 4/7] dt-bindings: power: supply: axp20x-usb-power: " Olivier Louvignes
2026-11-15 17:19 ` sashiko-bot
2026-11-15 17:11 ` [PATCH v2 6/7] dt-bindings: power: supply: axp20x-battery: " Olivier Louvignes
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox