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.