[PATCH v3 0/7] Add support for the X-Powers AXP2101 PMIC
From: Olivier Louvignes
Date: Sat Dec 05 2026 - 10:37:50 EST
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.
Chen-Yu found the datasheets [1], and v3 is checked against them. The
AXP2101 comes in two variants. This series handles the linear charge
one (AXP2101 datasheet V1.0), whose SW pin drives DCDC5 and whose
charge current goes to 1 A. The switch charge variant uses that pin for
its charger's buck, has no DCDC5, and charges at up to 1.5 A; it is not
handled. The R1 has the linear charge variant: DCDC5's voltage
register (0x86), which the switch charge variant does not have, holds
its default 0x13 and reads back what is written to it.
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.
Tested on the R1, on v7.3 with out-of-tree board patches, again with
v3's register map, DLDO1 and termination current changes:
- 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,
through bits 4 and 5 of register 0x90. 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.
- With v3, the PMIC registers 0x10-0x1b, 0x61-0x64 and 0x80-0x9a read
the same after boot as with v2, and regmap's debugfs shows COMM_CFG,
GAUGE_RESET, WDT_CTRL and SLEEP_WAKEUP as volatile.
The series is on for-mfd-next (93360adf2793, v7.4-rc2), builds with
W=1 at each patch, and passes checkpatch --strict. The bindings are
unchanged since v2.
Changes since v2:
- mfd: the register map checked against the datasheet (Chen-Yu):
- the writeable and volatile ranges split at their holes;
- COMM_CFG, GAUGE_RESET, WDT_CTRL and SLEEP_WAKEUP made volatile;
- TTE_H and TTF_L dropped, and DCDC_MODE_CTRL (0x87) with them: none
is in the datasheet;
- JEITA_CFG3, THERM_REG and CHG_TIMEOUT added, so that the writeable
ranges follow the datasheet's registers.
- mfd: every AXP2101 object placed between the AXP8xx ones and the
AXP15060's, in the header too (Chen-Yu).
- mfd: the commit message names the variant and the datasheet, instead
of the hiby-custom-kernel driver the v1 and v2 register map came from.
- mfd: the i2c_device_id entry uses .name, as its neighbours now do
(rebase, and the Sashiko review).
- regulator: DLDO1 goes to 3.3 V, not 3.4 V, per the datasheet.
- battery: the termination and precharge currents capped at 200 mA;
the datasheet marks selectors 9 to 15 reserved.
- Acked-by from Krzysztof on the three bindings, and from Sebastian on
the power supply patches.
- Rebased on for-mfd-next after v7.4-rc2.
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.
[1] https://github.com/eggfly/AXP2101
v2: https://lore.kernel.org/all/20261115171150.64431-1-olivier@xxxxxxxxx/
v1: https://lore.kernel.org/all/20261023100401.67592-1-olivier@xxxxxxxxx/
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 | 117 ++++++++-
drivers/power/supply/axp20x_battery.c | 222 ++++++++++++++++++
drivers/power/supply/axp20x_usb_power.c | 86 +++++++
drivers/regulator/axp20x-regulator.c | 88 +++++++
include/linux/mfd/axp20x.h | 114 +++++++++
9 files changed, 643 insertions(+), 2 deletions(-)
base-commit: 93360adf279353f5518e4afdc79a67c256dd352a
--
2.39.5