From e4c9e101e211708428d68366b4e9e2401a0bb5b7 Mon Sep 17 00:00:00 2001 From: Kevin K Wong Date: Tue, 24 May 2016 19:05:58 -0700 Subject: reef: enable WiFi power control support add a new config flag to support active low power control signal BUG=chrome-os-partner:53665 BRANCH=none TEST=Use multimeter to check for voltage present on the WiFi slot. Use gpioget to check GPIO state in S0 (on) and S5 (off). Change-Id: Ibeca88d16f39eadd7f29589cd3cd15aeef0dd524 Signed-off-by: Kevin K Wong Reviewed-on: https://chromium-review.googlesource.com/347085 Commit-Ready: David Hendricks Tested-by: David Hendricks Reviewed-by: David Hendricks --- board/reef/board.h | 3 +++ common/wireless.c | 9 +++++++++ include/config.h | 3 +++ 3 files changed, 15 insertions(+) diff --git a/board/reef/board.h b/board/reef/board.h index c8fd12ac5d..21136b2e31 100644 --- a/board/reef/board.h +++ b/board/reef/board.h @@ -80,6 +80,9 @@ /* #define CONFIG_TEMP_SENSOR */ #define CONFIG_UART_HOST 0 #define CONFIG_VBOOT_HASH +#define CONFIG_WIRELESS +#define CONFIG_WLAN_POWER_ACTIVE_LOW +#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER #define CONFIG_FLASH_SIZE 524288 #define CONFIG_SPI_FLASH_W25Q40 /* FIXME: Should be GD25LQ40? */ diff --git a/common/wireless.c b/common/wireless.c index 54a0689906..4b420d9dde 100644 --- a/common/wireless.c +++ b/common/wireless.c @@ -49,8 +49,13 @@ static void wireless_enable(int flags) #endif #ifdef WIRELESS_GPIO_WLAN_POWER +#ifndef CONFIG_WLAN_POWER_ACTIVE_LOW gpio_set_level(WIRELESS_GPIO_WLAN_POWER, flags & EC_WIRELESS_SWITCH_WLAN_POWER); +#else + gpio_set_level(WIRELESS_GPIO_WLAN_POWER, + !(flags & EC_WIRELESS_SWITCH_WLAN_POWER)); +#endif /* CONFIG_WLAN_POWER_ACTIVE_LOW */ #endif } @@ -75,7 +80,11 @@ static int wireless_get(void) #endif #ifdef WIRELESS_GPIO_WLAN_POWER +#ifndef CONFIG_WLAN_POWER_ACTIVE_LOW if (gpio_get_level(WIRELESS_GPIO_WLAN_POWER)) +#else + if (!gpio_get_level(WIRELESS_GPIO_WLAN_POWER)) +#endif /* CONFIG_WLAN_POWER_ACTIVE_LOW */ flags |= EC_WIRELESS_SWITCH_WLAN_POWER; #endif diff --git a/include/config.h b/include/config.h index 32f4214a12..c7862fdae5 100644 --- a/include/config.h +++ b/include/config.h @@ -2128,6 +2128,9 @@ */ #undef CONFIG_WIRELESS_SUSPEND +/* WiFi power control signal is active-low. */ +#undef CONFIG_WLAN_POWER_ACTIVE_LOW + /* * 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. -- cgit v1.2.1