summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/sunxi/board.c1
-rw-r--r--drivers/power/Kconfig7
-rw-r--r--drivers/power/axp818.c10
-rw-r--r--include/axp818.h1
-rw-r--r--include/axp_pmic.h1
5 files changed, 20 insertions, 0 deletions
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 3cf3614..6a0a8db 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -523,6 +523,7 @@ void sunxi_board_init(void)
power_failed |= axp_set_fldo(1, CONFIG_AXP_FLDO1_VOLT);
power_failed |= axp_set_fldo(2, CONFIG_AXP_FLDO2_VOLT);
power_failed |= axp_set_fldo(3, CONFIG_AXP_FLDO3_VOLT);
+ power_failed |= axp_set_sw(IS_ENABLED(CONFIG_AXP_SW_ON));
#endif
#endif
printf("DRAM:");
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index b365fd4..02cb8e7 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -265,6 +265,13 @@ config AXP_FLDO3_VOLT
Set the voltage (mV) to program the axp pmic fldo3 at, set to 0 to
disable fldo3.
+config AXP_SW_ON
+ bool "axp pmic sw on"
+ depends on AXP818_POWER
+ default n
+ ---help---
+ Enable to turn on axp pmic sw.
+
config SY8106A_VOUT1_VOLT
int "SY8106A pmic VOUT1 voltage"
depends on SY8106A_POWER
diff --git a/drivers/power/axp818.c b/drivers/power/axp818.c
index 3ac05ff..bf6ecd6 100644
--- a/drivers/power/axp818.c
+++ b/drivers/power/axp818.c
@@ -225,6 +225,16 @@ int axp_set_fldo(int fldo_num, unsigned int mvolt)
AXP818_OUTPUT_CTRL3_FLDO1_EN << (fldo_num - 1));
}
+int axp_set_sw(bool on)
+{
+ if (on)
+ return pmic_bus_setbits(AXP818_OUTPUT_CTRL2,
+ AXP818_OUTPUT_CTRL2_SW_EN);
+
+ return pmic_bus_clrbits(AXP818_OUTPUT_CTRL2,
+ AXP818_OUTPUT_CTRL2_SW_EN);
+}
+
int axp_init(void)
{
u8 axp_chip_id;
diff --git a/include/axp818.h b/include/axp818.h
index 5630eed..f7f343a 100644
--- a/include/axp818.h
+++ b/include/axp818.h
@@ -24,6 +24,7 @@
#define AXP818_OUTPUT_CTRL2_DLDO2_EN (1 << 4)
#define AXP818_OUTPUT_CTRL2_DLDO3_EN (1 << 5)
#define AXP818_OUTPUT_CTRL2_DLDO4_EN (1 << 6)
+#define AXP818_OUTPUT_CTRL2_SW_EN (1 << 7)
#define AXP818_OUTPUT_CTRL3 0x13
#define AXP818_OUTPUT_CTRL3_FLDO1_EN (1 << 2)
#define AXP818_OUTPUT_CTRL3_FLDO2_EN (1 << 3)
diff --git a/include/axp_pmic.h b/include/axp_pmic.h
index b203cc8..2ed5196 100644
--- a/include/axp_pmic.h
+++ b/include/axp_pmic.h
@@ -32,6 +32,7 @@ int axp_set_aldo4(unsigned int mvolt);
int axp_set_dldo(int dldo_num, unsigned int mvolt);
int axp_set_eldo(int eldo_num, unsigned int mvolt);
int axp_set_fldo(int fldo_num, unsigned int mvolt);
+int axp_set_sw(bool on);
int axp_init(void);
int axp_get_sid(unsigned int *sid);