summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChromeOS Developer <dparker@chromium.org>2014-03-24 12:50:01 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-25 00:41:22 +0000
commitd44f38a733e605fdd5201d7c2a84a2eb84ddad57 (patch)
tree02039f345fee2c2dce586fe73ee99ce2e2ffc992
parente76b7a12430cc854c94b8d0475c5a215183df69f (diff)
downloadchrome-ec-d44f38a733e605fdd5201d7c2a84a2eb84ddad57.tar.gz
Initialize extpower module prior to modules with default priority
This ensures that modules with default priority (or later) get an accurate response from extpower_is_present(). BUG=chrome-os-partner:27160 BRANCH=ToT TEST=Add a default priority initializer. Verify it gets the correct value for extpower_is_present() with and without external power connected. static void extpower_init_check(void) { CPRINTF("[%T Extpower %s]\n", extpower_is_present() ? "on" : "off"); } DECLARE_HOOK(HOOK_INIT, extpower_init_check, HOOK_PRIO_DEFAULT); Change-Id: I13edc32b2a4609fad12982fd710fa95f9e81c9c2 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191296 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--common/extpower_gpio.c2
-rw-r--r--include/hooks.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/common/extpower_gpio.c b/common/extpower_gpio.c
index 7a5cb0f843..d027b3d221 100644
--- a/common/extpower_gpio.c
+++ b/common/extpower_gpio.c
@@ -55,4 +55,4 @@ static void extpower_init(void)
/* Enable interrupts, now that we've initialized */
gpio_enable_interrupt(GPIO_AC_PRESENT);
}
-DECLARE_HOOK(HOOK_INIT, extpower_init, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, extpower_init, HOOK_PRIO_INIT_EXTPOWER);
diff --git a/include/hooks.h b/include/hooks.h
index fb3e6c236b..bc8f1da7d0 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -29,6 +29,8 @@ enum hook_priority {
HOOK_PRIO_INIT_POWER_BUTTON = HOOK_PRIO_FIRST + 4,
/* PWM inits before modules which might use it (fans, LEDs) */
HOOK_PRIO_INIT_PWM = HOOK_PRIO_FIRST + 5,
+ /* Extpower inits before modules which might use it (battery, LEDs) */
+ HOOK_PRIO_INIT_EXTPOWER = HOOK_PRIO_FIRST + 6,
/* Specific values to lump temperature-related hooks together */
HOOK_PRIO_TEMP_SENSOR = 6000,