summaryrefslogtreecommitdiff
path: root/drivers/mfd/axp20x.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2016-06-05 13:50:48 (GMT)
committerLee Jones <lee.jones@linaro.org>2016-06-29 09:14:32 (GMT)
commit179dc63d06c51a78483dedbdf34540af053a6269 (patch)
tree0637035191674fbfc2600e4c85a7ca1eb72af8a1 /drivers/mfd/axp20x.c
parent2be59755e66d34f46001ca19224ab4cefb212c51 (diff)
downloadlinux-179dc63d06c51a78483dedbdf34540af053a6269.tar.xz
mfd: axp20x: Add a 500ms delay at the end of axp20x_power_off
The kernel expects the power_off function to not return, and if it does it panics. Add a slight delay after the i2c write which turns off power through the PMIC, to give capacitors etc. some time to drain. Without this the kernel lives on long enough after the poweroff to print the following on the serial console on my Mele A1000G quad: [ 248.583588] reboot: Power down [ 248.600490] Kernel pa With the delay the start of printing "Kernel panic" is gone. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/axp20x.c')
-rw-r--r--drivers/mfd/axp20x.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index ca04361..a1ed43e 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -17,6 +17,7 @@
*/
#include <linux/err.h>
+#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
@@ -667,6 +668,9 @@ static void axp20x_power_off(void)
regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL,
AXP20X_OFF);
+
+ /* Give capacitors etc. time to drain to avoid kernel panic msg. */
+ msleep(500);
}
int axp20x_match_device(struct axp20x_dev *axp20x)