diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-04-18 13:03:38 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-04-19 08:39:41 -0700 |
commit | 70f3fcaf8648230a5cd27a9da151494d6df3016f (patch) | |
tree | c67e9ff911914f7eaef7af6c9e95874cf8d0cce2 /chip/lm4/clock.c | |
parent | 6ecbb86b6392fa0b11514903a9fb3d3a3b704391 (diff) | |
download | chrome-ec-70f3fcaf8648230a5cd27a9da151494d6df3016f.tar.gz |
Add hooks module so modules can be notified of system-level events.
This will be used for sleep/wake/sysjump/etc. For now it's just wired
up to clock frequency changing.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=none
TEST=manual: use nopll command, should still work
Change-Id: Iedcea5830bc18eacfd955c29b8f793aba8905dd8
Diffstat (limited to 'chip/lm4/clock.c')
-rw-r--r-- | chip/lm4/clock.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c index 694f1bc1b9..12a1896ff7 100644 --- a/chip/lm4/clock.c +++ b/chip/lm4/clock.c @@ -10,6 +10,7 @@ #include "config.h" #include "console.h" #include "gpio.h" +#include "hooks.h" #include "registers.h" #include "system.h" #include "task.h" @@ -178,34 +179,10 @@ static int command_sleep(int argc, char **argv) DECLARE_CONSOLE_COMMAND(sleep, command_sleep); -/* TODO: temporary holding place for notifying modules of clock change. Should - * be moved to main.c after we finish measuring the power savings, so the clock - * frequency is automatically dropped after verified boot. */ -#include "i2c.h" -#include "hwtimer.h" -#include "peci.h" -#include "watchdog.h" - static int command_disable_pll(int argc, char **argv) { - int freq; - - clock_disable_pll(); - /* Notify modules of frequency change */ - freq = clock_get_freq(); - hwtimer_clock_changed(freq); -#ifdef CONFIG_TASK_WATCHDOG - watchdog_clock_changed(freq); -#endif -#ifdef CONFIG_I2C - i2c_clock_changed(freq); -#endif -#ifdef CONFIG_PECI - peci_clock_changed(freq); -#endif - - return EC_SUCCESS; + return hook_notify(HOOK_FREQ_CHANGE, 0); } DECLARE_CONSOLE_COMMAND(nopll, command_disable_pll); |