Angel Pons | ba38f37 | 2020-04-05 15:46:45 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Martin Roth | ebabfad | 2016-04-10 11:09:16 -0600 | [diff] [blame] | 2 | |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 3 | /* Thermal Threshold Event Handler */ |
Frans Hendriks | 9cb88a7 | 2019-12-06 11:54:01 +0100 | [diff] [blame] | 4 | #define HAVE_THERM_EVENT_HANDLER |
| 5 | |
| 6 | #if CONFIG(EC_SUPPORTS_DPTF_TEVT) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 7 | Method (TEVT, 1, NotSerialized) |
| 8 | { |
Felix Singer | 84e6123 | 2022-12-12 07:39:15 +0100 | [diff] [blame] | 9 | Local0 = ToInteger (Arg0) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 10 | |
| 11 | #ifdef DPTF_TSR0_SENSOR_ID |
Felix Singer | edec4d9 | 2022-12-11 21:25:32 +0100 | [diff] [blame] | 12 | If (Local0 == DPTF_TSR0_SENSOR_ID) { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 13 | Notify (^TSR0, 0x90) |
| 14 | } |
| 15 | #endif |
| 16 | #ifdef DPTF_TSR1_SENSOR_ID |
Felix Singer | edec4d9 | 2022-12-11 21:25:32 +0100 | [diff] [blame] | 17 | If (Local0 == DPTF_TSR1_SENSOR_ID) { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 18 | Notify (^TSR1, 0x90) |
| 19 | } |
| 20 | #endif |
| 21 | #ifdef DPTF_TSR2_SENSOR_ID |
Felix Singer | edec4d9 | 2022-12-11 21:25:32 +0100 | [diff] [blame] | 22 | If (Local0 == DPTF_TSR2_SENSOR_ID) { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 23 | Notify (^TSR2, 0x90) |
| 24 | } |
| 25 | #endif |
| 26 | } |
Frans Hendriks | 34510c3 | 2018-07-09 12:29:47 +0200 | [diff] [blame] | 27 | #endif |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 28 | |
| 29 | /* Thermal device initialization - Disable Aux Trip Points */ |
| 30 | Method (TINI) |
| 31 | { |
| 32 | #ifdef DPTF_TSR0_SENSOR_ID |
| 33 | ^TSR0.PATD () |
| 34 | #endif |
| 35 | #ifdef DPTF_TSR1_SENSOR_ID |
| 36 | ^TSR1.PATD () |
| 37 | #endif |
| 38 | #ifdef DPTF_TSR2_SENSOR_ID |
| 39 | ^TSR2.PATD () |
| 40 | #endif |
| 41 | } |
| 42 | |
| 43 | #ifdef DPTF_TSR0_SENSOR_ID |
| 44 | Device (TSR0) |
| 45 | { |
| 46 | Name (_HID, EISAID ("INT3403")) |
| 47 | Name (_UID, 1) |
| 48 | Name (PTYP, 0x03) |
| 49 | Name (TMPI, DPTF_TSR0_SENSOR_ID) |
| 50 | Name (_STR, Unicode (DPTF_TSR0_SENSOR_NAME)) |
| 51 | Name (GTSH, 20) /* 2 degree hysteresis */ |
| 52 | |
| 53 | Method (_STA) |
| 54 | { |
Felix Singer | 7b8ac00 | 2022-12-26 08:45:56 +0100 | [diff] [blame^] | 55 | If (\DPTE == 1) { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 56 | Return (0xF) |
| 57 | } Else { |
| 58 | Return (0x0) |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | Method (_TMP, 0, Serialized) |
| 63 | { |
| 64 | Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI)) |
| 65 | } |
| 66 | |
| 67 | Method (_PSV) |
| 68 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 69 | Return (CTOK (DPTF_TSR0_PASSIVE)) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | Method (_CRT) |
| 73 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 74 | Return (CTOK (DPTF_TSR0_CRITICAL)) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | Name (PATC, 2) |
| 78 | |
| 79 | /* Set Aux Trip Point */ |
| 80 | Method (PAT0, 1, Serialized) |
| 81 | { |
| 82 | \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0) |
| 83 | } |
| 84 | |
| 85 | /* Set Aux Trip Point */ |
| 86 | Method (PAT1, 1, Serialized) |
| 87 | { |
| 88 | \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) |
| 89 | } |
| 90 | |
| 91 | /* Disable Aux Trip Point */ |
| 92 | Method (PATD, 0, Serialized) |
| 93 | { |
| 94 | \_SB.PCI0.LPCB.EC0.PATD (TMPI) |
| 95 | } |
| 96 | } |
| 97 | #endif |
| 98 | |
| 99 | #ifdef DPTF_TSR1_SENSOR_ID |
| 100 | Device (TSR1) |
| 101 | { |
| 102 | Name (_HID, EISAID ("INT3403")) |
| 103 | Name (_UID, 2) |
| 104 | Name (PTYP, 0x03) |
| 105 | Name (TMPI, DPTF_TSR1_SENSOR_ID) |
| 106 | Name (_STR, Unicode (DPTF_TSR1_SENSOR_NAME)) |
| 107 | Name (GTSH, 20) /* 2 degree hysteresis */ |
| 108 | |
| 109 | Method (_STA) |
| 110 | { |
Felix Singer | 7b8ac00 | 2022-12-26 08:45:56 +0100 | [diff] [blame^] | 111 | If (\DPTE == 1) { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 112 | Return (0xF) |
| 113 | } Else { |
| 114 | Return (0x0) |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | Method (_TMP, 0, Serialized) |
| 119 | { |
| 120 | Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI)) |
| 121 | } |
| 122 | |
| 123 | Method (_PSV) |
| 124 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 125 | Return (CTOK (DPTF_TSR1_PASSIVE)) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | Method (_CRT) |
| 129 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 130 | Return (CTOK (DPTF_TSR1_CRITICAL)) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | Name (PATC, 2) |
| 134 | |
| 135 | /* Set Aux Trip Point */ |
| 136 | Method (PAT0, 1, Serialized) |
| 137 | { |
| 138 | \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0) |
| 139 | } |
| 140 | |
| 141 | /* Set Aux Trip Point */ |
| 142 | Method (PAT1, 1, Serialized) |
| 143 | { |
| 144 | \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) |
| 145 | } |
| 146 | |
| 147 | /* Disable Aux Trip Point */ |
| 148 | Method (PATD, 0, Serialized) |
| 149 | { |
| 150 | \_SB.PCI0.LPCB.EC0.PATD (TMPI) |
| 151 | } |
| 152 | } |
| 153 | #endif |
| 154 | |
| 155 | #ifdef DPTF_TSR2_SENSOR_ID |
| 156 | Device (TSR2) |
| 157 | { |
| 158 | Name (_HID, EISAID ("INT3403")) |
| 159 | Name (_UID, 3) |
| 160 | Name (PTYP, 0x03) |
| 161 | Name (TMPI, DPTF_TSR2_SENSOR_ID) |
| 162 | Name (_STR, Unicode (DPTF_TSR2_SENSOR_NAME)) |
| 163 | Name (GTSH, 20) /* 2 degree hysteresis */ |
| 164 | |
| 165 | Method (_STA) |
| 166 | { |
Felix Singer | 7b8ac00 | 2022-12-26 08:45:56 +0100 | [diff] [blame^] | 167 | If (\DPTE == 1) { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 168 | Return (0xF) |
| 169 | } Else { |
| 170 | Return (0x0) |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | Method (_TMP, 0, Serialized) |
| 175 | { |
| 176 | Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI)) |
| 177 | } |
| 178 | |
| 179 | Method (_PSV) |
| 180 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 181 | Return (CTOK (DPTF_TSR2_PASSIVE)) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | Method (_CRT) |
| 185 | { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 186 | Return (CTOK (DPTF_TSR2_CRITICAL)) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 187 | } |
| 188 | |
| 189 | Name (PATC, 2) |
| 190 | |
| 191 | /* Set Aux Trip Point */ |
| 192 | Method (PAT0, 1, Serialized) |
| 193 | { |
| 194 | \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0) |
| 195 | } |
| 196 | |
| 197 | /* Set Aux Trip Point */ |
| 198 | Method (PAT1, 1, Serialized) |
| 199 | { |
| 200 | \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) |
| 201 | } |
| 202 | |
| 203 | /* Disable Aux Trip Point */ |
| 204 | Method (PATD, 0, Serialized) |
| 205 | { |
| 206 | \_SB.PCI0.LPCB.EC0.PATD (TMPI) |
| 207 | } |
| 208 | } |
| 209 | #endif |