From ba7ed69583e772e13bc27b5560498524e3d08ef8 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 9 Apr 2025 12:34:52 +0100 Subject: [PATCH] soc/intel/cnvi: Skip calling _ON when device is already enabled Add a check in the _ON method, similar to coreboot's ONSK handling in its RTD3 driver, to determine whether the enable GPIO is already asserted. This prevents the OS from repeatedly invoking _ON, which can happen because CNVi takes around 300ms to initialize after the GPIO is enabled. Change-Id: I53986aa11714666c12056460aa47396266a00a1c Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/87240 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/intel/common/block/cnvi/cnvi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/soc/intel/common/block/cnvi/cnvi.c b/src/soc/intel/common/block/cnvi/cnvi.c index 1c668ba736..6d7bbad4e8 100644 --- a/src/soc/intel/common/block/cnvi/cnvi.c +++ b/src/soc/intel/common/block/cnvi/cnvi.c @@ -113,6 +113,9 @@ static void cnvw_fill_ssdt(const struct device *dev) * Method(_ON, 0) * { * If (CondRefOf (\_SB.PCI0.CNVC)) { + * If ((\_SB.PCI0.CNVS() == 1)) { + * Return (1) + * } * \_SB.PCI0.CNVS(1) * } * } @@ -194,6 +197,17 @@ static void cnvw_fill_ssdt(const struct device *dev) { acpigen_write_if_cond_ref_of("\\_SB.PCI0.CNVC"); { + + acpigen_write_store(); + acpigen_emit_namestring("\\_SB.PCI0.CNVS"); + acpigen_emit_byte(LOCAL0_OP); + + acpigen_write_if_lequal_op_int(LOCAL0_OP, 1); + { + acpigen_write_return_integer(1); + } + acpigen_pop_len(); + acpigen_emit_namestring("\\_SB.PCI0.CNVC"); acpigen_emit_byte(1); }