summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-08-28 11:11:18 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-08-30 15:39:48 +0000
commit7cb7d7dd99bf8c919010122667a69c6107a77228 (patch)
treeee16464fa60afffa893aed1d1acd5f2b3698befb
parentea41735a4cfc658642b861fd2f68dd451824ca74 (diff)
downloadchrome-ec-7cb7d7dd99bf8c919010122667a69c6107a77228.tar.gz
Add config options for power rail controls
Instead of checking for BOARD_<board> to determine whether the board has control over a power rail or not, use config option for this. Boards without control over some power rails can then undefine the option in board.h. BUG=chrome-os-partner:21964 TEST=Build all boards. BRANCH=None Change-Id: I7ee4ebdb3ea595e182845e40db165623ee271997 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/167200 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--board/kirby/board.h2
-rw-r--r--common/chipset_gaia.c10
-rw-r--r--include/config.h4
3 files changed, 11 insertions, 5 deletions
diff --git a/board/kirby/board.h b/board/kirby/board.h
index d246622504..e44ecbdb47 100644
--- a/board/kirby/board.h
+++ b/board/kirby/board.h
@@ -12,6 +12,8 @@
#define CONFIG_CHARGER
#define CONFIG_CHARGER_BQ24192
#define CONFIG_CHIPSET_GAIA
+#undef CONFIG_CHIPSET_HAS_PP1350
+#undef CONFIG_CHIPSET_HAS_PP5000
#define CONFIG_HOST_COMMAND_STATUS
#define CONFIG_I2C
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
diff --git a/common/chipset_gaia.c b/common/chipset_gaia.c
index 1dcebd87e4..d487b68cc2 100644
--- a/common/chipset_gaia.c
+++ b/common/chipset_gaia.c
@@ -364,7 +364,7 @@ void chipset_reset(int is_cold)
* contents. This is useful for looking at kernel log message contents
* from previous boot in cases where the AP/OS is hard hung.
*/
-#ifndef BOARD_kirby
+#ifdef CONFIG_CHIPSET_HAS_PP5000
gpio_set_level(GPIO_EN_PP5000, 0);
#endif
gpio_set_level(GPIO_EN_PP3300, 0);
@@ -377,7 +377,7 @@ void chipset_force_shutdown(void)
{
/* Turn off all rails */
gpio_set_level(GPIO_EN_PP3300, 0);
-#ifndef BOARD_kirby
+#ifdef CONFIG_CHIPSET_HAS_PP1350
/*
* Turn off PP1350 unless we're immediately waking back up. This
* works with the hack in chipset_reset() to preserve the contents of
@@ -387,7 +387,7 @@ void chipset_force_shutdown(void)
gpio_set_level(GPIO_EN_PP1350, 0);
#endif
set_pmic_pwrok(0);
-#ifndef BOARD_kirby
+#ifdef CONFIG_CHIPSET_HAS_PP5000
gpio_set_level(GPIO_EN_PP5000, 0);
#endif
@@ -456,7 +456,7 @@ static int check_for_power_on_event(void)
*/
static int power_on(void)
{
-#ifndef BOARD_kirby
+#ifdef CONFIG_CHIPSET_HAS_PP5000
/* Enable 5v power rail */
gpio_set_level(GPIO_EN_PP5000, 1);
/* Wait for it to stabilize */
@@ -571,7 +571,7 @@ static void power_off(void)
lid_opened = 0;
enable_sleep(SLEEP_MASK_AP_RUN);
powerled_set_state(POWERLED_STATE_OFF);
-#ifndef BOARD_kirby
+#ifdef CONFIG_PMU_TPS65090
pmu_shutdown();
#endif
CPRINTF("[%T power shutdown complete]\n");
diff --git a/include/config.h b/include/config.h
index 9a6808cf10..3025bdccb7 100644
--- a/include/config.h
+++ b/include/config.h
@@ -157,6 +157,10 @@
*/
#undef CONFIG_CHIPSET_X86
+/* Compile support for power rail control */
+#define CONFIG_CHIPSET_HAS_PP1350
+#define CONFIG_CHIPSET_HAS_PP5000
+
/*****************************************************************************/
/*
* Optional console commands