diff --git a/board/slippy/board.c b/board/slippy/board.c index 3f2b6a9c0e..69566ef404 100644 --- a/board/slippy/board.c +++ b/board/slippy/board.c @@ -70,6 +70,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = { {"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/slippy/board.h b/board/slippy/board.h index fe4470687a..18cc4628f2 100644 --- a/board/slippy/board.h +++ b/board/slippy/board.h @@ -17,6 +17,7 @@ /* Optional features */ #define CONFIG_SMART_BATTERY #define CONFIG_BACKLIGHT_X86 +#define CONFIG_BATTERY_CHECK_CONNECTED #define CONFIG_BATTERY_SLIPPY #define CONFIG_BOARD_VERSION #define CONFIG_CHARGER @@ -97,6 +98,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_slippy.c b/common/battery_slippy.c index 14c7b3dee4..8d9648d26d 100644 --- a/common/battery_slippy.c +++ b/common/battery_slippy.c @@ -6,6 +6,7 @@ */ #include "battery_pack.h" +#include "gpio.h" /* FIXME: We need REAL values for all this stuff */ static const struct battery_info info = { @@ -50,3 +51,11 @@ void battery_vendor_params(struct batt_params *batt) } #endif } + +/** + * Physical detection of battery connection. + */ +int battery_is_connected(void) +{ + return (gpio_get_level(GPIO_BAT_DETECT_L) == 0); +}