]> git.ipfire.org Git - u-boot.git/commitdiff
sunxi: power: axp818: Add support for switch SW
authorChen-Yu Tsai <wens@csie.org>
Mon, 2 May 2016 02:28:12 +0000 (10:28 +0800)
committerHans de Goede <hdegoede@redhat.com>
Wed, 25 May 2016 15:52:39 +0000 (17:52 +0200)
The AXP818 has a switchable output, SW. This is commonly used for
controlling power to the LCD backlight.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
board/sunxi/board.c
drivers/power/Kconfig
drivers/power/axp818.c
include/axp818.h
include/axp_pmic.h

index 3cf36147b241b4e55ae0770384f4871de7e4ad03..6a0a8dbc4f5efba149a4f070b2a2008cc824f909 100644 (file)
@@ -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:");
index b365fd46fa7180a0b9a22a1352a7e24aec755898..02cb8e7ba6874a3a71beb324874480f89bd4ab0e 100644 (file)
@@ -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
index 3ac05ffefe0120e0e82d7c20e96ed660c5cd0732..bf6ecd6be59701cd994d4dd1bec66eaabca3d52c 100644 (file)
@@ -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;
index 5630eed04d8f0c52d7c2d65c925419d3b79d678a..f7f343a194ab630fc17b3b02e23f8ca366e02ee8 100644 (file)
@@ -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)
index b203cc88ddbc4f4fd4d968925d91349551fc6006..2ed5196354e9bc92b54a3eab159e3de36b3e0b06 100644 (file)
@@ -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);