Re: [PATCH 3/3] regulator: axp20x: add support for the AXP318W

From: Chen-Yu Tsai
Date: Mon Nov 03 2025 - 11:55:16 EST


On Tue, Oct 21, 2025 at 7:20 PM Andre Przywara <andre.przywara@xxxxxxx> wrote:
>
> The X-Powers AXP318W is a typical PMIC from X-Powers, featuring nine
> DC/DC converters and 28 LDOs, on the regulator side.
>
> Describe the chip's voltage settings and switch registers, how the
> voltages are encoded, and connect this to the MFD device via its
> regulator ID.
> We use just "318" for the internal identifiers, for easier typing and
> less churn. If something else other than the "AXP318W" shows up, that's
> an easy change, externally visible strings carry the additional letter
> already.
>
> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
> ---
> drivers/regulator/axp20x-regulator.c | 170 ++++++++++++++++++++++++++-
> include/linux/mfd/axp20x.h | 43 +++++++
> 2 files changed, 211 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
> index da891415efc0b..1576bf4178f8f 100644
> --- a/drivers/regulator/axp20x-regulator.c
> +++ b/drivers/regulator/axp20x-regulator.c
> @@ -138,6 +138,15 @@
> #define AXP313A_DCDC_V_OUT_MASK GENMASK(6, 0)
> #define AXP313A_LDO_V_OUT_MASK GENMASK(4, 0)
>
> +#define AXP318_DCDC1_V_OUT_MASK GENMASK(4, 0)
> +#define AXP318_DCDC2_V_OUT_MASK GENMASK(6, 0)
> +#define AXP318_LDO_V_OUT_MASK GENMASK(4, 0)
> +#define AXP318_ELDO_V_OUT_MASK GENMASK(5, 0)

> +#define AXP318_DCDC2_NUM_VOLTAGES 88
> +#define AXP318_DCDC6_NUM_VOLTAGES 128
> +#define AXP318_DCDC7_NUM_VOLTAGES 103
> +#define AXP318_DCDC8_NUM_VOLTAGES 119

Upon closer inspection of the helper code, these aren't actually needed.
My bad for introducing this unused field in the first place.

[...]

> + AXP_DESC(AXP318, ELDO4, "eldo4", "eldoin", 500, 1500, 25,
> + AXP318_ELDO4_CONTROL, AXP318_ELDO_V_OUT_MASK,
> + AXP318_LDO_OUTPUT_CONTROL4, BIT(1)),
> + AXP_DESC(AXP318, ELDO5, "eldo5", "eldoin", 500, 1500, 25,
> + AXP318_ELDO5_CONTROL, AXP318_ELDO_V_OUT_MASK,
> + AXP318_LDO_OUTPUT_CONTROL4, BIT(2)),

eldo4 and eldo5 support operating in switch mode. We can model that as
a bypass mode control. See the *bypass* fields in regulator_desc and
regulator_set_bypass_regmap() / regulator_get_bypass_regmap().

The rest check out. But also see my other reply regarding the 1.54v
threshold.


Thanks
ChenYu