diff options
author | Henry Hsu <Henry.Hsu@quantatw.com> | 2013-10-04 12:55:16 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-07 05:06:38 +0000 |
commit | 4e342bcf9539d08a3c16ad398d735c418393d466 (patch) | |
tree | 402fcdd06ddb16ec9f6ed5a007c6027079100351 | |
parent | e8cf2a67090d18cdcdb578c03bdf105a74d28a74 (diff) | |
download | chrome-ec-4e342bcf9539d08a3c16ad398d735c418393d466.tar.gz |
Add battery detect function
Use BAT_TEMP to detect the battery.
BRANCH=wolf
BUG=chrome-os-partner:22123
TEST=none
Change-Id: I95c5fb04fc2c5de2894524737575418e27f21894
Signed-off-by: Hsu Henry <Henry.Hsu@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/171820
Reviewed-by: Dave Parker <dparker@chromium.org>
-rw-r--r-- | board/wolf/board.c | 1 | ||||
-rw-r--r-- | board/wolf/board.h | 2 | ||||
-rw-r--r-- | common/battery_wolf.c | 6 |
3 files changed, 9 insertions, 0 deletions
diff --git a/board/wolf/board.c b/board/wolf/board.c index 6471a8bc8e..fa81cf5137 100644 --- a/board/wolf/board.c +++ b/board/wolf/board.c @@ -70,6 +70,7 @@ const struct gpio_info gpio_list[] = { {"BOARD_VERSION2", LM4_GPIO_Q, (1<<6), GPIO_INPUT, NULL}, {"BOARD_VERSION3", LM4_GPIO_Q, (1<<7), GPIO_INPUT, NULL}, {"CPU_PGOOD", LM4_GPIO_C, (1<<4), GPIO_INPUT, NULL}, + {"BAT_DETECT_L", LM4_GPIO_B, (1<<4), GPIO_INPUT, NULL}, /* Outputs; all unasserted by default except for reset signals */ {"CPU_PROCHOT", LM4_GPIO_B, (1<<1), GPIO_OUT_LOW, NULL}, diff --git a/board/wolf/board.h b/board/wolf/board.h index d8a66a1a90..7a06aefaa3 100644 --- a/board/wolf/board.h +++ b/board/wolf/board.h @@ -10,6 +10,7 @@ /* Optional features */ #define CONFIG_BACKLIGHT_X86 +#define CONFIG_BATTERY_CHECK_CONNECTED #define CONFIG_BATTERY_SMART #define CONFIG_BOARD_VERSION #define CONFIG_CHARGER @@ -89,6 +90,7 @@ enum gpio_signal { GPIO_BOARD_VERSION2, /* Board version stuffing resistor 2 */ GPIO_BOARD_VERSION3, /* Board version stuffing resistor 3 */ GPIO_CPU_PGOOD, /* Power good to the CPU */ + GPIO_BAT_DETECT_L, /* Battery detect. Repurposed BAT_TEMP */ /* Outputs */ GPIO_CPU_PROCHOT, /* Force CPU to think it's overheated */ diff --git a/common/battery_wolf.c b/common/battery_wolf.c index b9fb590092..4eb0966950 100644 --- a/common/battery_wolf.c +++ b/common/battery_wolf.c @@ -6,6 +6,7 @@ */ #include "battery_pack.h" +#include "gpio.h" const struct battery_temperature_ranges bat_temp_ranges = { .start_charging_min_c = 0, @@ -38,3 +39,8 @@ void battery_vendor_params(struct batt_params *batt) { } +int battery_is_connected(void) +{ + return (gpio_get_level(GPIO_BAT_DETECT_L) == 0); +} + |