From 3c6377fb4fcdff89e1509e9eeab7ce563dc45053 Mon Sep 17 00:00:00 2001 From: Naresh G Solanki Date: Mon, 3 Jul 2017 21:57:11 +0530 Subject: driver/intel/wifi: Update wifi wake source in elog In S3 resume, wifi is one of the wake sources. If elog is enabled in config, then log wifi wakes in elog. BUG=b:36992859 TEST= Build for Soraka. Do WoWlan during S3. Verify elog having update on wake due to Wifi. Change-Id: I7d42c5c81e0a3f7a3f94c3f6b7d2ebdf029d1aff Signed-off-by: Naresh G Solanki Reviewed-on: https://review.coreboot.org/20455 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/drivers/intel/wifi/wifi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/drivers/intel/wifi') diff --git a/src/drivers/intel/wifi/wifi.c b/src/drivers/intel/wifi/wifi.c index 91c21fecff..d1d5684a19 100644 --- a/src/drivers/intel/wifi/wifi.c +++ b/src/drivers/intel/wifi/wifi.c @@ -21,12 +21,16 @@ #include #include #include +#include #include #include #include #include #include "chip.h" +#define PMCS_DR 0xcc +#define PME_STS (1 << 15) + #if IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLES) static int smbios_write_wifi(struct device *dev, int *handle, unsigned long *current) @@ -197,6 +201,18 @@ static const char *intel_wifi_acpi_name(struct device *dev) } #endif +static void wifi_pci_dev_init(struct device *dev) +{ + pci_dev_init(dev); + + if (IS_ENABLED(CONFIG_ELOG)) { + uint32_t val; + val = pci_read_config16(dev, PMCS_DR); + if (val & PME_STS) + elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0); + } +} + static struct pci_operations pci_ops = { .set_subsystem = pci_dev_set_subsystem, }; @@ -205,7 +221,7 @@ struct device_operations device_ops = { .read_resources = pci_dev_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, - .init = pci_dev_init, + .init = wifi_pci_dev_init, #if IS_ENABLED(CONFIG_GENERATE_SMBIOS_TABLES) .get_smbios_data = smbios_write_wifi, #endif -- cgit v1.2.3