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/peci.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/peci.c')
-rw-r--r-- | chip/lm4/peci.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/chip/lm4/peci.c b/chip/lm4/peci.c index 2dbbd914b3..0e7540fa10 100644 --- a/chip/lm4/peci.c +++ b/chip/lm4/peci.c @@ -9,6 +9,7 @@ #include "clock.h" #include "console.h" #include "gpio.h" +#include "hooks.h" #include "peci.h" #include "registers.h" #include "temp_sensor.h" @@ -70,8 +71,9 @@ int peci_temp_sensor_get_val(int idx) } -void peci_clock_changed(int freq) +static int peci_freq_changed(void) { + int freq = clock_get_freq(); int baud; /* Disable polling while reconfiguring */ @@ -88,7 +90,10 @@ void peci_clock_changed(int freq) /* Set up temperature monitoring to report in degrees K */ LM4_PECI_CTL = ((PECI_TJMAX + 273) << 22) | 0x2001; + + return EC_SUCCESS; } +DECLARE_HOOK(HOOK_FREQ_CHANGE, peci_freq_changed, HOOK_PRIO_DEFAULT - 1); /*****************************************************************************/ /* Console commands */ @@ -121,7 +126,7 @@ int peci_init(void) configure_gpios(); /* Set initial clock frequency */ - peci_clock_changed(clock_get_freq()); + peci_freq_changed(); return EC_SUCCESS; } |