
Hi,
On Sat, 15 Jul 2023 at 16:01, SASANO Takayoshi uaa@mx5.nisiq.net wrote:
Here is the diff of AXP313A PMIC driver. (No board configuration is included)
Signed-off-by: SASANO Takayoshi uaa@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.
diff --git a/arch/arm/mach-sunxi/pmic_bus.c b/arch/arm/mach-sunxi/pmic_bus.c index c090840637..3e7bb5a5d1 100644 --- a/arch/arm/mach-sunxi/pmic_bus.c +++ b/arch/arm/mach-sunxi/pmic_bus.c @@ -21,7 +21,7 @@
#define AXP209_I2C_ADDR 0x34
-#define AXP305_I2C_ADDR 0x36 +#define AXP305_I2C_ADDR 0x36 /* AXP305 and AXP313A */
#define AXP221_CHIP_ADDR 0x68
@@ -32,7 +32,7 @@ static int pmic_i2c_address(void) { if (IS_ENABLED(CONFIG_AXP152_POWER)) return AXP152_I2C_ADDR;
if (IS_ENABLED(CONFIG_AXP305_POWER))
if (IS_ENABLED(CONFIG_AXP305_POWER) || IS_ENABLED(CONFIG_AXP313A_POWER)) return AXP305_I2C_ADDR; /* Other AXP2xx and AXP8xx variants */
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.
#ifdef CONFIG_AXP209_POWER diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 7f3b990d23..12189eec9f 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -101,6 +101,14 @@ config AXP305_POWER Select this to enable support for the axp305 pmic found on most H616 boards.
+config AXP313A_POWER
bool "axp313a pmic support"
select AXP_PMIC_BUS
select CMD_POWEROFF
---help---
Select this to enable support for the axp313a pmic found on some
H616 boards.
Regards, Simon