Angel Pons | 2de6bdf | 2020-04-05 13:21:00 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 2 | |
| 3 | /* Thermal Threshold Event Handler */ |
Martin Roth | 15f232d | 2018-04-29 22:41:58 -0500 | [diff] [blame] | 4 | #define HAVE_THERM_EVENT_HANDLER |
Frans Hendriks | 9cb88a7 | 2019-12-06 11:54:01 +0100 | [diff] [blame] | 5 | |
| 6 | #if CONFIG(EC_SUPPORTS_DPTF_TEVT) |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 7 | Method (TEVT, 1, NotSerialized) |
| 8 | { |
Felix Singer | 3e90ce5 | 2022-12-12 07:26:08 +0100 | [diff] [blame] | 9 | Local0 = ToInteger (Arg0) |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 10 | |
| 11 | #ifdef DPTF_TSR0_SENSOR_ID |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 12 | If (Local0 == DPTF_TSR0_SENSOR_ID) { |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 13 | Notify (^TSR0, 0x90) |
| 14 | } |
| 15 | #endif |
| 16 | #ifdef DPTF_TSR1_SENSOR_ID |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 17 | If (Local0 == DPTF_TSR1_SENSOR_ID) { |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 18 | Notify (^TSR1, 0x90) |
| 19 | } |
| 20 | #endif |
| 21 | #ifdef DPTF_TSR2_SENSOR_ID |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 22 | If (Local0 == DPTF_TSR2_SENSOR_ID) { |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 23 | Notify (^TSR2, 0x90) |
| 24 | } |
| 25 | #endif |
| 26 | } |
Frans Hendriks | 9cb88a7 | 2019-12-06 11:54:01 +0100 | [diff] [blame] | 27 | #endif |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [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 | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 55 | If (\DPTE == 1) { |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [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 | /* Return passive thermal point defined by Terra2 or Terra3 mainboard */ |
| 68 | Method (_PSV) |
| 69 | { |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 70 | If (\_SB.GPID == TERRA2_PROJECT_ID) |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 71 | { |
| 72 | Return (CTOK (DPTF_TERRA2_TSR0_PASSIVE)) |
| 73 | } Else { |
| 74 | Return (CTOK (DPTF_TERRA3_TSR0_PASSIVE)) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | /* Return critical thermal point defined by Terra2 or Terra3 mainboard */ |
| 79 | Method (_CRT) |
| 80 | { |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 81 | If (\_SB.GPID == TERRA2_PROJECT_ID) |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 82 | { |
| 83 | Return (CTOK (DPTF_TERRA2_TSR0_CRITICAL)) |
| 84 | } Else { |
| 85 | Return (CTOK (DPTF_TERRA3_TSR0_CRITICAL)) |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | Name (PATC, 2) |
| 90 | |
| 91 | /* Set Aux Trip Point */ |
| 92 | Method (PAT0, 1, Serialized) |
| 93 | { |
| 94 | \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0) |
| 95 | } |
| 96 | |
| 97 | /* Set Aux Trip Point */ |
| 98 | Method (PAT1, 1, Serialized) |
| 99 | { |
| 100 | \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) |
| 101 | } |
| 102 | |
| 103 | /* Disable Aux Trip Point */ |
| 104 | Method (PATD, 0, Serialized) |
| 105 | { |
| 106 | \_SB.PCI0.LPCB.EC0.PATD (TMPI) |
| 107 | } |
| 108 | } |
| 109 | #endif |
| 110 | |
| 111 | #ifdef DPTF_TSR1_SENSOR_ID |
| 112 | Device (TSR1) |
| 113 | { |
| 114 | Name (_HID, EISAID ("INT3403")) |
| 115 | Name (_UID, 2) |
| 116 | Name (PTYP, 0x03) |
| 117 | Name (TMPI, DPTF_TSR1_SENSOR_ID) |
| 118 | Name (_STR, Unicode (DPTF_TSR1_SENSOR_NAME)) |
| 119 | Name (GTSH, 20) /* 2 degree hysteresis */ |
| 120 | |
| 121 | Method (_STA) |
| 122 | { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 123 | If (\DPTE == 1) { |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 124 | Return (0xF) |
| 125 | } Else { |
| 126 | Return (0x0) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | Method (_TMP, 0, Serialized) |
| 131 | { |
| 132 | Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI)) |
| 133 | } |
| 134 | |
| 135 | /* Return passive thermal point defined by Terra2 or Terra3 mainboard */ |
| 136 | Method (_PSV) |
| 137 | { |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 138 | If (\_SB.GPID == TERRA2_PROJECT_ID) |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 139 | { |
| 140 | Return (CTOK (DPTF_TERRA2_TSR1_PASSIVE)) |
| 141 | } Else { |
| 142 | Return (CTOK (DPTF_TERRA3_TSR1_PASSIVE)) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | /* Return critical thermal point defined by Terra2 or Terra3 mainboard */ |
| 147 | Method (_CRT) |
| 148 | { |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 149 | If (\_SB.GPID == TERRA2_PROJECT_ID) |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 150 | { |
| 151 | Return (CTOK (DPTF_TERRA2_TSR1_CRITICAL)) |
| 152 | } Else { |
| 153 | Return (CTOK (DPTF_TERRA3_TSR1_CRITICAL)) |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | Name (PATC, 2) |
| 158 | |
| 159 | /* Set Aux Trip Point */ |
| 160 | Method (PAT0, 1, Serialized) |
| 161 | { |
| 162 | \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0) |
| 163 | } |
| 164 | |
| 165 | /* Set Aux Trip Point */ |
| 166 | Method (PAT1, 1, Serialized) |
| 167 | { |
| 168 | \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) |
| 169 | } |
| 170 | |
| 171 | /* Disable Aux Trip Point */ |
| 172 | Method (PATD, 0, Serialized) |
| 173 | { |
| 174 | \_SB.PCI0.LPCB.EC0.PATD (TMPI) |
| 175 | } |
| 176 | } |
| 177 | #endif |
| 178 | |
| 179 | #ifdef DPTF_TSR2_SENSOR_ID |
| 180 | Device (TSR2) |
| 181 | { |
| 182 | Name (_HID, EISAID ("INT3403")) |
| 183 | Name (_UID, 3) |
| 184 | Name (PTYP, 0x03) |
| 185 | Name (TMPI, DPTF_TSR2_SENSOR_ID) |
| 186 | Name (_STR, Unicode (DPTF_TSR2_SENSOR_NAME)) |
| 187 | Name (GTSH, 20) /* 2 degree hysteresis */ |
| 188 | |
| 189 | Method (_STA) |
| 190 | { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 191 | If (\DPTE == 1) { |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 192 | Return (0xF) |
| 193 | } Else { |
| 194 | Return (0x0) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | Method (_TMP, 0, Serialized) |
| 199 | { |
| 200 | Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI)) |
| 201 | } |
| 202 | |
| 203 | /* Return passive thermal point defined by Terra2 or Terra3 mainboard */ |
| 204 | Method (_PSV) |
| 205 | { |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 206 | If (\_SB.GPID == TERRA2_PROJECT_ID) |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 207 | { |
| 208 | Return (CTOK (DPTF_TERRA2_TSR2_PASSIVE)) |
| 209 | } Else { |
| 210 | Return (CTOK (DPTF_TERRA3_TSR2_PASSIVE)) |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | /* Return critical thermal point defined by Terra2 or Terra3 mainboard */ |
| 215 | Method (_CRT) |
| 216 | { |
Felix Singer | 096158d | 2022-12-11 23:02:09 +0100 | [diff] [blame] | 217 | If (\_SB.GPID == TERRA2_PROJECT_ID) |
Matt DeVillier | 2f7813f | 2017-08-24 16:31:41 -0500 | [diff] [blame] | 218 | { |
| 219 | Return (CTOK (DPTF_TERRA2_TSR2_CRITICAL)) |
| 220 | } Else { |
| 221 | Return (CTOK (DPTF_TERRA3_TSR2_CRITICAL)) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | Name (PATC, 2) |
| 226 | |
| 227 | /* Set Aux Trip Point */ |
| 228 | Method (PAT0, 1, Serialized) |
| 229 | { |
| 230 | \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0) |
| 231 | } |
| 232 | |
| 233 | /* Set Aux Trip Point */ |
| 234 | Method (PAT1, 1, Serialized) |
| 235 | { |
| 236 | \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0) |
| 237 | } |
| 238 | |
| 239 | /* Disable Aux Trip Point */ |
| 240 | Method (PATD, 0, Serialized) |
| 241 | { |
| 242 | \_SB.PCI0.LPCB.EC0.PATD (TMPI) |
| 243 | } |
| 244 | } |
| 245 | #endif |