diff options
author | David Hendricks <dhendrix@chromium.org> | 2012-08-28 11:02:22 -0700 |
---|---|---|
committer | David Hendricks <dhendrix@chromium.org> | 2012-08-29 21:15:45 -0700 |
commit | 61e747bad4bbaeb8250a47d801db232d4454f754 (patch) | |
tree | f50b7c0f5fa3bef57233ae763ff87f97fbbcaa37 | |
parent | b4bbc013998fb3920e4a95cddffdcc79c88fc467 (diff) | |
download | chrome-ec-61e747bad4bbaeb8250a47d801db232d4454f754.tar.gz |
gaia: update ap_suspended usage
This CL updates ap_suspended usage so that it's only updated when it
makes sense to do so:
- Clear ap_suspended during power_off() since it can only be reliably
determined when the pull-up on PA7 is enabled (when AP is on).
- chipset_in_state() should not re-assign ap_suspended. That was a hack
to try to get around earlier brokenness. However, that does not
really work since SUSPEND_L can appear to be asserted when AP is
off and could cause ap_suspended to become inconsistent with the
actual AP state.
- When AP is on, ap_suspended should be managed by gaia_suspend_event.
When AP is off, ap_suspended should be 0 (
Signed-off-by: David Hendricks <dhendrix@chromium.org>
BRANCH=snow
BUG=chrome-os-partner:13200
TEST=tested on Snow using "power" command at EC console
1. AP running
> power
on
2. after running powerd_suspend
> power
suspend
3. "power off" at EC console
> power
off
Change-Id: I88dad9f02d57fe7244bf607eea2088ee0b80b75a
Reviewed-on: https://gerrit.chromium.org/gerrit/31627
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31790
-rw-r--r-- | common/gaia_power.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/common/gaia_power.c b/common/gaia_power.c index a3de5b91df..de7b0c6662 100644 --- a/common/gaia_power.c +++ b/common/gaia_power.c @@ -214,6 +214,10 @@ void gaia_suspend_event(enum gpio_signal signal) if (!ap_on) /* power on/off : not a real suspend / resume */ return; + /* + * Note: For Snow, suspend state can only be reliably + * determined when the AP is on (crosbug.com/p/13200). + */ ap_suspended = !gpio_get_level(GPIO_SUSPEND_L); if (ap_suspended) { @@ -268,13 +272,6 @@ int gaia_power_init(void) int chipset_in_state(int state_mask) { - /* - * TODO(rongchang): fix suspend signal - * gaia_suspend_event() doesn't work. get ap_suspended - * again. - */ - ap_suspended = !gpio_get_level(GPIO_SUSPEND_L); - /* If AP is off, match any off state for now */ if ((state_mask & CHIPSET_STATE_ANY_OFF) && !ap_on) return 1; @@ -444,6 +441,7 @@ static void power_off(void) gpio_set_level(GPIO_PMIC_PWRON_L, 1); gpio_set_level(GPIO_EN_PP5000, 0); ap_on = 0; + ap_suspended = 0; lid_changed = 0; enable_sleep(SLEEP_MASK_AP_RUN); powerled_set_state(POWERLED_STATE_OFF); |