From b376ea632f1498174d86fa8f8b78848607492055 Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Thu, 9 Jan 2014 10:10:15 -0800 Subject: baytrail: dptf: Add disable trip point methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a method in each temp sensor to disable the aux trip points and then a wrapper function to call this method for each enabled temperature sensor. The event handler function is changed to not use a switch statement so it does not need to be serialized. This was causing issues with nested locking between the global lock and the EC PATM mutex. Some unused code in temp sensors that was added earlier is removed and instead a critical threshold is specified in _CRT. The top level DPTF device _OSC method is expanded to check for the passive policy UUID and initialize thermal devices. This is done for both enable and disable steps to ensure that the EC thermal thresholds are reset in both cases. Additionally the priority based _TRT is specified with TRTR=1. BUG=chrome-os-partner:17279 BRANCH=rambi TEST=build and boot on rambi, load esif_lf kernel drivers and start esif_uf application. Observe that temperature thresholds are set properly when running 'appstart Dptf' and that they are disabled after running 'appstop Dptf' Change-Id: Ia15824ca42164dadae2011d4e364b70905e36f85 Signed-off-by: Duncan Laurie Reviewed-on: https://chromium-review.googlesource.com/182024 Reviewed-by: Aaron Durbin Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/5037 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki --- src/soc/intel/baytrail/acpi/dptf/dptf.asl | 22 +++- src/soc/intel/baytrail/acpi/dptf/thermal.asl | 147 +++++++++------------------ 2 files changed, 68 insertions(+), 101 deletions(-) diff --git a/src/soc/intel/baytrail/acpi/dptf/dptf.asl b/src/soc/intel/baytrail/acpi/dptf/dptf.asl index 6aebddc6a6..a54478cd05 100644 --- a/src/soc/intel/baytrail/acpi/dptf/dptf.asl +++ b/src/soc/intel/baytrail/acpi/dptf/dptf.asl @@ -6,13 +6,13 @@ Device (DPTF) Name (IDSP, Package() { /* DPPM Passive Policy 1.0 */ - ToUUID("42A441D6-AE6A-462B-A84B-4A8CE79027D3"), + ToUUID ("42A441D6-AE6A-462B-A84B-4A8CE79027D3"), /* DPPM Critical Policy */ - ToUUID("97C68AE7-15FA-499c-B8C9-5DA81D606E0A"), + ToUUID ("97C68AE7-15FA-499c-B8C9-5DA81D606E0A"), /* DPPM Cooling Policy */ - ToUUID("16CAF1B7-DD38-40ED-B1C1-1B8A1913D531"), + ToUUID ("16CAF1B7-DD38-40ED-B1C1-1B8A1913D531"), }) Method (_STA) @@ -24,12 +24,26 @@ Device (DPTF) } } + /* Arg0: Buffer containing UUID + * Arg1: Integer containing Revision ID of buffer format + * Arg2: Integer containing count of entries in Arg3 + * Arg3: Buffer containing list of DWORD capabilities + * Return: Buffer containing list of DWORD capabilities + */ Method (_OSC, 4, Serialized) { - /* TODO: Enable/Disable EC control of thermals/charging */ + /* Check for Passive Policy UUID */ + If (LEqual (DeRefOf (Index (IDSP, 0)), Arg0)) { + /* Initialize Thermal Devices */ + ^TINI () + } + Return (Arg3) } + /* Priority based _TRT */ + Name (TRTR, 1) + Method (_TRT) { Return (\_SB.DTRT) diff --git a/src/soc/intel/baytrail/acpi/dptf/thermal.asl b/src/soc/intel/baytrail/acpi/dptf/thermal.asl index 33ec207b70..7113215cd3 100644 --- a/src/soc/intel/baytrail/acpi/dptf/thermal.asl +++ b/src/soc/intel/baytrail/acpi/dptf/thermal.asl @@ -1,18 +1,37 @@ /* Thermal Threshold Event Handler */ -Method (TEVT, 1, Serialized) +Method (TEVT, 1, NotSerialized) { - Switch (ToInteger (Arg0)) - { + Store (ToInteger (Arg0), Local0) + #ifdef DPTF_TSR0_SENSOR_ID - Case (DPTF_TSR0_SENSOR_ID) { Notify (^TSR0, 0x90) } + If (LEqual (Local0, DPTF_TSR0_SENSOR_ID)) { + Notify (^TSR0, 0x90) + } #endif #ifdef DPTF_TSR1_SENSOR_ID - Case (DPTF_TSR1_SENSOR_ID) { Notify (^TSR1, 0x90) } + If (LEqual (Local0, DPTF_TSR1_SENSOR_ID)) { + Notify (^TSR1, 0x90) + } #endif #ifdef DPTF_TSR2_SENSOR_ID - Case (DPTF_TSR2_SENSOR_ID) { Notify (^TSR2, 0x90) } -#endif + If (LEqual (Local0, DPTF_TSR2_SENSOR_ID)) { + Notify (^TSR2, 0x90) } +#endif +} + +/* Thermal device initialization - Disable Aux Trip Points */ +Method (TINI) +{ +#ifdef DPTF_TSR0_SENSOR_ID + ^TSR0.PATD () +#endif +#ifdef DPTF_TSR1_SENSOR_ID + ^TSR1.PATD () +#endif +#ifdef DPTF_TSR2_SENSOR_ID + ^TSR2.PATD () +#endif } #ifdef DPTF_TSR0_SENSOR_ID @@ -24,9 +43,6 @@ Device (TSR0) Name (TMPI, DPTF_TSR0_SENSOR_ID) Name (_STR, Unicode (DPTF_TSR0_SENSOR_NAME)) Name (GTSH, 20) /* 2 degree hysteresis */ - Name (NTTH, 5) /* 5 degree notification threshold */ - Name (LTM0, 0) /* Last recorded temperature */ - Name (CTYP, 0) /* Cooling policy */ Method (_STA) { @@ -47,34 +63,9 @@ Device (TSR0) Return (^^CTOK (DPTF_TSR0_PASSIVE)) } - /* Set Cooling Policy - * Arg0 - Cooling policy mode, 1=active, 0=passive - * Arg1 - Acoustic Limit - * Arg2 - Power Limit - */ - Method (_SCP, 3, Serialized) + Method (_CRT) { - If (LEqual (Arg0, 0)) { - Store (0, CTYP) - } Else { - Store (1, CTYP) - } - - /* DPTF Thermal Trip Points Changed Event */ - Notify (TSR0, 0x91) - } - - /* Device Temperature Indication */ - Method (_DTI, 1) - { - Store (Arg0, LTM0) - Notify (TSR0, 0x91) - } - - /* Notification Temperature Threshold */ - Method (_NTT) - { - Return (^^CTOK (NTTH)) + Return (^^CTOK (DPTF_TSR0_CRITICAL)) } Name (PATC, 2) @@ -90,6 +81,12 @@ Device (TSR0) { \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) } + + /* Disable Aux Trip Point */ + Method (PATD, 0, Serialized) + { + \_SB.PCI0.LPCB.EC0.PATD (TMPI) + } } #endif @@ -102,9 +99,6 @@ Device (TSR1) Name (TMPI, DPTF_TSR1_SENSOR_ID) Name (_STR, Unicode (DPTF_TSR1_SENSOR_NAME)) Name (GTSH, 20) /* 2 degree hysteresis */ - Name (NTTH, 5) /* 5 degree notification threshold */ - Name (LTM1, 0) - Name (CTYP, 0) /* Cooling policy */ Method (_STA) { @@ -125,34 +119,9 @@ Device (TSR1) Return (^^CTOK (DPTF_TSR1_PASSIVE)) } - /* Set Cooling Policy - * Arg0 - Cooling policy mode, 1=active, 0=passive - * Arg1 - Acoustic Limit - * Arg2 - Power Limit - */ - Method (_SCP, 3, Serialized) - { - If (LEqual (Arg0, 0)) { - Store (0, CTYP) - } Else { - Store (1, CTYP) - } - - /* DPTF Thermal Trip Points Changed Event */ - Notify (TSR1, 0x91) - } - - /* Device Temperature Indication */ - Method (_DTI, 1) + Method (_CRT) { - Store (Arg0, LTM1) - Notify (TSR1, 0x91) - } - - /* Notification Temperature Threshold */ - Method (_NTT) - { - Return (^^CTOK (NTTH)) + Return (^^CTOK (DPTF_TSR1_CRITICAL)) } Name (PATC, 2) @@ -168,6 +137,12 @@ Device (TSR1) { \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) } + + /* Disable Aux Trip Point */ + Method (PATD, 0, Serialized) + { + \_SB.PCI0.LPCB.EC0.PATD (TMPI) + } } #endif @@ -180,9 +155,6 @@ Device (TSR2) Name (TMPI, DPTF_TSR2_SENSOR_ID) Name (_STR, Unicode (DPTF_TSR2_SENSOR_NAME)) Name (GTSH, 20) /* 2 degree hysteresis */ - Name (NTTH, 5) /* 5 degree notification threshold */ - Name (LTM2, 0) - Name (CTYP, 0) /* Cooling policy */ Method (_STA) { @@ -203,34 +175,9 @@ Device (TSR2) Return (^^CTOK (DPTF_TSR2_PASSIVE)) } - /* Set Cooling Policy - * Arg0 - Cooling policy mode, 1=active, 0=passive - * Arg1 - Acoustic Limit - * Arg2 - Power Limit - */ - Method (_SCP, 3, Serialized) + Method (_CRT) { - If (LEqual (Arg0, 0)) { - Store (0, CTYP) - } Else { - Store (1, CTYP) - } - - /* DPTF Thermal Trip Points Changed Event */ - Notify (TSR2, 0x91) - } - - /* Device Temperature Indication */ - Method (_DTI, 1) - { - Store (Arg0, LTM2) - Notify (TSR2, 0x91) - } - - /* Notification Temperature Threshold */ - Method (_NTT) - { - Return (^^CTOK (NTTH)) + Return (^^CTOK (DPTF_TSR2_CRITICAL)) } Name (PATC, 2) @@ -246,5 +193,11 @@ Device (TSR2) { \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) } + + /* Disable Aux Trip Point */ + Method (PATD, 0, Serialized) + { + \_SB.PCI0.LPCB.EC0.PATD (TMPI) + } } #endif -- cgit v1.2.3