From 064624cc2d0ca187615b07ace0b28ca7a80431ec Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Fri, 17 Jan 2014 13:07:51 -0800 Subject: [PATCH] baytrail: Add config option to enable WiFi in suspend Some WiFi devices do not tolerate losing power in suspend and will not function properly after resume if they have lost power. Enable this on the Rambi device. BUG=chrome-os-partner:24114 BRANCH=baytrail TEST=complete mutiple successful suspend/resume cycles on rambi and ensure that wifi continues to function and not cause a crash. Change-Id: Id421f3138e429b247bfb3f5ffb92a06c0353bb97 Signed-off-by: Duncan Laurie Reviewed-on: https://chromium-review.googlesource.com/183047 Reviewed-by: Bill Richardson Reviewed-by: Aaron Durbin --- board/rambi/board.h | 1 + include/config.h | 5 +++++ power/baytrail.c | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/board/rambi/board.h b/board/rambi/board.h index d3ce348b7b..656e716236 100644 --- a/board/rambi/board.h +++ b/board/rambi/board.h @@ -39,6 +39,7 @@ #define CONFIG_USB_PORT_POWER_SMART_SIMPLE #define CONFIG_VBOOT_HASH #define CONFIG_WIRELESS +#define CONFIG_WIRELESS_SUSPEND_ENABLE_WIFI #ifndef __ASSEMBLER__ diff --git a/include/config.h b/include/config.h index f3035c2fa9..5775ad8d58 100644 --- a/include/config.h +++ b/include/config.h @@ -772,6 +772,11 @@ */ #undef CONFIG_WIRELESS +/* + * Support for WiFi devices that must remain powered in suspend. + */ +#undef CONFIG_WIRELESS_SUSPEND_ENABLE_WIFI + /* * Write protect signal is active-high. If this is defined, there must be a * GPIO named GPIO_WP; if not defined, there must be a GPIO names GPIO_WP_L. diff --git a/power/baytrail.c b/power/baytrail.c index 3cb6d5df7e..e938f9298e 100644 --- a/power/baytrail.c +++ b/power/baytrail.c @@ -292,8 +292,14 @@ enum power_state power_handle_state(enum power_state state) /* Disable +CPU_CORE */ gpio_set_level(GPIO_VCORE_EN, 0); +#ifdef CONFIG_WIRELESS_SUSPEND_ENABLE_WIFI + /* Disable WWAN, but leave WiFi on */ + wireless_enable(EC_WIRELESS_SWITCH_WLAN | + EC_WIRELESS_SWITCH_WLAN_POWER); +#else /* Disable wireless */ wireless_enable(0); +#endif /* * Enable idle task deep sleep. Allow the low power idle task @@ -316,6 +322,9 @@ enum power_state power_handle_state(enum power_state state) /* Call hooks before we remove power rails */ hook_notify(HOOK_CHIPSET_SHUTDOWN); + /* Disable wireless */ + wireless_enable(0); + /* Disable touchpad power */ gpio_set_level(GPIO_ENABLE_TOUCHPAD, 0);