diff options
author | Randall Spangler <rspangler@chromium.org> | 2013-04-02 13:16:15 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-04-03 11:49:07 -0700 |
commit | 6d49e2660ef679b4811b4b93ef11de9be2c21389 (patch) | |
tree | 13a91544feaa6aed3e0ac83f416f10d72851fa1f /board/snow | |
parent | 4d1aadaf601f04be9f45a540284f9b1184681787 (diff) | |
download | chrome-ec-6d49e2660ef679b4811b4b93ef11de9be2c21389.tar.gz |
Add common implementation for daisy/snow extpower_is_present
The implementations are identical for daisy and snow, so move to a
common file instead of having duplicate code in board.c
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build daisy, snow
Change-Id: I63597885607fd03b3bf87bcebf2146190b301f22
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47183
Reviewed-by: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'board/snow')
-rw-r--r-- | board/snow/board.c | 33 | ||||
-rw-r--r-- | board/snow/board.h | 1 |
2 files changed, 1 insertions, 33 deletions
diff --git a/board/snow/board.c b/board/snow/board.c index 7af5011e8a..e7fdd50e37 100644 --- a/board/snow/board.c +++ b/board/snow/board.c @@ -7,7 +7,6 @@ #include "chipset.h" #include "common.h" #include "console.h" -#include "extpower.h" #include "gaia_power.h" #include "gpio.h" #include "hooks.h" @@ -302,35 +301,3 @@ int pmu_board_init(void) return failure ? EC_ERROR_UNKNOWN : EC_SUCCESS; } #endif /* CONFIG_BOARD_PMU_INIT */ - -int extpower_is_present(void) -{ - /* - * Detect AC state using combined gpio pins - * - * On daisy and snow, there's no single gpio signal to detect AC. - * GPIO_AC_PWRBTN_L provides AC on and PWRBTN release. - * GPIO_KB_PWR_ON_L provides PWRBTN release. - * - * When AC plugged, both GPIOs will be high. - * - * One drawback of this detection is, when press-and-hold power - * button. AC state will be unknown. This function will fallback - * to PMU VACG. - */ - - int ac_good = 1, battery_good; - - if (gpio_get_level(GPIO_KB_PWR_ON_L)) - return gpio_get_level(GPIO_AC_PWRBTN_L); - - /* Check PMU VACG */ - if (!in_interrupt_context()) - pmu_get_power_source(&ac_good, &battery_good); - - /* - * Charging task only interacts with AP in discharging state. So - * return 1 when AC status can not be detected by GPIO or VACG. - */ - return ac_good; -} diff --git a/board/snow/board.h b/board/snow/board.h index 9c14b76443..7bedbe28e0 100644 --- a/board/snow/board.h +++ b/board/snow/board.h @@ -25,6 +25,7 @@ #define CONFIG_CHIPSET_GAIA #define CONFIG_CMD_PMU #define CONFIG_CONFIGURE_BOARD_LATE +#define CONFIG_EXTPOWER_SNOW #define CONFIG_HOST_COMMAND_STATUS #define CONFIG_I2C #define CONFIG_I2C_ARBITRATION |