Slippy: Detect physical presence of battery before waking it

BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Power device without battery. It should boot with no 30
second delay. The battery LED blinks orange indicating a
battery error.

Signed-off-by: Dave Parker <dparker@chromium.org>

Change-Id: Icabc450cd44748aed694e4ed8cb81eee152cf456
Reviewed-on: https://gerrit.chromium.org/gerrit/62850
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
This commit is contained in:
Dave Parker
2013-07-19 23:10:17 -07:00
committed by ChromeBot
parent 89ef837224
commit 2d205f97cb
3 changed files with 12 additions and 0 deletions

View File

@@ -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},

View File

@@ -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 */

View File

@@ -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);
}