summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorOlliver Schinagl <oliver@schinagl.nl>2018-11-21 21:05:31 +0300
committerJagan Teki <jagan@amarulasolutions.com>2018-12-07 19:54:33 +0300
commitef52605ebeb4fa2a97454ab225db6514519427fb (patch)
treef36f06cd03b522d47fd25a32ec849217c7c21816 /drivers/power
parent61436d502b33854ddf33797670d4e25c0d79d540 (diff)
downloadu-boot-ef52605ebeb4fa2a97454ab225db6514519427fb.tar.xz
power: axp209: Limit inrush current for broken boards
Some boards feature a capacitance on LDO3's output that is too large, causing inrush currents which as a result, shut down the AXP209. This has been reported before, without knowing the actual cause. A fix appeared to be done with commit 0e6e34ac8dbb ("sunxi: Olimex A20 boards: Enable LDO3 and LDO4 regulators"). The description there is a bit misleading, the kernel does not hang during AXP209 initialization, the PMIC shuts down, causing voltages to drop and thus the whole system freezes. While the AXP209 does have the ability to ramp up the voltage slowly, to reduce these inrush currents, the voltage rate control (VRC) however is not applicable when switching on the LDO3 output. Only when going from an enabled lower voltage setting, to a higher voltage setting is the VRC in effect. To work around this problem, we set LDO3 to the lowest possible setting of 0.7 V if it was not yet enabled, and then let the VRC (if enabled) do its thing. It should be noted, that for some undocumented reason, there is a short delay needed between setting the LDO3 voltage register and enabling the power. One would expect that this delay ought to be just after enabling the output power at 0.7 V, but this did not work. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl> Signed-off-by: Priit Laes <plaes@plaes.org> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/Kconfig9
-rw-r--r--drivers/power/axp209.c23
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index e83036fd66..9495dca33b 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -231,6 +231,15 @@ config AXP_ALDO3_VOLT_SLOPE_08
endchoice
+config AXP_ALDO3_INRUSH_QUIRK
+ bool "axp pmic (a)ldo3 inrush quirk"
+ depends on AXP209_POWER
+ default n
+ ---help---
+ The reference design denotes a value of 4.7 uF for the output capacitor
+ of LDO3. Some boards have too high capacitance causing an inrush current
+ and resulting an AXP209 shutdown.
+
config AXP_ALDO4_VOLT
int "axp pmic (a)ldo4 voltage"
depends on AXP209_POWER
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
index cf138fc722..67b420910c 100644
--- a/drivers/power/axp209.c
+++ b/drivers/power/axp209.c
@@ -122,6 +122,29 @@ int axp_set_aldo3(unsigned int mvolt)
if (rc)
return rc;
+#ifdef CONFIG_AXP_ALDO3_INRUSH_QUIRK
+ /*
+ * On some boards, LDO3 has a too big capacitor installed. When
+ * turning on LDO3, this causes the AXP209 to shutdown on
+ * voltages over 1.9 volt. As a workaround, we enable LDO3
+ * first with the lowest possible voltage. If this still causes
+ * high inrush currents, the voltage slope should be increased.
+ */
+ rc = pmic_bus_read(AXP209_OUTPUT_CTRL, &cfg);
+ if (rc)
+ return rc;
+
+ if (!(cfg & AXP209_OUTPUT_CTRL_LDO3)) {
+ rc = pmic_bus_write(AXP209_LDO3_VOLTAGE, 0x0); /* 0.7 Volt */
+ mdelay(1);
+ rc |= pmic_bus_setbits(AXP209_OUTPUT_CTRL,
+ AXP209_OUTPUT_CTRL_LDO3);
+
+ if (rc)
+ return rc;
+ }
+#endif
+
if (mvolt == -1) {
cfg = AXP209_LDO3_VOLTAGE_FROM_LDO3IN;
} else {