mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
Chipset control of wireless power uses the new API instead of overriding
the wireless power itself.
Refactor board-specific support for it to just a few config #defines
instead of board-specific functions. This makes some assumptions
about the polarity of the enable signals. Not making those
assumptions would require defining an array of structs or some other
heavier-weight board-specific info. Since the assumptions hold for
all current boards, let's make them now because this is a step in the
right direction, and reserve doing something more general until we
actually have a use case for it (so we build in just the flexibility
we need).
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; see that link wifi turns on at boot and off at
shutdown (verify via 'gpioget' from EC console)
Change-Id: Ic036e76158198d2d5e3dd244c3c7b9b1e8d62982
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/61608
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
/* Wireless power management */
|
|
|
|
#include "common.h"
|
|
#include "gpio.h"
|
|
#include "host_command.h"
|
|
|
|
void wireless_enable(int flags)
|
|
{
|
|
#ifdef WIRELESS_GPIO_WLAN
|
|
gpio_set_level(WIRELESS_GPIO_WLAN,
|
|
flags & EC_WIRELESS_SWITCH_WLAN);
|
|
#endif
|
|
|
|
#ifdef WIRELESS_GPIO_WWAN
|
|
gpio_set_level(WIRELESS_GPIO_WWAN,
|
|
flags & EC_WIRELESS_SWITCH_WWAN);
|
|
#endif
|
|
|
|
#ifdef WIRELESS_GPIO_BLUETOOTH
|
|
gpio_set_level(WIRELESS_GPIO_BLUETOOTH,
|
|
flags & EC_WIRELESS_SWITCH_BLUETOOTH);
|
|
#endif
|
|
|
|
#ifdef WIRELESS_GPIO_WLAN_POWER
|
|
gpio_set_level(WIRELESS_GPIO_WLAN_POWER,
|
|
flags & EC_WIRELESS_SWITCH_WLAN_POWER);
|
|
#endif
|
|
|
|
}
|
|
|
|
static int wireless_enable_cmd(struct host_cmd_handler_args *args)
|
|
{
|
|
const struct ec_params_switch_enable_wireless *p = args->params;
|
|
|
|
wireless_enable(p->enabled);
|
|
|
|
return EC_RES_SUCCESS;
|
|
}
|
|
DECLARE_HOST_COMMAND(EC_CMD_SWITCH_ENABLE_WIRELESS,
|
|
wireless_enable_cmd,
|
|
EC_VER_MASK(0));
|