summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kuo <tedkuo@ami.com.tw>2015-05-25 18:27:06 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-27 01:10:05 +0000
commit6cc0ece36d4190e2461f7e44767e0f77f47401b8 (patch)
tree16e01cd477575c71fcd0b2f6cffa510f295159bf
parent00d071dfc7face5bb4e97fcd28c68a62ec52f183 (diff)
downloadchrome-ec-6cc0ece36d4190e2461f7e44767e0f77f47401b8.tar.gz
Initialize the memory-mapped AC_PRESENT flag
The memory-mapped AC_PRESENT flag needs to be initialized for the batteryless projects. BUG=chrome-os-partner:40384 TEST=make -j buildall, make -j tests BRANCH=None Signed-off-by: Ted Kuo <tedkuo@ami.com.tw> Change-Id: Ia64ad6564f99b4aae060d29a572b4fe173da62d9 Reviewed-on: https://chromium-review.googlesource.com/273082 Tested-by: Ted Kuo <tedkuo@ami.com.tw> Reviewed-by: Mohammed Habibulla <moch@google.com> Commit-Queue: Ted Kuo <tedkuo@ami.com.tw>
-rw-r--r--common/extpower_gpio.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/extpower_gpio.c b/common/extpower_gpio.c
index d027b3d221..b73d748701 100644
--- a/common/extpower_gpio.c
+++ b/common/extpower_gpio.c
@@ -50,8 +50,16 @@ void extpower_interrupt(enum gpio_signal signal)
static void extpower_init(void)
{
+ uint8_t *memmap_batt_flags = host_get_memmap(EC_MEMMAP_BATT_FLAG);
+
debounced_extpower_presence = gpio_get_level(GPIO_AC_PRESENT);
+ /* Initialize the memory-mapped AC_PRESENT flag */
+ if (debounced_extpower_presence)
+ *memmap_batt_flags |= EC_BATT_FLAG_AC_PRESENT;
+ else
+ *memmap_batt_flags &= ~EC_BATT_FLAG_AC_PRESENT;
+
/* Enable interrupts, now that we've initialized */
gpio_enable_interrupt(GPIO_AC_PRESENT);
}