From def337aa7ec6fb1d4c4f668fa5884cf17cb45efb Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Thu, 13 Feb 2025 09:27:19 +0000 Subject: [PATCH] soc/intel/common: Add support for WiFi SW RF Kill on CNVi Hook CNVC and CNVS Methods into the power resource for the CNVi which is provided via the `wifi/generic` driver to allow for WiFi SW RF Kill (low power mode) support. Add corresponding _PS3 and _PS0 Methods, change the power resource to S0 from S5, and rename the power resource from WRST to CNVP for better relevance. Test=boot `starlabs/starlite_adl`, disconnect wireless and verify with inteltool that the WIFI_RF_KILL GPIO is asserted. Change-Id: I22292ad97c439e50fe5d7a6b79f77847e71ca62c Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86403 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/intel/common/block/cnvi/cnvi.c | 119 ++++++++++++++++++++----- 1 file changed, 98 insertions(+), 21 deletions(-) diff --git a/src/soc/intel/common/block/cnvi/cnvi.c b/src/soc/intel/common/block/cnvi/cnvi.c index a4263af646..e0a9566b1f 100644 --- a/src/soc/intel/common/block/cnvi/cnvi.c +++ b/src/soc/intel/common/block/cnvi/cnvi.c @@ -92,17 +92,30 @@ static void cnvw_fill_ssdt(const struct device *dev) acpigen_write_name_integer("RSTT", 0); /* - * PowerResource(WRST, 5, 0) + * PowerResource(CNVP, 0, 0) * { * Method(_STA) * { - * Return (0x01) + * If (CondRefOf (\_SB.PCI0.CNVS)) { + * Local0 = \_SB.PCI0.CNVS() + * Return (Local0) + * } + * Else + * { + * Return (0x01) + * } * } * Method(_ON, 0) * { + * If (CondRefOf (\_SB.PCI0.CNVC)) { + * \_SB.PCI0.CNVS(1) + * } * } * Method(_OFF, 0) * { + * If (CondRefOf (\_SB.PCI0.CNVC)) { + * \_SB.PCI0.CNVS(0) + * } * } * Method(_RST, 0, NotSerialized) * { @@ -150,18 +163,46 @@ static void cnvw_fill_ssdt(const struct device *dev) * } * */ - acpigen_write_power_res("WRST", 5, 0, NULL, 0); + acpigen_write_power_res("CNVP", 0, 0, NULL, 0); { acpigen_write_method("_STA", 0); { - acpigen_write_return_integer(1); + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVS"); + { + acpigen_write_store(); + acpigen_emit_namestring("\\_SB.PCI0.CNVS"); + acpigen_emit_byte(LOCAL0_OP); + + acpigen_write_return_op(LOCAL0_OP); + } + acpigen_write_else(); + { + acpigen_write_return_integer(1); + } + acpigen_pop_len(); } acpigen_pop_len(); acpigen_write_method("_ON", 0); + { + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); + { + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); + acpigen_emit_byte(1); + } + acpigen_pop_len(); + } acpigen_pop_len(); acpigen_write_method("_OFF", 0); + { + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); + { + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); + acpigen_emit_byte(0); + } + acpigen_pop_len(); + } acpigen_pop_len(); acpigen_write_method("_RST", 0); @@ -266,13 +307,64 @@ static void cnvw_fill_ssdt(const struct device *dev) /* * Name (_PRR, Package (0x01) * { - * WRST + * CNVP * }) */ acpigen_write_name("_PRR"); { acpigen_write_package(1); - acpigen_emit_namestring("WRST"); + acpigen_emit_namestring("CNVP"); + } + acpigen_pop_len(); + +/* + * Name (_PR0, Package (0x01) + * { + * CNVP + * }) + */ + acpigen_write_name("_PR0"); + { + acpigen_write_package(1); + acpigen_emit_namestring("CNVP"); + } + acpigen_pop_len(); + +/* + * Method (_PS0, 0, NotSerialized) + * { + * If (CondRefOf (\_SB.PCI0.CNVC)) { + * \_SB.PCI0.CNVS(1) + * } + * } + */ + acpigen_write_method("_PS0", 0); + { + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); + { + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); + acpigen_emit_byte(1); + } + acpigen_pop_len(); + } + acpigen_pop_len(); + +/* + * Method (_PS3, 0, NotSerialized) + * { + * If (CondRefOf (\_SB.PCI0.CNVC)) { + * \_SB.PCI0.CNVS(0) + * } + * } + */ + acpigen_write_method("_PS3", 0); + { + acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); + { + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); + acpigen_emit_byte(0); + } + acpigen_pop_len(); } acpigen_pop_len(); @@ -305,21 +397,6 @@ static void cnvw_fill_ssdt(const struct device *dev) } acpigen_pop_len(); -/* - * Method (_PS0, 0, Serialized) - * { - * } - * - * Method (_PS3, 0, Serialized) - * { - * } - */ - acpigen_write_method_serialized("_PS0", 0); - acpigen_pop_len(); - - acpigen_write_method_serialized("_PS3", 0); - acpigen_pop_len(); - /* * Method (CFLR, 0, NotSerialized) * {