From 70f3fcaf8648230a5cd27a9da151494d6df3016f Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Wed, 18 Apr 2012 13:03:38 -0700 Subject: 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 BUG=none TEST=manual: use nopll command, should still work Change-Id: Iedcea5830bc18eacfd955c29b8f793aba8905dd8 --- chip/lm4/peci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'chip/lm4/peci.c') 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; } -- cgit v1.2.1