drivers/wifi/generic: Add Methods to control CNVi enable GPIO

Add two new methods, CNVS and CNVC, that can check and control
the enable GPIO for a CNVi module.

These will be used by the common code for WiFi SW RF Kill (Low
Power Mode).

Change-Id: I09d0011ede6f739511a61daf2f1b317f6500a343
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86402
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
Sean Rhodes 2025-02-13 09:21:58 +00:00
commit f2d91575ac
2 changed files with 70 additions and 0 deletions

View file

@ -1181,6 +1181,60 @@ const char *wifi_pcie_acpi_name(const struct device *dev)
return wifi_acpi_name;
}
#if CONFIG(SOC_INTEL_COMMON_BLOCK_CNVI)
static void write_cnvi_control(const struct acpi_gpio *gpio)
{
acpigen_write_scope("\\_SB.PCI0");
/*
* CNVi Status
*
* Method (CNVS, 0)
* {
* Local0 = \_SB.PCI0.GTXS (gpio)
* Return (Local0)
* }
*/
acpigen_write_method("CNVS", 0);
{
acpigen_get_tx_gpio(gpio);
acpigen_write_return_op(LOCAL0_OP);
}
acpigen_pop_len();
/*
* CNVi Control
*
* Method (CNVC, 1, NotSerialized)
* {
* If ((Arg0 == One))
* {
* \_SB.PCI0.STXS (gpio)
* }
* Else
* {
* \_SB.PCI0.CTXS (gpio)
* }
* }
*/
acpigen_write_method("CNVC", 1);
{
acpigen_write_if_lequal_op_int(ARG0_OP, 1);
{
acpigen_enable_tx_gpio(gpio);
}
acpigen_write_else();
{
acpigen_disable_tx_gpio(gpio);
}
acpigen_pop_len();
}
acpigen_pop_len();
acpigen_write_scope_end();
}
#endif
void wifi_cnvi_fill_ssdt(const struct device *dev)
{
const char *path;
@ -1192,4 +1246,10 @@ void wifi_cnvi_fill_ssdt(const struct device *dev)
return;
wifi_ssdt_write_properties(dev, path);
#if CONFIG(SOC_INTEL_COMMON_BLOCK_CNVI)
const struct drivers_wifi_generic_config *config = dev->chip_info;
if (config->cnvi_enable_gpio.pin_count)
write_cnvi_control(&config->cnvi_enable_gpio);
#endif
}

View file

@ -3,6 +3,8 @@
#ifndef _WIFI_GENERIC_H_
#define _WIFI_GENERIC_H_
#include <acpi/acpi_device.h>
/**
* struct drivers_wifi_generic_config - Data structure to contain generic wifi config
* @wake: Wake pin for ACPI _PRW
@ -20,6 +22,14 @@ struct drivers_wifi_generic_config {
*/
bool enable_cnvi_ddr_rfim;
#if CONFIG(SOC_INTEL_COMMON_BLOCK_CNVI)
/*
* Enable GPIO for CNVi that will be used for WiFi SW RF Kill (Low
* Power Mode).
*/
struct acpi_gpio cnvi_enable_gpio;
#endif
/* Pointer to the Bluetooth companion device */
DEVTREE_CONST struct device *bluetooth_companion;
};