[PATCH 1/3] power: pmic: axp: Provide a variant ID in the driver data

Andre Przywara andre.przywara at arm.com
Thu Jan 12 00:08:32 CET 2023


On Mon, 28 Nov 2022 00:47:54 -0600
Samuel Holland <samuel at sholland.org> wrote:

> Subordinate regulator drivers can use this enumerated ID instead of
> matching the compatible string again.
> 
> Signed-off-by: Samuel Holland <samuel at sholland.org>

Reviewed-by: Andre Przywara <andre.przywara at arm.com>

Cheers,
Andre

> ---
> 
>  drivers/power/pmic/axp.c | 18 +++++++++---------
>  include/axp_pmic.h       | 12 ++++++++++++
>  2 files changed, 21 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/power/pmic/axp.c b/drivers/power/pmic/axp.c
> index 0f2b24a8b5f..e0005994e21 100644
> --- a/drivers/power/pmic/axp.c
> +++ b/drivers/power/pmic/axp.c
> @@ -64,15 +64,15 @@ static int axp_pmic_bind(struct udevice *dev)
>  }
>  
>  static const struct udevice_id axp_pmic_ids[] = {
> -	{ .compatible = "x-powers,axp152" },
> -	{ .compatible = "x-powers,axp202" },
> -	{ .compatible = "x-powers,axp209" },
> -	{ .compatible = "x-powers,axp221" },
> -	{ .compatible = "x-powers,axp223" },
> -	{ .compatible = "x-powers,axp803" },
> -	{ .compatible = "x-powers,axp806" },
> -	{ .compatible = "x-powers,axp809" },
> -	{ .compatible = "x-powers,axp813" },
> +	{ .compatible = "x-powers,axp152", .data = AXP152_ID },
> +	{ .compatible = "x-powers,axp202", .data = AXP202_ID },
> +	{ .compatible = "x-powers,axp209", .data = AXP209_ID },
> +	{ .compatible = "x-powers,axp221", .data = AXP221_ID },
> +	{ .compatible = "x-powers,axp223", .data = AXP223_ID },
> +	{ .compatible = "x-powers,axp803", .data = AXP803_ID },
> +	{ .compatible = "x-powers,axp806", .data = AXP806_ID },
> +	{ .compatible = "x-powers,axp809", .data = AXP809_ID },
> +	{ .compatible = "x-powers,axp813", .data = AXP813_ID },
>  	{ }
>  };
>  
> diff --git a/include/axp_pmic.h b/include/axp_pmic.h
> index 01ebba63479..4ac64865831 100644
> --- a/include/axp_pmic.h
> +++ b/include/axp_pmic.h
> @@ -26,6 +26,18 @@
>  #define AXP_PMIC_SEC_DEVICE_ADDR	0x745
>  #define AXP_PMIC_SEC_RUNTIME_ADDR	0x3a
>  
> +enum {
> +	AXP152_ID,
> +	AXP202_ID,
> +	AXP209_ID,
> +	AXP221_ID,
> +	AXP223_ID,
> +	AXP803_ID,
> +	AXP806_ID,
> +	AXP809_ID,
> +	AXP813_ID,
> +};
> +
>  int axp_set_dcdc1(unsigned int mvolt);
>  int axp_set_dcdc2(unsigned int mvolt);
>  int axp_set_dcdc3(unsigned int mvolt);



More information about the U-Boot mailing list