summaryrefslogtreecommitdiff
path: root/common/x86_power.c
diff options
context:
space:
mode:
authorChromeOS Developer <rspangler@chromium.org>2013-03-15 14:55:53 -0700
committerChromeBot <chrome-bot@google.com>2013-03-19 10:31:12 -0700
commit6c285c09941dfb1924b037476e823ecff20c897d (patch)
tree02fa6d9f4a20f380ed6bc99e6994d6ab2c65c2ca /common/x86_power.c
parentc196c66432ea9d74a84602f4a49c4fd43de1ddd5 (diff)
downloadchrome-ec-6c285c09941dfb1924b037476e823ecff20c897d.tar.gz
Move external power detect for link to its own file
Now that it doesn't need to leverage SWITCH_TASK to send the AC_CHANGE notification, pure GPIO-based external power detection can move from switch.c to its own file. BUG=chrome-os-partner:18256 BRANCH=none TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away Change-Id: Id495f34185b7d971c241ac6d0a8311a6bf544507 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45789
Diffstat (limited to 'common/x86_power.c')
-rw-r--r--common/x86_power.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/common/x86_power.c b/common/x86_power.c
index 74eb70fa76..8b8968a2e3 100644
--- a/common/x86_power.c
+++ b/common/x86_power.c
@@ -8,6 +8,7 @@
#include "chipset.h"
#include "common.h"
#include "console.h"
+#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
@@ -340,7 +341,7 @@ DECLARE_HOOK(HOOK_LID_CHANGE, x86_lid_change, HOOK_PRIO_DEFAULT);
static void x86_power_ac_change(void)
{
- if (switch_get_ac_present()) {
+ if (extpower_is_present()) {
CPRINTF("[%T x86 AC on]\n");
} else {
CPRINTF("[%T x86 AC off]\n");
@@ -437,7 +438,7 @@ void x86_power_task(void)
}
in_want = 0;
- if (switch_get_ac_present())
+ if (extpower_is_present())
task_wait_event(-1);
else {
uint64_t target_time = last_shutdown_time +
@@ -785,7 +786,7 @@ static int command_hibernation_delay(int argc, char **argv)
/* Print the current setting */
ccprintf("Hibernation delay: %d s\n", hibernate_delay);
- if (state == X86_G3 && !switch_get_ac_present()) {
+ if (state == X86_G3 && !extpower_is_present()) {
ccprintf("Time G3: %d s\n", time_g3);
ccprintf("Time left: %d s\n", hibernate_delay - time_g3);
}