diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2016-02-27 19:19:14 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-03-15 15:12:58 -0400 |
commit | ee85a4152516daf57ce1f05b16e5f06ab4f3cf91 (patch) | |
tree | 88e9f58bd299dd29d6a3c8f92e1221bb20d1c05d /board/amazon | |
parent | 461484c27e1d72980eae4826eb9788a156cdf00e (diff) | |
download | u-boot-ee85a4152516daf57ce1f05b16e5f06ab4f3cf91.tar.gz |
kc1: Power off when the power on reason is not a valid one
Some power on reasons are not desirable (e.g. too short press on the power
button), battery plug. Thus, power off the device when one of those occurs.
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'board/amazon')
-rw-r--r-- | board/amazon/kc1/kc1.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c index 9367b50da3..54e3fa31a7 100644 --- a/board/amazon/kc1/kc1.c +++ b/board/amazon/kc1/kc1.c @@ -86,6 +86,7 @@ int board_init(void) int misc_init_r(void) { char reboot_mode[2] = { 0 }; + u32 data = 0; u32 value; /* Reboot mode */ @@ -101,10 +102,25 @@ int misc_init_r(void) reboot_mode[0] = 'b'; if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) { + if (reboot_mode[0] == 'o') + twl6030_power_off(); + if (!getenv("reboot-mode")) setenv("reboot-mode", (char *)reboot_mode); omap_reboot_mode_clear(); + } else { + /* + * When not rebooting, valid power on reasons are either the + * power button, charger plug or USB plug. + */ + + data |= twl6030_input_power_button(); + data |= twl6030_input_charger(); + data |= twl6030_input_usb(); + + if (!data) + twl6030_power_off(); } /* Serial number */ |