gaia_power: Report power on reason

Report the reason for a power on, to assist with debugging.

BUG=chrome-os-partner:11307
BRANCH=snow
TEST=manual
Build and boot on snow
See that power on reason is now reported

> 0.003508 power on 2
[0.028674 AP running ...]
...
12.163780 ending loop 2
Shutdown complete.
[batt] state discharging -> idle
17.801167 power on 4
Overriding CHARGER_INT with CHARGER_INT on EXTI4
[17.825873 AP running ...]
17.826071 XPSHOLD seen
[batt] state idle -> discharg

Change-Id: I2044419b330a74d19d8c4e63fa8853aa477b4df1
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32301
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Simon Glass
2012-09-05 15:42:52 -07:00
committed by Gerrit
parent c5652fbcfc
commit e6d9ea96f3

View File

@@ -312,7 +312,7 @@ static int check_for_power_on_event(void)
/* power on requested at EC startup for recovery */
if (auto_power_on) {
auto_power_on = 0;
return 1;
return 2;
}
/* to avoid false positives, check lid only if a change was detected */
@@ -320,7 +320,7 @@ static int check_for_power_on_event(void)
udelay(LID_SWITCH_DEBOUNCE);
if (gpio_get_level(GPIO_LID_OPEN) == 1) {
lid_changed = 0;
return 1;
return 3;
}
}
@@ -328,12 +328,12 @@ static int check_for_power_on_event(void)
if (gpio_get_level(GPIO_KB_PWR_ON_L) == 0) {
udelay(KB_PWR_ON_DEBOUNCE);
if (gpio_get_level(GPIO_KB_PWR_ON_L) == 0)
return 1;
return 4;
}
if (power_request == POWER_REQ_ON) {
power_request = POWER_REQ_NONE;
return 4;
return 5;
}
return 0;
@@ -481,8 +481,9 @@ void gaia_power_task(void)
while (1) {
/* Wait until we need to power on, then power on */
while (!check_for_power_on_event())
while (value = check_for_power_on_event(), !value)
task_wait_event(-1);
CPRINTF("%T power on %d\n", value);
if (!power_on()) {
int continue_power = 0;