From 970cc131920805ce52b2cffe3f9293745c82968b Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Mon, 30 Aug 2021 10:55:41 -0600 Subject: [PATCH] mb/system76/{galp5,gaze16}: acpi: Save/Restore NVIDIA SSID Save NVIDIA device subsystem ID before turning off the GPU, and restore it after turning on the GPU. This prevents to GPU from having the default 10de:0000 SSID on RTD3 _ON. Fixes formatting and device scope. Tested on gaze16-3050 by checking lspci after RTD3 _OFF. $ cat /sys/bus/pci/devices/0000\:01\:00.0/power/runtime_status suspended $ lspci -s 01:00.0 -vnn | grep Subsystem Subsystem: CLEVO/KAPOK Computer GA107M [GeForce RTX 3050 Mobile] [1558:5015] Change-Id: Ic5a91f96a5741abb605906f404b1632eaec73590 Signed-off-by: Tim Crawford --- src/mainboard/system76/galp5/acpi/dgpu.asl | 48 +++++++++++---------- src/mainboard/system76/gaze16/acpi/dgpu.asl | 48 +++++++++++---------- 2 files changed, 50 insertions(+), 46 deletions(-) diff --git a/src/mainboard/system76/galp5/acpi/dgpu.asl b/src/mainboard/system76/galp5/acpi/dgpu.asl index 52d8714bfe..cc11f142a1 100644 --- a/src/mainboard/system76/galp5/acpi/dgpu.asl +++ b/src/mainboard/system76/galp5/acpi/dgpu.asl @@ -1,30 +1,32 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -Scope (\_SB.PCI0.RP01) { - Device (DEV0) { - Name(_ADR, 0x00000000) +Scope (\_SB.PCI0.RP05) { + Device (DEV0) { + Name(_ADR, 0x00000000) + Name(SSID, 0x00000000) - OperationRegion (PCIC, PCI_Config, 0x00, 0x50) - Field (PCIC, DwordAcc, NoLock, Preserve) { - Offset (0x40), - SSID, 32 - } + OperationRegion (PCIC, PCI_Config, 0x00, 0x50) + Field (PCIC, DwordAcc, NoLock, Preserve) { + Offset (0x40), + NVID, 32 + } - Name (_PR0, Package () { PWRR }) - Name (_PR3, Package () { PWRR }) - PowerResource (PWRR, 0, 0) { - Name (_STA, 1) + Name (_PR0, Package () { PWRR }) + Name (_PR3, Package () { PWRR }) + PowerResource (PWRR, 0, 0) { + Name (_STA, 1) - Method (_ON) { - ^^SSID = 0x40181558 - Printf("GPU _ON %o", ToHexString(^^SSID)) - _STA = 1 - } + Method (_ON) { + ^^NVID = ^^SSID + Printf("GPU _ON %o", ToHexString(^^SSID)) + _STA = 1 + } - Method (_OFF) { - Printf("GPU _OFF %o", ToHexString(^^SSID)) - _STA = 0 - } - } - } + Method (_OFF) { + ^^SSID = ^^NVID + Printf("GPU _OFF %o", ToHexString(^^SSID)) + _STA = 0 + } + } + } } diff --git a/src/mainboard/system76/gaze16/acpi/dgpu.asl b/src/mainboard/system76/gaze16/acpi/dgpu.asl index f82da2e181..ba1e2d7d0f 100644 --- a/src/mainboard/system76/gaze16/acpi/dgpu.asl +++ b/src/mainboard/system76/gaze16/acpi/dgpu.asl @@ -1,30 +1,32 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -Scope (\_SB.PCI0.RP01) { - Device (DEV0) { - Name(_ADR, 0x00000000) +Scope (\_SB.PCI0.PEG1) { + Device (DEV0) { + Name(_ADR, 0x00000000) + Name(SSID, 0x00000000) - OperationRegion (PCIC, PCI_Config, 0x00, 0x50) - Field (PCIC, DwordAcc, NoLock, Preserve) { - Offset (0x40), - SSID, 32 - } + OperationRegion (PCIC, PCI_Config, 0x00, 0x50) + Field (PCIC, DwordAcc, NoLock, Preserve) { + Offset (0x40), + NVID, 32 + } - Name (_PR0, Package () { PWRR }) - Name (_PR3, Package () { PWRR }) - PowerResource (PWRR, 0, 0) { - Name (_STA, 1) + Name (_PR0, Package () { PWRR }) + Name (_PR3, Package () { PWRR }) + PowerResource (PWRR, 0, 0) { + Name (_STA, 1) - Method (_ON) { - ^^SSID = 0x50171558 - Printf("GPU _ON %o", ToHexString(^^SSID)) - _STA = 1 - } + Method (_ON) { + ^^NVID = ^^SSID + Printf("GPU _ON %o", ToHexString(^^SSID)) + _STA = 1 + } - Method (_OFF) { - Printf("GPU _OFF %o", ToHexString(^^SSID)) - _STA = 0 - } - } - } + Method (_OFF) { + ^^SSID = ^^NVID + Printf("GPU _OFF %o", ToHexString(^^SSID)) + _STA = 0 + } + } + } }