From ce29eab03507754654ebd62210bcaefa0ea5ee1b Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Tue, 28 Jun 2022 12:03:20 -0600 Subject: mb/google/brya/acpi: Keep track of dGPU power state To avoid extraneous calls from the kernel to _ON or _OFF, keep track of the power state of the GPU in an integer and exit _ON and _OFF routines early when attempting to enter the current state. BUG=b:236676400 Signed-off-by: Tim Wawrzynczak Change-Id: Ie874fcdc7022c4fde6f557d1ee06e8392ae3d850 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65482 Tested-by: build bot (Jenkins) Reviewed-by: Robert Zieba Reviewed-by: Eric Lai --- src/mainboard/google/brya/acpi/power.asl | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mainboard/google/brya/acpi/power.asl b/src/mainboard/google/brya/acpi/power.asl index 8232a32e56..daaba74385 100644 --- a/src/mainboard/google/brya/acpi/power.asl +++ b/src/mainboard/google/brya/acpi/power.asl @@ -23,7 +23,7 @@ Name (OPCS, OPTIMUS_POWER_CONTROL_DISABLE) /* PCI configuration space Owner */ -Name (PCIO, PCI_OWNER_SBIOS) +Name (PCIO, PCI_OWNER_DRIVER) /* Saved PCI configuration space memory (VGA Buffer) */ Name (VGAB, Buffer (0xfb) { 0x00 }) @@ -34,6 +34,11 @@ Name (OPS0, OPTIMUS_CONTROL_NO_RUN_PS0) /* GC6 Entry/Exit state */ Name (GC6E, GC6_STATE_EXITED) +/* Power State, GCOFF, GCON */ +#define GPU_POWER_STATE_OFF 0 +#define GPU_POWER_STATE_ON 1 +Name (GPPS, GPU_POWER_STATE_ON) + /* Defer GC6 entry / exit until D3-cold request */ Name (DFEN, 0) /* Deferred GC6 Enter control */ @@ -129,6 +134,12 @@ Method (GC6O, 0, Serialized) /* GCOFF exit sequence */ Method (PGON, 0, Serialized) { + If (GPPS == GPU_POWER_STATE_ON) + { + Printf ("PGON: GPU already on") + Return + } + /* Assert PERST# */ \_SB.PCI0.CTXS (GPIO_GPU_PERST_L) @@ -158,17 +169,28 @@ Method (PGON, 0, Serialized) /* Deassert PERST# */ \_SB.PCI0.STXS (GPIO_GPU_PERST_L) + + GC6E = GC6_STATE_EXITED + GPPS = GPU_POWER_STATE_ON + Printf ("GPU Sequenced on") } /* GCOFF entry sequence */ Method (PGOF, 0, Serialized) { + If (GPPS == GPU_POWER_STATE_OFF) + { + Printf ("GPU already off") + Return + } + /* Assert PERST# */ \_SB.PCI0.CTXS (GPIO_GPU_PERST_L) Sleep (5) /* All rails are about to go down */ \_SB.PCI0.CTXS (GPIO_GPU_ALLRAILS_PG) + Sleep (1) /* Ramp down FBVDD (active-low) and let rail discharge to <10% */ \_SB.PCI0.STXS (GPIO_FBVDD_PWR_EN) @@ -193,6 +215,9 @@ Method (PGOF, 0, Serialized) /* Ramp down 1.8V */ \_SB.PCI0.CTXS (GPIO_1V8_PWR_EN) GPPL (GPIO_1V8_PG, 0, 20) + + GPPS = GPU_POWER_STATE_OFF + Printf ("GPU sequenced off") } /* Handle deferred GC6 vs. poweron request */ -- cgit v1.2.3