Re: [PATCH v2 3/3] regulator: axp20x: add support for the AXP318W
From: Jerome Brunet
Date: Fri Jul 10 2026 - 12:28:24 EST
On ven. 10 juil. 2026 at 18:19, Jerome Brunet <jbrunet@xxxxxxxxxxxx> wrote:
> From: Andre Przywara <andre.przywara@xxxxxxx>
>
> 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.
>
> Reviewed-by: Mark Brown <broonie@xxxxxxxxxx>
> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
> Co-developed-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
> Signed-off-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
> ---
> drivers/regulator/axp20x-regulator.c | 298 ++++++++++++++++++++++++++++++++++-
> include/linux/mfd/axp20x.h | 43 +++++
> 2 files changed, 333 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
> index da891415efc0..bc8d3aa2bd67 100644
> --- a/drivers/regulator/axp20x-regulator.c
> +++ b/drivers/regulator/axp20x-regulator.c
> @@ -138,6 +138,31 @@
> #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
Silly me. I was sure I removed this and missed it - will be removed in v3
> +#define AXP318_THRESHOLD_VOLTAGE 1540000
> +/*
> + * FIXME:
> + * Some LDOs of the AXP318 may be fed by different supplies and
> + * the documentation repeatidly warns that output voltage must
> + * be less than the supply, which is the case for any LDO really.
> + *
> + * The best way to let the framework handle this is to set the
> + * min_dropout_uV field. However the AXP318 documentation
> + * does not provide any information about this.
> + *
> + * Realistically, it can't be less than 1uV so use this
> + * for all LDOs until we know more.
> + */
> +#define AXP318_LDO_MIN_DROPOUT 1 /* uV */
> +