From 5efbecb77053b02c6678a26b66f66f39b3499415 Mon Sep 17 00:00:00 2001 From: Kevin K Wong Date: Tue, 9 Feb 2016 15:05:16 -0800 Subject: kunimitsu: hibernate: enable PseudoG3 support at board level this is to move the existing code from chipset level to board level since PseudoG3 is a board feature that required specific hardware. BUG=none BRANCH=glados TEST=use hibernate command to enter PseudoG3 Change-Id: I309ef89e0ff7057ce46c634baa9791731a771984 Signed-off-by: Kevin K Wong Reviewed-on: https://chromium-review.googlesource.com/327677 Reviewed-by: Shawn N --- board/kunimitsu/board.c | 17 +++++++++++++++++ board/kunimitsu/board.h | 3 --- board/lars/board.c | 17 +++++++++++++++++ board/lars/board.h | 3 --- board/strago/board.c | 18 ++++++++++++++++++ board/strago/board.h | 1 - include/config.h | 6 ------ include/power.h | 4 ---- power/braswell.c | 15 --------------- power/common.c | 4 ---- power/skylake.c | 19 ------------------- 11 files changed, 52 insertions(+), 55 deletions(-) diff --git a/board/kunimitsu/board.c b/board/kunimitsu/board.c index 97ec137fa4..897d9b6cae 100644 --- a/board/kunimitsu/board.c +++ b/board/kunimitsu/board.c @@ -631,3 +631,20 @@ static void board_handle_reboot(void) ; /* wait here */ } DECLARE_HOOK(HOOK_INIT, board_handle_reboot, HOOK_PRIO_FIRST); + +void board_hibernate(void) +{ + CPRINTS("Enter Pseudo G3"); + + /* + * Clean up the UART buffer and prevent any unwanted garbage characters + * before power off and also ensure above debug message is printed. + */ + cflush(); + + gpio_set_level(GPIO_G3_SLEEP_EN, 1); + + /* Power to EC should shut down now */ + while (1) + ; +} diff --git a/board/kunimitsu/board.h b/board/kunimitsu/board.h index 63a6cf2243..cec0aa1f66 100644 --- a/board/kunimitsu/board.h +++ b/board/kunimitsu/board.h @@ -160,9 +160,6 @@ #undef CONFIG_CONSOLE_HISTORY #undef CONFIG_PECI -/* Enable Pseudo G3 */ -#define CONFIG_LOW_POWER_PSEUDO_G3 - #ifndef __ASSEMBLER__ #include "gpio_signal.h" diff --git a/board/lars/board.c b/board/lars/board.c index 5fb2c675e0..bf43208f5b 100644 --- a/board/lars/board.c +++ b/board/lars/board.c @@ -545,3 +545,20 @@ static void board_handle_reboot(void) ; /* wait here */ } DECLARE_HOOK(HOOK_INIT, board_handle_reboot, HOOK_PRIO_FIRST); + +void board_hibernate(void) +{ + CPRINTS("Enter Pseudo G3"); + + /* + * Clean up the UART buffer and prevent any unwanted garbage characters + * before power off and also ensure above debug message is printed. + */ + cflush(); + + gpio_set_level(GPIO_G3_SLEEP_EN, 1); + + /* Power to EC should shut down now */ + while (1) + ; +} diff --git a/board/lars/board.h b/board/lars/board.h index c12ffe0b8f..35560b45e2 100644 --- a/board/lars/board.h +++ b/board/lars/board.h @@ -144,9 +144,6 @@ #undef CONFIG_CONSOLE_HISTORY #undef CONFIG_PECI -/* Enable Pseudo G3 */ -#define CONFIG_LOW_POWER_PSEUDO_G3 - #ifndef __ASSEMBLER__ #include "gpio_signal.h" diff --git a/board/strago/board.c b/board/strago/board.c index ae4cb51ea6..97d5b77dde 100644 --- a/board/strago/board.c +++ b/board/strago/board.c @@ -367,3 +367,21 @@ enum battery_present battery_is_present(void) { return EC_ERROR_UNIMPLEMENTED; } + +void board_hibernate(void) +{ + CPRINTS("Enter Pseudo G3"); + + /* + * Clean up the UART buffer and prevent any unwanted garbage characters + * before power off and also ensure above debug message is printed. + */ + cflush(); + + gpio_set_level(GPIO_EC_HIB_L, 1); + gpio_set_level(GPIO_SMC_SHUTDOWN, 1); + + /* Power to EC should shut down now */ + while (1) + ; +} diff --git a/board/strago/board.h b/board/strago/board.h index 1bf563a642..77f26afdb3 100644 --- a/board/strago/board.h +++ b/board/strago/board.h @@ -25,7 +25,6 @@ #define CONFIG_POWER_BUTTON #define CONFIG_POWER_BUTTON_X86 #define CONFIG_LID_SWITCH -#define CONFIG_LOW_POWER_PSEUDO_G3 #define CONFIG_POWER_COMMON #define CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 #define CONFIG_EXTPOWER_GPIO diff --git a/include/config.h b/include/config.h index 93597f241f..a0a0d5c4cf 100644 --- a/include/config.h +++ b/include/config.h @@ -1316,12 +1316,6 @@ #undef CONFIG_LOW_POWER_IDLE #undef CONFIG_LOW_POWER_USE_LFIOSC -/* - * Enable Pseudo G3 (power removed from EC) - * This requires board specific implementation. - */ -#undef CONFIG_LOW_POWER_PSEUDO_G3 - /* * Enable deep sleep during S0 (ignores SLEEP_MASK_AP_RUN). */ diff --git a/include/power.h b/include/power.h index 64a1e7c4a5..5d1c040d9e 100644 --- a/include/power.h +++ b/include/power.h @@ -133,8 +133,4 @@ int power_get_pause_in_s5(void); */ void power_set_pause_in_s5(int pause); -#ifdef CONFIG_LOW_POWER_PSEUDO_G3 -void enter_pseudo_g3(void); -#endif - #endif /* __CROS_EC_POWER_H */ diff --git a/power/braswell.c b/power/braswell.c index 5998e99339..bfdf3dec39 100644 --- a/power/braswell.c +++ b/power/braswell.c @@ -329,18 +329,3 @@ enum power_state power_handle_state(enum power_state state) } return state; } - -#ifdef CONFIG_LOW_POWER_PSEUDO_G3 -void enter_pseudo_g3(void) -{ - CPRINTS("Enter Psuedo G3"); - cflush(); - - gpio_set_level(GPIO_EC_HIB_L, 1); - gpio_set_level(GPIO_SMC_SHUTDOWN, 1); - - /* Power to EC should shut down now */ - while (1) - ; -} -#endif diff --git a/power/common.c b/power/common.c index cf456b54f0..f455b3a3b3 100644 --- a/power/common.c +++ b/power/common.c @@ -192,12 +192,8 @@ static enum power_state power_common_state(enum power_state state) * Time's up. Hibernate until wake pin * asserted. */ -#ifdef CONFIG_LOW_POWER_PSEUDO_G3 - enter_pseudo_g3(); -#else CPRINTS("hibernating"); system_hibernate(0, 0); -#endif } else { uint64_t wait = target_time - time_now; if (wait > TASK_MAX_WAIT_US) diff --git a/power/skylake.c b/power/skylake.c index 9b3b74c4bf..7346ad95a6 100644 --- a/power/skylake.c +++ b/power/skylake.c @@ -417,25 +417,6 @@ enum power_state power_handle_state(enum power_state state) return new_state; } -#ifdef CONFIG_LOW_POWER_PSEUDO_G3 -void enter_pseudo_g3(void) -{ - CPRINTS("Enter Psuedo G3"); - - /* - * Clean up the UART buffer and prevent any unwanted garbage characters - * before power off and also ensure above debug message is printed. - */ - cflush(); - - gpio_set_level(GPIO_G3_SLEEP_EN, 1); - - /* Power to EC should shut down now */ - while (1) - ; -} -#endif - #ifdef CONFIG_POWER_S0IX static struct { int required; /* indicates de-bounce required. */ -- cgit v1.2.1