mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-19 05:31:32 +00:00
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>
This commit is contained in:
parent
461484c27e
commit
ee85a41525
2 changed files with 22 additions and 0 deletions
|
@ -86,6 +86,7 @@ int board_init(void)
|
||||||
int misc_init_r(void)
|
int misc_init_r(void)
|
||||||
{
|
{
|
||||||
char reboot_mode[2] = { 0 };
|
char reboot_mode[2] = { 0 };
|
||||||
|
u32 data = 0;
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
/* Reboot mode */
|
/* Reboot mode */
|
||||||
|
@ -101,10 +102,25 @@ int misc_init_r(void)
|
||||||
reboot_mode[0] = 'b';
|
reboot_mode[0] = 'b';
|
||||||
|
|
||||||
if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
|
if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
|
||||||
|
if (reboot_mode[0] == 'o')
|
||||||
|
twl6030_power_off();
|
||||||
|
|
||||||
if (!getenv("reboot-mode"))
|
if (!getenv("reboot-mode"))
|
||||||
setenv("reboot-mode", (char *)reboot_mode);
|
setenv("reboot-mode", (char *)reboot_mode);
|
||||||
|
|
||||||
omap_reboot_mode_clear();
|
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 */
|
/* Serial number */
|
||||||
|
|
|
@ -104,6 +104,12 @@
|
||||||
|
|
||||||
#define CONFIG_TWL6030_POWER
|
#define CONFIG_TWL6030_POWER
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Input
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CONFIG_TWL6030_INPUT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Partitions
|
* Partitions
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue