[U-Boot] [PATCH 1/8] sunxi: axp221: Add ELDO[1-3] support
Siarhei Siamashka
siarhei.siamashka at gmail.com
Fri Jan 9 11:01:09 CET 2015
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 at gmail.com>
---
board/sunxi/board.c | 1 +
drivers/power/Kconfig | 10 ++++++++++
drivers/power/axp221.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
include/axp221.h | 9 +++++++++
4 files changed, 71 insertions(+)
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 7d6d075..12a2e77 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -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_eldo3(CONFIG_AXP221_ELDO3_VOLT);
#endif
printf("DRAM:");
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index ef0c093..cf42e63 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -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 (convertor of parallel LCD interface
+ into MIPI DSI).
diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
index 1fda19a..d041b30 100644
--- a/drivers/power/axp221.c
+++ b/drivers/power/axp221.c
@@ -302,6 +302,57 @@ int axp221_set_aldo3(unsigned int mvolt)
AXP221_OUTPUT_CTRL3_ALDO3_EN);
}
+int axp221_set_eldo1(unsigned int mvolt)
+{
+ int ret;
+ u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
+
+ if (mvolt == 0)
+ return axp221_clrbits(AXP221_OUTPUT_CTRL2,
+ AXP221_OUTPUT_CTRL2_ELDO1_EN);
+
+ ret = pmic_bus_write(AXP221_ELDO1_CTRL, cfg);
+ if (ret)
+ return ret;
+
+ return axp221_setbits(AXP221_OUTPUT_CTRL2,
+ AXP221_OUTPUT_CTRL2_ELDO1_EN);
+}
+
+int axp221_set_eldo2(unsigned int mvolt)
+{
+ int ret;
+ u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
+
+ if (mvolt == 0)
+ return axp221_clrbits(AXP221_OUTPUT_CTRL2,
+ AXP221_OUTPUT_CTRL2_ELDO2_EN);
+
+ ret = pmic_bus_write(AXP221_ELDO2_CTRL, cfg);
+ if (ret)
+ return ret;
+
+ return axp221_setbits(AXP221_OUTPUT_CTRL2,
+ AXP221_OUTPUT_CTRL2_ELDO2_EN);
+}
+
+int axp221_set_eldo3(unsigned int mvolt)
+{
+ int ret;
+ u8 cfg = axp221_mvolt_to_cfg(mvolt, 700, 3300, 100);
+
+ if (mvolt == 0)
+ return axp221_clrbits(AXP221_OUTPUT_CTRL2,
+ AXP221_OUTPUT_CTRL2_ELDO3_EN);
+
+ ret = pmic_bus_write(AXP221_ELDO3_CTRL, cfg);
+ if (ret)
+ return ret;
+
+ return axp221_setbits(AXP221_OUTPUT_CTRL2,
+ AXP221_OUTPUT_CTRL2_ELDO3_EN);
+}
+
int axp221_init(void)
{
u8 axp_chip_id;
diff --git a/include/axp221.h b/include/axp221.h
index e9552f6..da63891 100644
--- a/include/axp221.h
+++ b/include/axp221.h
@@ -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
@@ -62,5 +68,8 @@ 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_eldo1(unsigned int mvolt);
+int axp221_set_eldo2(unsigned int mvolt);
+int axp221_set_eldo3(unsigned int mvolt);
int axp221_init(void);
int axp221_get_sid(unsigned int *sid);
--
2.0.5
More information about the U-Boot
mailing list