diff options
author | Duncan Laurie <dlaurie@chromium.org> | 2013-05-31 09:41:21 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-06-03 14:32:07 -0700 |
commit | d6d3b7cbc5621519d54d231aba13aa4ab50651aa (patch) | |
tree | 53cfcb6b51131184a2a7a5eea2b645a52af34f31 | |
parent | f8e12df9dfb8d028cee1e9a039c4cbcebc608385 (diff) | |
download | chrome-ec-d6d3b7cbc5621519d54d231aba13aa4ab50651aa.tar.gz |
Add wireless switch control for WWAN
Haswell devices have EC control of the WWAN power rail.
Expose a new wireless switch enable flag for this under
the existing wirless enable command.
This change also abstracts the wireless enable function
to call a per-board handler so the different boards can
do the right thing based on their GPIO setup.
The haswell boards will switch WLAN radio and WWAN power
rails based on the switch inputs. These boards do not have
EC control of bluetooth radio/rail power.
WLAN (power and radio) still defaults to enabled. Disabling
with ectool will turn off the radio but keep the power enabled
in order to prevent the PCIe device from disappearing.
WWAN (power) still defaults to disabled. Disabling with
ectool will turn off the power rail.
BUG=chrome-os-partner:19871
BRANCH=none
TEST=manual: boot on slippy
DEFAULT:
> ectool gpioget pp3300_wlan_en
GPIO pp3300_wlan_en = 1
> ectool gpioget wlan_off_l
GPIO wlan_off_l = 1
> ectool gpioget pp3300_lte_en
GPIO pp3300_lte_en = 0
ENABLE WWAN:
> ectool wireless 0x7
Success.
> ectool gpioget pp3300_lte_en
GPIO pp3300_lte_en = 1
DISABLE WLAN (radio):
> ectool wireless 0x7
Success.
> ectool gpioget pp3300_wlan_en
GPIO pp3300_wlan_en = 1
> ectool gpioget wlan_off_l
GPIO wlan_off_l = 0
Change-Id: I6f760b8cf5ab47d8f7f0dd8cd4d3e6563464043e
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57215
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r-- | board/falco/board.c | 15 | ||||
-rw-r--r-- | board/falco/board.h | 4 | ||||
-rw-r--r-- | board/link/board.c | 13 | ||||
-rw-r--r-- | board/peppy/board.c | 13 | ||||
-rw-r--r-- | board/peppy/board.h | 4 | ||||
-rw-r--r-- | board/slippy/board.c | 15 | ||||
-rw-r--r-- | board/slippy/board.h | 4 | ||||
-rw-r--r-- | chip/lm4/switch.c | 9 | ||||
-rw-r--r-- | include/ec_commands.h | 1 | ||||
-rw-r--r-- | include/switch.h | 5 | ||||
-rw-r--r-- | util/ectool.c | 3 |
11 files changed, 69 insertions, 17 deletions
diff --git a/board/falco/board.c b/board/falco/board.c index 6e5da3b1a8..0aaadfde80 100644 --- a/board/falco/board.c +++ b/board/falco/board.c @@ -2,11 +2,13 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -/* EC for Link board configuration */ +/* EC for Falco board configuration */ #include "adc.h" +#include "board.h" #include "chip_temp_sensor.h" #include "common.h" +#include "ec_commands.h" #include "extpower.h" #include "gpio.h" #include "i2c.h" @@ -166,3 +168,14 @@ void configure_fan_gpios(void) /* PN2:3 alternate function 1 = channel 0 PWM/tach */ gpio_set_alternate_function(LM4_GPIO_N, 0x0c, 1); } + +/** + * Set wireless switch state. + */ +void board_enable_wireless(uint8_t enabled) +{ + gpio_set_level(GPIO_WLAN_OFF_L, + enabled & EC_WIRELESS_SWITCH_WLAN); + gpio_set_level(GPIO_PP3300_LTE_EN, + enabled & EC_WIRELESS_SWITCH_WWAN); +} diff --git a/board/falco/board.h b/board/falco/board.h index 53a83b0672..1bb1bcc0b9 100644 --- a/board/falco/board.h +++ b/board/falco/board.h @@ -98,12 +98,12 @@ enum gpio_signal { GPIO_PP3300_DSW_GATED_EN, /* Enable DSW rails */ GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */ GPIO_PP3300_LTE_EN, /* Enable LTE radio */ - GPIO_PP3300_WLAN_EN, /* Enable WiFi radio */ + GPIO_PP3300_WLAN_EN, /* Enable WiFi power */ GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */ GPIO_VCORE_EN, /* Stuffing option - not connected */ GPIO_PP5000_EN, /* Enable 5V supply */ GPIO_SYS_PWROK, /* EC thinks everything is up and ready */ - GPIO_WLAN_OFF_L, /* Disable WiFi chip? Or just the radio? */ + GPIO_WLAN_OFF_L, /* Disable WiFi radio */ GPIO_CHARGE_L, /* Allow battery to charge when on AC */ GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ diff --git a/board/link/board.c b/board/link/board.c index e3cb7522ad..c0a4dd5108 100644 --- a/board/link/board.c +++ b/board/link/board.c @@ -5,8 +5,10 @@ /* EC for Link board configuration */ #include "adc.h" +#include "board.h" #include "chip_temp_sensor.h" #include "common.h" +#include "ec_commands.h" #include "extpower.h" #include "gpio.h" #include "i2c.h" @@ -202,3 +204,14 @@ void configure_fan_gpios(void) /* PM6:7 alternate function 1 = channel 0 PWM/tach */ gpio_set_alternate_function(LM4_GPIO_M, 0xc0, 1); } + +/** + * Set wireless switch state. + */ +void board_enable_wireless(uint8_t enabled) +{ + gpio_set_level(GPIO_RADIO_ENABLE_WLAN, + enabled & EC_WIRELESS_SWITCH_WLAN); + gpio_set_level(GPIO_RADIO_ENABLE_BT, + enabled & EC_WIRELESS_SWITCH_BLUETOOTH); +} diff --git a/board/peppy/board.c b/board/peppy/board.c index 844eefea91..69974ced0c 100644 --- a/board/peppy/board.c +++ b/board/peppy/board.c @@ -5,8 +5,10 @@ /* EC for Peppy board configuration */ #include "adc.h" +#include "board.h" #include "chip_temp_sensor.h" #include "common.h" +#include "ec_commands.h" #include "extpower.h" #include "gpio.h" #include "i2c.h" @@ -166,3 +168,14 @@ void configure_fan_gpios(void) /* PN2:3 alternate function 1 = channel 0 PWM/tach */ gpio_set_alternate_function(LM4_GPIO_N, 0x0c, 1); } + +/** + * Set wireless switch state. + */ +void board_enable_wireless(uint8_t enabled) +{ + gpio_set_level(GPIO_WLAN_OFF_L, + enabled & EC_WIRELESS_SWITCH_WLAN); + gpio_set_level(GPIO_PP3300_LTE_EN, + enabled & EC_WIRELESS_SWITCH_WWAN); +} diff --git a/board/peppy/board.h b/board/peppy/board.h index 5c3a009f46..9d13fd326a 100644 --- a/board/peppy/board.h +++ b/board/peppy/board.h @@ -98,12 +98,12 @@ enum gpio_signal { GPIO_PP3300_DSW_GATED_EN, /* Enable DSW rails */ GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */ GPIO_PP3300_LTE_EN, /* Enable LTE radio */ - GPIO_PP3300_WLAN_EN, /* Enable WiFi radio */ + GPIO_PP3300_WLAN_EN, /* Enable WiFi power */ GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */ GPIO_VCORE_EN, /* Stuffing option - not connected */ GPIO_PP5000_EN, /* Enable 5V supply */ GPIO_SYS_PWROK, /* EC thinks everything is up and ready */ - GPIO_WLAN_OFF_L, /* Disable WiFi chip? Or just the radio? */ + GPIO_WLAN_OFF_L, /* Disable WiFi radio */ GPIO_CHARGE_L, /* Allow battery to charge when on AC */ GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ diff --git a/board/slippy/board.c b/board/slippy/board.c index 0bea0d102f..1bf35423e5 100644 --- a/board/slippy/board.c +++ b/board/slippy/board.c @@ -2,11 +2,13 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ -/* EC for Link board configuration */ +/* EC for Slippy board configuration */ #include "adc.h" +#include "board.h" #include "chip_temp_sensor.h" #include "common.h" +#include "ec_commands.h" #include "extpower.h" #include "gpio.h" #include "i2c.h" @@ -166,3 +168,14 @@ void configure_fan_gpios(void) /* PN2:3 alternate function 1 = channel 0 PWM/tach */ gpio_set_alternate_function(LM4_GPIO_N, 0x0c, 1); } + +/** + * Set wireless switch state. + */ +void board_enable_wireless(uint8_t enabled) +{ + gpio_set_level(GPIO_WLAN_OFF_L, + enabled & EC_WIRELESS_SWITCH_WLAN); + gpio_set_level(GPIO_PP3300_LTE_EN, + enabled & EC_WIRELESS_SWITCH_WWAN); +} diff --git a/board/slippy/board.h b/board/slippy/board.h index 53a6c3a672..d0d153db36 100644 --- a/board/slippy/board.h +++ b/board/slippy/board.h @@ -98,12 +98,12 @@ enum gpio_signal { GPIO_PP3300_DSW_GATED_EN, /* Enable DSW rails */ GPIO_PP3300_DX_EN, /* Enable power to lots of peripherals */ GPIO_PP3300_LTE_EN, /* Enable LTE radio */ - GPIO_PP3300_WLAN_EN, /* Enable WiFi radio */ + GPIO_PP3300_WLAN_EN, /* Enable WiFi power */ GPIO_SUSP_VR_EN, /* Enable 1.05V regulator */ GPIO_VCORE_EN, /* Stuffing option - not connected */ GPIO_PP5000_EN, /* Enable 5V supply */ GPIO_SYS_PWROK, /* EC thinks everything is up and ready */ - GPIO_WLAN_OFF_L, /* Disable WiFi chip? Or just the radio? */ + GPIO_WLAN_OFF_L, /* Disable WiFi radio */ GPIO_CHARGE_L, /* Allow battery to charge when on AC */ GPIO_ENABLE_BACKLIGHT, /* Enable backlight power */ diff --git a/chip/lm4/switch.c b/chip/lm4/switch.c index 3cfb4e8568..0d20f9cd25 100644 --- a/chip/lm4/switch.c +++ b/chip/lm4/switch.c @@ -546,15 +546,8 @@ DECLARE_HOST_COMMAND(EC_CMD_SWITCH_ENABLE_BKLIGHT, static int switch_command_enable_wireless(struct host_cmd_handler_args *args) { -#ifdef BOARD_link /* HEY: Slippy? */ const struct ec_params_switch_enable_wireless *p = args->params; - - gpio_set_level(GPIO_RADIO_ENABLE_WLAN, - p->enabled & EC_WIRELESS_SWITCH_WLAN); - gpio_set_level(GPIO_RADIO_ENABLE_BT, - p->enabled & EC_WIRELESS_SWITCH_BLUETOOTH); -#endif - + board_enable_wireless(p->enabled); return EC_RES_SUCCESS; } DECLARE_HOST_COMMAND(EC_CMD_SWITCH_ENABLE_WIRELESS, diff --git a/include/ec_commands.h b/include/ec_commands.h index d4a88f510b..93258df241 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -132,6 +132,7 @@ /* Wireless switch flags */ #define EC_WIRELESS_SWITCH_WLAN 0x01 #define EC_WIRELESS_SWITCH_BLUETOOTH 0x02 +#define EC_WIRELESS_SWITCH_WWAN 0x04 /* * This header file is used in coreboot both in C and ACPI code. The ACPI code diff --git a/include/switch.h b/include/switch.h index 2cd732774e..70cbfdc3e3 100644 --- a/include/switch.h +++ b/include/switch.h @@ -27,4 +27,9 @@ void switch_interrupt(enum gpio_signal signal); */ int switch_get_write_protect(void); +/** + * Set wireless switch state. + */ +void board_enable_wireless(uint8_t enabled); + #endif /* __CROS_EC_SWITCH_H */ diff --git a/util/ectool.c b/util/ectool.c index 85da6327a2..b7db98f548 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -1932,7 +1932,8 @@ int cmd_wireless(int argc, char *argv[]) if (argc != 2) { fprintf(stderr, "Usage: %s <mask>\n", argv[0]); fprintf(stderr, " 0x1 = WLAN\n" - " 0x2 = Bluetooth\n"); + " 0x2 = Bluetooth\n" + " 0x4 = WWAN\n"); return -1; } p.enabled = strtol(argv[1], &e, 0); |