From 5251382d0b7d42ccd98b14e06c1337b53b961663 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Wed, 18 Jul 2012 15:09:13 -0700 Subject: [PATCH] Send hook notification on GAIA power event GAIA power module should send hook notification when power state changes. BUG=chrome-os-partner:11536 TEST=Hook a console message to HOOK_CHIPSET_SHUTDOWN and check this message is printed to console when system shuts down. Change-Id: I5bc3e69eeefeeda453526625887f852b9095ac08 Signed-off-by: Vic Yang Reviewed-on: https://gerrit.chromium.org/gerrit/27814 Reviewed-by: Randall Spangler --- common/gaia_power.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/gaia_power.c b/common/gaia_power.c index 7f4b4eb474..52ff007d1a 100644 --- a/common/gaia_power.c +++ b/common/gaia_power.c @@ -27,6 +27,7 @@ #include "chipset.h" /* This module implements chipset functions too */ #include "console.h" #include "gpio.h" +#include "hooks.h" #include "keyboard_scan.h" #include "power_led.h" #include "task.h" @@ -216,8 +217,11 @@ void gaia_suspend_event(enum gpio_signal signal) powerled_set_state(POWERLED_STATE_SUSPEND); else powerled_set_state(POWERLED_STATE_OFF); + /* Call hooks here since we don't know it prior to AP suspend */ + hook_notify(HOOK_CHIPSET_SUSPEND, 0); } else { powerled_set_state(POWERLED_STATE_ON); + hook_notify(HOOK_CHIPSET_RESUME, 0); } } @@ -365,6 +369,10 @@ static int power_on(void) gpio_set_level(GPIO_EN_PP3300, 1); ap_on = 1; powerled_set_state(POWERLED_STATE_ON); + + /* Call hooks now that AP is running */ + hook_notify(HOOK_CHIPSET_STARTUP, 0); + CPUTS("AP running ...\n"); return 0; } @@ -393,6 +401,8 @@ static int wait_for_power_button_release(unsigned int timeout_us) */ static void power_off(void) { + /* Call hooks before we drop power rails */ + hook_notify(HOOK_CHIPSET_SHUTDOWN, 0); /* switch off all rails */ gpio_set_level(GPIO_EN_PP3300, 0); gpio_set_level(GPIO_EN_PP1350, 0);