diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-10-04 10:25:39 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-04 20:04:49 +0000 |
commit | e98db03d3bb9c91054f8608ccb31c8e8b704bab9 (patch) | |
tree | 1ed699df86eb1265cbb19470f52617d24c0e80cb | |
parent | 9af47b787c71e05a0c53e5c2f87b2fb1ce6c7ed2 (diff) | |
download | chrome-ec-e98db03d3bb9c91054f8608ccb31c8e8b704bab9.tar.gz |
samus: Add battery_is_connected check
Copied from Bolt.
This is so the 30-second wait when no battery is installed can be skipped.
Note that if we ever decide to monitor the battery temp through the BAT_TEMP
line, we'll have to rethink how battery_is_connected() is implemented, since
we can't reliably treat that GPIO as both digital and analog simultaneously.
BUG=chrome-os-partner:22870
BRANCH=none
TEST=manual
cd src/platform/ec
make BOARD=samus
make runtests
Change-Id: Ifea952c8f99b2b40c2fab382e949958a2f71d157
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/171796
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r-- | board/samus/board.c | 9 | ||||
-rw-r--r-- | board/samus/board.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/board/samus/board.c b/board/samus/board.c index 4871bb0f10..ddb8c97450 100644 --- a/board/samus/board.c +++ b/board/samus/board.c @@ -74,6 +74,7 @@ const struct gpio_info gpio_list[] = { {"USB1_STATUS_L", LM4_GPIO_E, (1<<6), GPIO_INPUT, NULL}, {"USB2_OC_L", LM4_GPIO_E, (1<<0), GPIO_INPUT, NULL}, {"USB2_STATUS_L", LM4_GPIO_D, (1<<7), GPIO_INPUT, NULL}, + {"BAT_DETECT_L", LM4_GPIO_B, (1<<4), GPIO_INPUT, NULL}, /* Not yet sure if this will need to be handled as an interrupt */ {"CAPSENSE_INT_L", LM4_GPIO_N, (1<<0), GPIO_INPUT, NULL}, @@ -227,3 +228,11 @@ struct keyboard_scan_config keyscan_config = { 0xa4, 0xff, 0xf6, 0x55, 0xfa, 0xc8 /* full set */ }, }; + +/** + * Physical detection of battery connection. + */ +int battery_is_connected(void) +{ + return (gpio_get_level(GPIO_BAT_DETECT_L) == 0); +} diff --git a/board/samus/board.h b/board/samus/board.h index f9d6114653..1e2e6e7402 100644 --- a/board/samus/board.h +++ b/board/samus/board.h @@ -26,6 +26,7 @@ #define CONFIG_POWER_BUTTON #define CONFIG_POWER_BUTTON_X86 +#define CONFIG_BATTERY_CHECK_CONNECTED #define CONFIG_BATTERY_LINK #define CONFIG_BATTERY_SMART #define CONFIG_BACKLIGHT_LID @@ -108,6 +109,7 @@ enum gpio_signal { GPIO_USB1_STATUS_L, /* USB charger port 1 status output */ GPIO_USB2_OC_L, /* USB port overcurrent warning */ GPIO_USB2_STATUS_L, /* USB charger port 2 status output */ + GPIO_BAT_DETECT_L, /* Battery detect from BAT_TEMP */ GPIO_CAPSENSE_INT_L, /* Capsense interrupt (through EC_WAKE_L) */ /* Outputs */ |