chrome ec: Fix temperature calcualtion in PATx methods

The PATx methods will be passed a temperature in deci-kelvin,
so it needs to be converted back to kelvin before being sent
to the EC.

The PAT disable method is changed to take the temperature ID
as an argument so individual sensors can be disabled.

BUG=chrome-os-partner:17279
BRANCH=rambi
TEST=build and boot on rambi, load esif_lf kernel drivers and
esif_uf userspace application.  Start and stop DPTF and see
that temperature thresholds are set to sane values.

Change-Id: Ieeff5a5d2d833042923c059caf3e5abaf392da95
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182023
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/5036
Tested-by: build bot (Jenkins)
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
This commit is contained in:
Duncan Laurie 2014-01-09 10:01:05 -08:00 committed by Kyösti Mälkki
parent b3ce658608
commit 8be6759f79
1 changed files with 16 additions and 16 deletions

View File

@ -299,13 +299,14 @@ Device (EC0)
Return (0) Return (0)
} }
Store ("EC: PAT0", Debug)
/* Set sensor ID */ /* Set sensor ID */
Store (ToInteger (Arg0), ^PATI) Store (ToInteger (Arg0), ^PATI)
/* Adjust by offset to get Kelvin and set Threshold */ /* Temperature is passed in 1/10 Kelvin */
Add (ToInteger (Arg1), ^TOFS, ^PATT) Divide (ToInteger (Arg1), 10, Local0, Local1)
/* Adjust by EC temperature offset */
Subtract (Local1, ^TOFS, ^PATT)
/* Set commit value with SELECT=0 and ENABLE=1 */ /* Set commit value with SELECT=0 and ENABLE=1 */
Store (0x02, ^PATC) Store (0x02, ^PATC)
@ -325,13 +326,14 @@ Device (EC0)
Return (0) Return (0)
} }
Store ("EC: PAT1", Debug)
/* Set sensor ID */ /* Set sensor ID */
Store (ToInteger (Arg0), ^PATI) Store (ToInteger (Arg0), ^PATI)
/* Adjust by offset to get Kelvin and set Threshold */ /* Temperature is passed in 1/10 Kelvin */
Add (ToInteger (Arg1), ^TOFS, ^PATT) Divide (ToInteger (Arg1), 10, Local0, Local1)
/* Adjust by EC temperature offset */
Subtract (Local1, ^TOFS, ^PATT)
/* Set commit value with SELECT=1 and ENABLE=1 */ /* Set commit value with SELECT=1 and ENABLE=1 */
Store (0x03, ^PATC) Store (0x03, ^PATC)
@ -340,16 +342,16 @@ Device (EC0)
Return (1) Return (1)
} }
/* Disable Aux Trip Points */ /* Disable Aux Trip Points
Method (PATD) * Arg0 = Temp Sensor ID
*/
Method (PATD, 1, Serialized)
{ {
If (Acquire (^PATM, 1000)) { If (Acquire (^PATM, 1000)) {
Return (0) Return (0)
} }
Store ("EC: PAT Disable", Debug) Store (ToInteger (Arg0), ^PATI)
Store (0x00, ^PATI)
Store (0x00, ^PATT) Store (0x00, ^PATT)
/* Disable PAT0 */ /* Disable PAT0 */
@ -365,14 +367,12 @@ Device (EC0)
/* /*
* Thermal Threshold Event * Thermal Threshold Event
*/ */
Method (_Q09, 0, Serialized) Method (_Q09, 0, NotSerialized)
{ {
If (Acquire (^PATM, 1000)) { If (Acquire (^PATM, 1000)) {
Return () Return ()
} }
Store ("EC: THERMAL THRESHOLD", Debug)
/* Read sensor ID for event */ /* Read sensor ID for event */
Store (^PATI, Local0) Store (^PATI, Local0)