]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
sunxi: axp221: Add ELDO[1-3] support
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>
Mon, 19 Jan 2015 03:23:30 +0000 (05:23 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 22 Jan 2015 11:34:56 +0000 (12:34 +0100)
And also add Kconfig option for selecting ELDO3 voltage. The reason
for having this option is that the Android kernel sets ELDO3 to
1.2V when powering up LCD in the case if 'lcd_if' configuration
variable is set to 6 (LCD_IF_EXT_DSI) in the FEX file. Most likely
to supply power for a SSD2828 chip.

However on the MSI Primo81 tablet, which is using this particular
'lcd_if = 6' setup for LCD, setting the ELDO3 voltage appears to
be unnecessary and it works regardless. Having no schematics of
this tablet, I can only guess that 1.2V is supplied to SSD2828
in some other way.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-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/axp221.c
include/axp221.h

index 7d6d075f145ee93d4e3463544b7ccd3694ec9771..6b19f75e9cf00b1e982310a3922daf9c0d366f8d 100644 (file)
@@ -189,6 +189,7 @@ void sunxi_board_init(void)
        power_failed |= axp221_set_aldo1(CONFIG_AXP221_ALDO1_VOLT);
        power_failed |= axp221_set_aldo2(CONFIG_AXP221_ALDO2_VOLT);
        power_failed |= axp221_set_aldo3(CONFIG_AXP221_ALDO3_VOLT);
+       power_failed |= axp221_set_eldo(3, CONFIG_AXP221_ELDO3_VOLT);
 #endif
 
        printf("DRAM:");
index e68e16b3211757271a27e99d0089fbf4b29fc83f..f8f0239484fd43811cbf9dc9fcff3bb6dec179ef 100644 (file)
@@ -63,3 +63,13 @@ config AXP221_ALDO3_VOLT
        Set the voltage (mV) to program the axp221 aldo3 at, set to 0 to
        disable aldo3. This is typically connected to VCC-PLL and AVCC and
        must be set to 3V.
+
+config AXP221_ELDO3_VOLT
+       int "axp221 eldo3 voltage"
+       depends on AXP221_POWER
+       default 0
+       ---help---
+       Set the voltage (mV) to program the axp221 eldo3 at, set to 0 to
+       disable eldo3. On some A31(s) tablets it might be used to supply
+       1.2V for the SSD2828 chip (converter of parallel LCD interface
+       into MIPI DSI).
index 4c86f099a2df52bb8223ed17115cbbc3da3232bf..58bbd45a021af80bd8eee172be9054cf85572641 100644 (file)
@@ -302,6 +302,39 @@ int axp221_set_aldo3(unsigned int mvolt)
                              AXP221_OUTPUT_CTRL3_ALDO3_EN);
 }
 
+int axp221_set_eldo(int eldo_num, unsigned int mvolt)
+{
+       int ret;
+       u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
+       u8 addr, bits;
+
+       switch (eldo_num) {
+       case 3:
+               addr = AXP221_ELDO3_CTRL;
+               bits = AXP221_OUTPUT_CTRL2_ELDO3_EN;
+               break;
+       case 2:
+               addr = AXP221_ELDO2_CTRL;
+               bits = AXP221_OUTPUT_CTRL2_ELDO2_EN;
+               break;
+       case 1:
+               addr = AXP221_ELDO1_CTRL;
+               bits = AXP221_OUTPUT_CTRL2_ELDO1_EN;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if (mvolt == 0)
+               return axp221_clrbits(AXP221_OUTPUT_CTRL2, bits);
+
+       ret = pmic_bus_write(addr, cfg);
+       if (ret)
+               return ret;
+
+       return axp221_setbits(AXP221_OUTPUT_CTRL2, bits);
+}
+
 int axp221_init(void)
 {
        /* This cannot be 0 because it is used in SPL before BSS is ready */
index e6639f1ffe694b12b9dbf79f0a7f9b57102c2185..6f24a617b67263f5fd43b5c10629f022cb9e5a03 100644 (file)
@@ -26,6 +26,9 @@
 #define AXP221_OUTPUT_CTRL1_ALDO1_EN   (1 << 6)
 #define AXP221_OUTPUT_CTRL1_ALDO2_EN   (1 << 7)
 #define AXP221_OUTPUT_CTRL2    0x12
+#define AXP221_OUTPUT_CTRL2_ELDO1_EN   (1 << 0)
+#define AXP221_OUTPUT_CTRL2_ELDO2_EN   (1 << 1)
+#define AXP221_OUTPUT_CTRL2_ELDO3_EN   (1 << 2)
 #define AXP221_OUTPUT_CTRL2_DLDO1_EN   (1 << 3)
 #define AXP221_OUTPUT_CTRL2_DLDO2_EN   (1 << 4)
 #define AXP221_OUTPUT_CTRL2_DLDO3_EN   (1 << 5)
@@ -37,6 +40,9 @@
 #define AXP221_DLDO2_CTRL      0x16
 #define AXP221_DLDO3_CTRL      0x17
 #define AXP221_DLDO4_CTRL      0x18
+#define AXP221_ELDO1_CTRL      0x19
+#define AXP221_ELDO2_CTRL      0x1a
+#define AXP221_ELDO3_CTRL      0x1b
 #define AXP221_DCDC1_CTRL      0x21
 #define AXP221_DCDC2_CTRL      0x22
 #define AXP221_DCDC3_CTRL      0x23
@@ -69,6 +75,7 @@ int axp221_set_dldo4(unsigned int mvolt);
 int axp221_set_aldo1(unsigned int mvolt);
 int axp221_set_aldo2(unsigned int mvolt);
 int axp221_set_aldo3(unsigned int mvolt);
+int axp221_set_eldo(int eldo_num, unsigned int mvolt);
 int axp221_init(void);
 int axp221_get_sid(unsigned int *sid);
 int axp_drivebus_enable(void);