Sean Rhodes has submitted this change. ( https://review.coreboot.org/c/coreboot/+/86402?usp=email )
Change subject: drivers/wifi/generic: Add Methods to control CNVi enable GPIO ......................................................................
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 --- M src/drivers/wifi/generic/acpi.c M src/drivers/wifi/generic/chip.h 2 files changed, 70 insertions(+), 0 deletions(-)
Approvals: Matt DeVillier: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 7820987..8cab106 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -1181,6 +1181,60 @@ 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 @@ 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 } diff --git a/src/drivers/wifi/generic/chip.h b/src/drivers/wifi/generic/chip.h index 302dd14..f6a68e2 100644 --- a/src/drivers/wifi/generic/chip.h +++ b/src/drivers/wifi/generic/chip.h @@ -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 @@ */ 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; };