summaryrefslogtreecommitdiff
path: root/chip/lm4/adc.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-04-19 12:42:35 -0700
committerRandall Spangler <rspangler@chromium.org>2012-04-19 13:08:58 -0700
commitf4e772708bde3e4e1d184190a7f0be2417d2029a (patch)
tree4b668c02a9a6dca2704e6d0a8b3cb8e5c9e95b76 /chip/lm4/adc.c
parentd5d2159c6d215b3a0feca42d961985cd37603ca8 (diff)
downloadchrome-ec-f4e772708bde3e4e1d184190a7f0be2417d2029a.tar.gz
Added HOOK_INIT for driver module inits
This covers modules which need to initialize before task_start(), but don't particularly care in what order they're initialized. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=if it boots, it works Change-Id: I69829aac8d1c3c14ee04916a794b84bbf03a09eb
Diffstat (limited to 'chip/lm4/adc.c')
-rw-r--r--chip/lm4/adc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/chip/lm4/adc.c b/chip/lm4/adc.c
index eb09235351..18f8dbe3a7 100644
--- a/chip/lm4/adc.c
+++ b/chip/lm4/adc.c
@@ -8,6 +8,7 @@
#include "adc.h"
#include "console.h"
#include "gpio.h"
+#include "hooks.h"
#include "lm4_adc.h"
#include "registers.h"
#include "task.h"
@@ -47,6 +48,7 @@ const uint32_t ain_port[24][2] = {
{LM4_GPIO_N, (1<<0)},
};
+
static void configure_gpio(void)
{
int i;
@@ -66,6 +68,7 @@ static void configure_gpio(void)
}
}
+
int lm4_adc_flush_and_read(enum lm4_adc_sequencer seq)
{
/* TODO: right now we have only a single channel so this is
@@ -107,6 +110,7 @@ int lm4_adc_flush_and_read(enum lm4_adc_sequencer seq)
return LM4_ADC_SSFIFO(seq);
}
+
int lm4_adc_configure(enum lm4_adc_sequencer seq,
int ain_id,
int ssctl)
@@ -133,6 +137,7 @@ int lm4_adc_configure(enum lm4_adc_sequencer seq,
return EC_SUCCESS;
}
+
int adc_read_channel(enum adc_channel ch)
{
const struct adc_t *adc = adc_channels + ch;
@@ -181,6 +186,7 @@ static int command_ectemp(int argc, char **argv)
}
DECLARE_CONSOLE_COMMAND(ectemp, command_ectemp);
+
static int command_adc(int argc, char **argv)
{
int i;
@@ -197,7 +203,7 @@ DECLARE_CONSOLE_COMMAND(adc, command_adc);
/*****************************************************************************/
/* Initialization */
-int adc_init(void)
+static int adc_init(void)
{
int i;
const struct adc_t *adc;
@@ -231,3 +237,4 @@ int adc_init(void)
return EC_SUCCESS;
}
+DECLARE_HOOK(HOOK_INIT, adc_init, HOOK_PRIO_DEFAULT);