[PATCH] add axp313a support

SASANO Takayoshi uaa at mx5.nisiq.net
Sun Jul 16 02:36:32 CEST 2023


Hello,

On Sun, 16 Jul 2023 08:40:36 +0900,
Simon Glass wrote:
> 
> Hi,
> 
> On Sat, 15 Jul 2023 at 16:01, SASANO Takayoshi <uaa at mx5.nisiq.net> wrote:
> >
> >
> > Here is the diff of AXP313A PMIC driver.
> > (No board configuration is included)
> >
> > Signed-off-by: SASANO Takayoshi <uaa at uaa.org.uk>
> > ---
> >
> >  arch/arm/mach-sunxi/pmic_bus.c |   4 +-
> >  board/sunxi/board.c            |   9 +-
> >  drivers/power/Kconfig          |  16 ++-
> >  drivers/power/Makefile         |   1 +
> >  drivers/power/axp313a.c        | 171 +++++++++++++++++++++++++++++++++
> >  drivers/power/pmic/axp.c       |   1 +
> >  include/axp313a.h              |  31 ++++++
> >  include/axp_pmic.h             |   2 +
> >  8 files changed, 226 insertions(+), 9 deletions(-)
> >  create mode 100644 drivers/power/axp313a.c
> >  create mode 100644 include/axp313a.h
> >
> 
> Please can you write this to use driver model? There is a pmic uclass.

This is controller-specific driver for power/pmic/axp.c.
axp.c (axp_pmic) belongs to UCLASS_PMIC.

--
U_BOOT_DRIVER(axp_pmic) = {
        .name           = "axp_pmic",
        .id             = UCLASS_PMIC,
        .of_match       = axp_pmic_ids,
        .bind           = axp_pmic_bind,
        .ops            = &axp_pmic_ops,
};
--

> > diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> > index f321cd58a6..9b0069cd52 100644
> > --- a/board/sunxi/board.c
> > +++ b/board/sunxi/board.c
> > @@ -584,6 +584,7 @@ void sunxi_board_init(void)
> >
> >  #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || \
> >         defined CONFIG_AXP221_POWER || defined CONFIG_AXP305_POWER || \
> > +       defined CONFIG_AXP313A_POWER || \
> >         defined CONFIG_AXP809_POWER || defined CONFIG_AXP818_POWER
> >         power_failed = axp_init();
> >
> > @@ -605,7 +606,8 @@ void sunxi_board_init(void)
> >         power_failed |= axp_set_dcdc2(CONFIG_AXP_DCDC2_VOLT);
> >         power_failed |= axp_set_dcdc3(CONFIG_AXP_DCDC3_VOLT);
> >  #endif
> > -#if !defined(CONFIG_AXP209_POWER) && !defined(CONFIG_AXP818_POWER)
> > +#if !defined(CONFIG_AXP209_POWER) && !defined(CONFIG_AXP818_POWER) && \
> > +       !defined(CONFIG_AXP313A_POWER)
> >         power_failed |= axp_set_dcdc4(CONFIG_AXP_DCDC4_VOLT);
> >  #endif
> >  #if defined CONFIG_AXP221_POWER || defined CONFIG_AXP809_POWER || \
> > @@ -617,10 +619,11 @@ void sunxi_board_init(void)
> >         defined CONFIG_AXP818_POWER
> >         power_failed |= axp_set_aldo1(CONFIG_AXP_ALDO1_VOLT);
> >  #endif
> > -#if !defined(CONFIG_AXP305_POWER)
> > +#if !defined(CONFIG_AXP305_POWER) && !defined(CONFIG_AXP313A_POWER)
> >         power_failed |= axp_set_aldo2(CONFIG_AXP_ALDO2_VOLT);
> >  #endif
> > -#if !defined(CONFIG_AXP152_POWER) && !defined(CONFIG_AXP305_POWER)
> > +#if !defined(CONFIG_AXP152_POWER) && !defined(CONFIG_AXP305_POWER) && \
> > +       !defined(CONFIG_AXP313A_POWER)
> >         power_failed |= axp_set_aldo3(CONFIG_AXP_ALDO3_VOLT);
> >  #endif
> 
> OMG that is a mess. It looks like sunxi needs some conversion.

I think so. We have to rewrite what regulator output (dcdcX, aldoX, etc..)
is supported (not by controller name), but is it necessary before
adding AXP313A code?

Best regards,
-- 
SASANO Takayoshi (JG1UAA) <uaa at mx5.nisiq.net>


More information about the U-Boot mailing list