From 872e06d60c8761f1ea97deb38af4fb875a520e4f Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Wed, 12 Nov 2025 11:59:16 -0600 Subject: [PATCH] mb/samsung/stumpy: inline fan thresholds and drop GNVS programming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - mirror Beltino’s thermal AML pattern by including `thermal.h` and using the static macros directly - add `_INI` and `_STA`-guarded power resources so FAN4 idle state is established without relying on preseeded GNVS values - remove the now-unused GNVS fan table and temperature fields from `acpi_tables.c`, leaving only the USB suspend defaults This simplifies Stumpy's fan control and unifies it with newer boards like Beltino and Jecht, and fixes an issue where the fan was not starting automatically under Windows. TEST=build/boot Win11, Ubuntu 25.10 on Stumpy, verify fan starts and adjusts automatically, CPU temps kept under control. Change-Id: Ie9c8c46e4bf3412ea60d7fe8f2d97651bca266f1 Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/90056 Tested-by: build bot (Jenkins) Reviewed-by: Sean Rhodes --- src/mainboard/samsung/stumpy/acpi/thermal.asl | 114 +++++++++++------- src/mainboard/samsung/stumpy/acpi_tables.c | 27 ----- 2 files changed, 71 insertions(+), 70 deletions(-) diff --git a/src/mainboard/samsung/stumpy/acpi/thermal.asl b/src/mainboard/samsung/stumpy/acpi/thermal.asl index 2dcb13fabe..cc8a060443 100644 --- a/src/mainboard/samsung/stumpy/acpi/thermal.asl +++ b/src/mainboard/samsung/stumpy/acpi/thermal.asl @@ -2,6 +2,8 @@ // Thermal Zone +#include "../thermal.h" + External (\PPKG, MethodObj) Scope (\_TZ) @@ -31,13 +33,13 @@ Scope (\_TZ) // Threshold for OS to shutdown Method (_CRT, 0, Serialized) { - Return (CTOK (\TCRT)) + Return (CTOK (CRITICAL_TEMPERATURE)) } // Threshold for passive cooling Method (_PSV, 0, Serialized) { - Return (CTOK (\TPSV)) + Return (CTOK (PASSIVE_TEMPERATURE)) } // Processors used for passive cooling @@ -46,6 +48,14 @@ Scope (\_TZ) Return (\PPKG ()) } + // Initialize to the lowest cooling state (fan idle) + Method (_INI) + { + \FLVL = 4 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN4_PWM + Notify (\_TZ.THRM, 0x81) + } + Method (_TMP, 0, Serialized) { // Get CPU Temperature from PECI via SuperIO TMPIN3 @@ -53,59 +63,59 @@ Scope (\_TZ) // Check for invalid readings If ((Local0 == 255) || (Local0 == 0)) { - Return (CTOK (\F2ON)) + Return (CTOK (FAN2_THRESHOLD_ON)) } // PECI raw value is an offset from Tj_max Local1 = 255 - Local0 // Handle values greater than Tj_max - If (Local1 >= \TMAX) { - Return (CTOK (\TMAX)) + If (Local1 >= MAX_TEMPERATURE) { + Return (CTOK (MAX_TEMPERATURE)) } // Subtract from Tj_max to get temperature - Local0 = \TMAX - Local1 + Local0 = MAX_TEMPERATURE - Local1 Return (CTOK (Local0)) } Method (_AC0) { If (\FLVL <= 0) { - Return (CTOK (\F0OF)) + Return (CTOK (FAN0_THRESHOLD_OFF)) } Else { - Return (CTOK (\F0ON)) + Return (CTOK (FAN0_THRESHOLD_ON)) } } Method (_AC1) { If (\FLVL <= 1) { - Return (CTOK (\F1OF)) + Return (CTOK (FAN1_THRESHOLD_OFF)) } Else { - Return (CTOK (\F1ON)) + Return (CTOK (FAN1_THRESHOLD_ON)) } } Method (_AC2) { If (\FLVL <= 2) { - Return (CTOK (\F2OF)) + Return (CTOK (FAN2_THRESHOLD_OFF)) } Else { - Return (CTOK (\F2ON)) + Return (CTOK (FAN2_THRESHOLD_ON)) } } Method (_AC3) { If (\FLVL <= 3) { - Return (CTOK (\F3OF)) + Return (CTOK (FAN3_THRESHOLD_OFF)) } Else { - Return (CTOK (\F3ON)) + Return (CTOK (FAN3_THRESHOLD_ON)) } } Method (_AC4) { If (\FLVL <= 4) { - Return (CTOK (\F4OF)) + Return (CTOK (FAN4_THRESHOLD_OFF)) } Else { - Return (CTOK (\F4ON)) + Return (CTOK (FAN4_THRESHOLD_ON)) } } @@ -125,14 +135,18 @@ Scope (\_TZ) } } Method (_ON) { - \FLVL = 0 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F0PW - Notify (\_TZ.THRM, 0x81) + If (! _STA ()) { + \FLVL = 0 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN0_PWM + Notify (\_TZ.THRM, 0x81) + } } Method (_OFF) { - \FLVL = 1 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F1PW - Notify (\_TZ.THRM, 0x81) + If (_STA ()) { + \FLVL = 1 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN1_PWM + Notify (\_TZ.THRM, 0x81) + } } } @@ -146,14 +160,18 @@ Scope (\_TZ) } } Method (_ON) { - \FLVL = 1 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F1PW - Notify (\_TZ.THRM, 0x81) + If (! _STA ()) { + \FLVL = 1 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN1_PWM + Notify (\_TZ.THRM, 0x81) + } } Method (_OFF) { - \FLVL = 2 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F2PW - Notify (\_TZ.THRM, 0x81) + If (_STA ()) { + \FLVL = 2 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN2_PWM + Notify (\_TZ.THRM, 0x81) + } } } @@ -167,14 +185,18 @@ Scope (\_TZ) } } Method (_ON) { - \FLVL = 2 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F2PW - Notify (\_TZ.THRM, 0x81) + If (! _STA ()) { + \FLVL = 2 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN2_PWM + Notify (\_TZ.THRM, 0x81) + } } Method (_OFF) { - \FLVL = 3 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F3PW - Notify (\_TZ.THRM, 0x81) + If (_STA ()) { + \FLVL = 3 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN3_PWM + Notify (\_TZ.THRM, 0x81) + } } } @@ -188,14 +210,18 @@ Scope (\_TZ) } } Method (_ON) { - \FLVL = 3 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F3PW - Notify (\_TZ.THRM, 0x81) + If (! _STA ()) { + \FLVL = 3 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN3_PWM + Notify (\_TZ.THRM, 0x81) + } } Method (_OFF) { - \FLVL = 4 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW - Notify (\_TZ.THRM, 0x81) + If (_STA ()) { + \FLVL = 4 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN4_PWM + Notify (\_TZ.THRM, 0x81) + } } } @@ -209,9 +235,11 @@ Scope (\_TZ) } } Method (_ON) { - \FLVL = 4 - \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW - Notify (\_TZ.THRM, 0x81) + If (! _STA ()) { + \FLVL = 4 + \_SB.PCI0.LPCB.SIO.ENVC.F3PS = FAN4_PWM + Notify (\_TZ.THRM, 0x81) + } } Method (_OFF) { // FAN4 is the minimum cooling state (idle/lowest fan speed) diff --git a/src/mainboard/samsung/stumpy/acpi_tables.c b/src/mainboard/samsung/stumpy/acpi_tables.c index 6912ca1a76..9c8c690e93 100644 --- a/src/mainboard/samsung/stumpy/acpi_tables.c +++ b/src/mainboard/samsung/stumpy/acpi_tables.c @@ -4,8 +4,6 @@ #include #include -#include "thermal.h" - void mainboard_fill_gnvs(struct global_nvs *gnvs) { /* Enable Front USB ports in S3 by default */ @@ -18,29 +16,4 @@ void mainboard_fill_gnvs(struct global_nvs *gnvs) */ gnvs->s5u0 = 1; gnvs->s5u1 = 1; - - gnvs->f4of = FAN4_THRESHOLD_OFF; - gnvs->f4on = FAN4_THRESHOLD_ON; - gnvs->f4pw = FAN4_PWM; - - gnvs->f3of = FAN3_THRESHOLD_OFF; - gnvs->f3on = FAN3_THRESHOLD_ON; - gnvs->f3pw = FAN3_PWM; - - gnvs->f2of = FAN2_THRESHOLD_OFF; - gnvs->f2on = FAN2_THRESHOLD_ON; - gnvs->f2pw = FAN2_PWM; - - gnvs->f1of = FAN1_THRESHOLD_OFF; - gnvs->f1on = FAN1_THRESHOLD_ON; - gnvs->f1pw = FAN1_PWM; - - gnvs->f0of = FAN0_THRESHOLD_OFF; - gnvs->f0on = FAN0_THRESHOLD_ON; - gnvs->f0pw = FAN0_PWM; - - gnvs->tcrt = CRITICAL_TEMPERATURE; - gnvs->tpsv = PASSIVE_TEMPERATURE; - gnvs->tmax = MAX_TEMPERATURE; - gnvs->flvl = 5; }