From 7cc513557d41ea86e4c5ce4a9dba14b879c8b7b2 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 14 Jan 2021 16:38:39 -0700 Subject: [PATCH] ec/system76/ec: Add fan and temperature reporting Signed-off-by: Jeremy Soller Signed-off-by: Tim Crawford Change-Id: Iee19e7518ffaacd9a847cb6d28c839d4ec464514 Reviewed-on: https://review.coreboot.org/c/coreboot/+/49465 Tested-by: build bot (Jenkins) --- src/ec/system76/ec/acpi/s76.asl | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/ec/system76/ec/acpi/s76.asl b/src/ec/system76/ec/acpi/s76.asl index 7beb50b813..a2bb310938 100644 --- a/src/ec/system76/ec/acpi/s76.asl +++ b/src/ec/system76/ec/acpi/s76.asl @@ -111,4 +111,51 @@ Device (S76D) { } } #endif // CONFIG(EC_SYSTEM76_EC_COLOR_KEYBOARD) + + // Fan names + Method (NFAN, 0, Serialized) { + Return (Package() { + "CPU fan", + }) + } + + // Get fan duty cycle and RPM as a single value + Method (GFAN, 1, Serialized) { + Local0 = 0 + Local1 = 0 + If (^^PCI0.LPCB.EC0.ECOK) { + If (Arg0 == 0) { + Local0 = ^^PCI0.LPCB.EC0.DUT1 + Local1 = ^^PCI0.LPCB.EC0.RPM1 + } ElseIf (Arg0 == 1) { + Local0 = ^^PCI0.LPCB.EC0.DUT2 + Local1 = ^^PCI0.LPCB.EC0.RPM2 + } + } + If (Local1 != 0) { + // 60 * (EC frequency / 120) / 2 + Local1 = 2156250 / Local1 + } + Return ((Local1 << 8) | Local0) + } + + // Temperature names + Method (NTMP, 0, Serialized) { + Return (Package() { + "CPU temp", + }) + } + + // Get temperature + Method (GTMP, 1, Serialized) { + Local0 = 0; + If (^^PCI0.LPCB.EC0.ECOK) { + If (Arg0 == 0) { + Local0 = ^^PCI0.LPCB.EC0.TMP1 + } ElseIf (Arg0 == 1) { + Local0 = ^^PCI0.LPCB.EC0.TMP2 + } + } + Return (Local0) + } }