ec/google/wilco: Enable WiFi radio

Add EC command to enable WiFi radio and send that command at
startup.  Tested to ensure WiFi is functional on a sarien board.

Change-Id: Iac46895c7118567e1eb55ea33051a1662103b563
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/c/29673
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Duncan Laurie 2018-11-17 12:17:04 -07:00 committed by Patrick Georgi
parent f6ce6030b9
commit 57f22f6ffe
3 changed files with 26 additions and 0 deletions

View File

@ -66,6 +66,9 @@ static void wilco_ec_init(struct device *dev)
/* Unmute speakers */ /* Unmute speakers */
wilco_ec_send(KB_HW_MUTE_CONTROL, AUDIO_UNMUTE_125MS); wilco_ec_send(KB_HW_MUTE_CONTROL, AUDIO_UNMUTE_125MS);
/* Enable WiFi radio */
wilco_ec_radio_control(RADIO_WIFI, 1);
} }
static void wilco_ec_resource(struct device *dev, int index, static void wilco_ec_resource(struct device *dev, int index,

View File

@ -149,3 +149,12 @@ void wilco_ec_power_off(enum ec_power_off_reason reason)
KB_POWER_OFF, &reason, 1, NULL, 0) < 0) KB_POWER_OFF, &reason, 1, NULL, 0) < 0)
printk(BIOS_ERR, "%s: command failed\n", __func__); printk(BIOS_ERR, "%s: command failed\n", __func__);
} }
int wilco_ec_radio_control(enum ec_radio radio, uint8_t state)
{
uint8_t radio_control[3] = { 0, radio, state };
return wilco_ec_mailbox(WILCO_EC_MSG_DEFAULT, KB_RADIO_CONTROL,
radio_control, ARRAY_SIZE(radio_control),
NULL, 0);
}

View File

@ -26,6 +26,8 @@ enum {
KB_POWER_STATUS = 0x05, KB_POWER_STATUS = 0x05,
/* Inform the EC aboout the reason host is turning off */ /* Inform the EC aboout the reason host is turning off */
KB_POWER_OFF = 0x08, KB_POWER_OFF = 0x08,
/* Control wireless radios */
KB_RADIO_CONTROL = 0x2b,
/* Save PS/2 data before S3 suspend */ /* Save PS/2 data before S3 suspend */
KB_SAVE = 0x2f, KB_SAVE = 0x2f,
/* Restore PS/2 data after S3 resume */ /* Restore PS/2 data after S3 resume */
@ -61,6 +63,18 @@ enum ec_audio_mute {
AUDIO_UNMUTE_125MS, /* Unmute in 125ms */ AUDIO_UNMUTE_125MS, /* Unmute in 125ms */
}; };
enum ec_radio {
RADIO_WIFI = 0x02,
};
/**
* wilco_ec_radio_control() - Control wireless radios.
* @ec_radio: Wireless radio type.
* @state: Turn radio on or off.
* Return: 0 if successful or negative error code on failure.
*/
int wilco_ec_radio_control(enum ec_radio radio, uint8_t state);
/* /*
* EC Information * EC Information
*/ */