From 7aae2adda7c1a05dae0dbcecd243ae26618077e8 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 21 Aug 2014 12:06:48 -0700 Subject: [PATCH] auron: Change thermal behavior to match other haswell platforms Auron port of Samus commit 8e51d1d74cdcadde9cbf10e8321d601b099c46bc. BUG=chrome-os-partner:31286 TEST=Compile only. BRANCH=None. Change-Id: I8b50edf37062205193acecf984c1b4ee33b3222a Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/213953 Reviewed-by: Duncan Laurie --- src/mainboard/google/auron/acpi/thermal.asl | 112 ++++++-------------- src/mainboard/google/auron/acpi_tables.c | 12 +-- src/mainboard/google/auron/ec.h | 2 + src/mainboard/google/auron/thermal.h | 9 +- 4 files changed, 43 insertions(+), 92 deletions(-) diff --git a/src/mainboard/google/auron/acpi/thermal.asl b/src/mainboard/google/auron/acpi/thermal.asl index 1628d33920..ab07337652 100644 --- a/src/mainboard/google/auron/acpi/thermal.asl +++ b/src/mainboard/google/auron/acpi/thermal.asl @@ -21,6 +21,20 @@ Scope (\_TZ) { + // Handler for throttle requests on this platform + // 0 = Stop throttling + // 1 = Start throttling + Method (THRT, 1, Serialized) + { + If (LEqual (Arg0, 0)) { + /* Disable Power Limit */ + \_SB.PCI0.MCHC.CTLD () + } Else { + /* Enable Power Limit */ + \_SB.PCI0.MCHC.CTLE (\F0PW) + } + } + ThermalZone (THRM) { Name (_TC1, 0x02) @@ -61,7 +75,7 @@ Scope (\_TZ) Return (\PPKG ()) } - Method (_TMP, 0, Serialized) + Method (TCHK, 0, Serialized) { // Get Temperature from TIN# set in NVS Store (\_SB.PCI0.LPCB.EC0.TINS (TMPS), Local0) @@ -94,85 +108,29 @@ Scope (\_TZ) Return (Local0) } - /* CTDP Down */ - Method (_AC0) { - If (LLessEqual (\FLVL, 0)) { - Return (CTOK (\F0OF)) - } Else { - Return (CTOK (\F0ON)) - } - } - - /* CTDP Nominal */ - Method (_AC1) { - If (LLessEqual (\FLVL, 1)) { - Return (CTOK (\F1OF)) - } Else { - Return (CTOK (\F1ON)) - } - } - - Name (_AL0, Package () { TDP0 }) - Name (_AL1, Package () { TDP1 }) - - PowerResource (TNP0, 0, 0) + Method (_TMP, 0, Serialized) { - Method (_STA) { - If (LLessEqual (\FLVL, 0)) { - Return (One) - } Else { - Return (Zero) - } + // Get temperature from EC in deci-kelvin + Store (TCHK (), Local0) + + // Critical temperature in deci-kelvin + Store (CTOK (\TCRT), Local1) + + If (LGreaterEqual (Local0, Local1)) { + Store ("CRITICAL TEMPERATURE", Debug) + Store (Local0, Debug) + + // Wait 1 second for EC to re-poll + Sleep (1000) + + // Re-read temperature from EC + Store (TCHK (), Local0) + + Store ("RE-READ TEMPERATURE", Debug) + Store (Local0, Debug) } - Method (_ON) { - Store (0, \FLVL) - /* Enable Power Limit */ - \_SB.PCI0.MCHC.CTLE (\F0PW) - - Notify (\_TZ.THRM, 0x81) - } - Method (_OFF) { - Store (1, \FLVL) - - /* Disable Power Limit */ - \_SB.PCI0.MCHC.CTLD () - - Notify (\_TZ.THRM, 0x81) - } - } - - PowerResource (TNP1, 0, 0) - { - Method (_STA) { - If (LLessEqual (\FLVL, 1)) { - Return (One) - } Else { - Return (Zero) - } - } - Method (_ON) { - Store (1, \FLVL) - Notify (\_TZ.THRM, 0x81) - } - Method (_OFF) { - Store (1, \FLVL) - Notify (\_TZ.THRM, 0x81) - } - } - - Device (TDP0) - { - Name (_HID, EISAID ("PNP0C0B")) - Name (_UID, 0) - Name (_PR0, Package () { TNP0 }) - } - - Device (TDP1) - { - Name (_HID, EISAID ("PNP0C0B")) - Name (_UID, 1) - Name (_PR0, Package () { TNP1 }) + Return (Local0) } } } diff --git a/src/mainboard/google/auron/acpi_tables.c b/src/mainboard/google/auron/acpi_tables.c index 2d38d70637..51dc6540b6 100644 --- a/src/mainboard/google/auron/acpi_tables.c +++ b/src/mainboard/google/auron/acpi_tables.c @@ -41,20 +41,12 @@ extern const unsigned char AmlCode[]; static void acpi_update_thermal_table(global_nvs_t *gnvs) { - gnvs->tmps = CTL_TDP_SENSOR_ID; - - /* Normal TDP */ - gnvs->f1of = 0; - gnvs->f1on = 0; - - /* Limited TDP */ - gnvs->f0of = CTL_TDP_THRESHOLD_OFF; - gnvs->f0on = CTL_TDP_THRESHOLD_ON; - gnvs->f0pw = CTL_TDP_POWER_LIMIT; + gnvs->tmps = TEMPERATURE_SENSOR_ID; gnvs->tcrt = CRITICAL_TEMPERATURE; gnvs->tpsv = PASSIVE_TEMPERATURE; gnvs->tmax = MAX_TEMPERATURE; + gnvs->f0pw = EC_THROTTLE_POWER_LIMIT; gnvs->flvl = 1; } diff --git a/src/mainboard/google/auron/ec.h b/src/mainboard/google/auron/ec.h index 2283901ed5..fd0605d596 100644 --- a/src/mainboard/google/auron/ec.h +++ b/src/mainboard/google/auron/ec.h @@ -35,6 +35,8 @@ EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_THRESHOLD) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_THERMAL_OVERLOAD) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_START) |\ + EC_HOST_EVENT_MASK(EC_HOST_EVENT_THROTTLE_STOP) |\ EC_HOST_EVENT_MASK(EC_HOST_EVENT_USB_CHARGER)) #define MAINBOARD_EC_SMI_EVENTS \ diff --git a/src/mainboard/google/auron/thermal.h b/src/mainboard/google/auron/thermal.h index 69d9bb0042..ce03bdec92 100644 --- a/src/mainboard/google/auron/thermal.h +++ b/src/mainboard/google/auron/thermal.h @@ -20,11 +20,10 @@ #ifndef THERMAL_H #define THERMAL_H -/* Control TDP Settings */ -#define CTL_TDP_SENSOR_ID 0 /* PECI */ -#define CTL_TDP_POWER_LIMIT 12 /* 12W */ -#define CTL_TDP_THRESHOLD_OFF 80 /* Normal at 80C */ -#define CTL_TDP_THRESHOLD_ON 85 /* Limited at 85C */ +#define TEMPERATURE_SENSOR_ID 0 /* PECI */ + +/* Power level to set when EC requests throttle */ +#define EC_THROTTLE_POWER_LIMIT 12 /* 12W */ /* Temperature which OS will shutdown at */ #define CRITICAL_TEMPERATURE 99