Debian Codegraph @

src/ec/lenovo/h8/acpi/thermal.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <arch/x86/acpi/statdef.asl>
4
5 Scope(\_TZ)
6 {
7 Method(C2K, 1, NotSerialized)
8 {
9 Local0 = Arg0 * 10
10 Local0 += 2732
11 if (Local0 <= 2732) {
12 Return (3000)
13 }
14
15 if (Local0 > 4012) {
16 Return (3000)
17 }
18 Return (Local0)
19 }
20
21 ThermalZone(THM0)
22 {
23 /* Thermal zone polling frequency: 10 seconds */
24 Name (_TZP, 100)
25
26 /* Thermal sampling period for passive cooling: 10 seconds */
27 Name (_TSP, 100)
28
29 /* Coefficients for passive cooling */
30 Name (_TC1, 0x02)
31 Name (_TC2, 0x05)
32
33 /* Generated by acpigen */
34 External (\PPKG, MethodObj)
35
36 /* Processors used for passive cooling */
37 Method (_PSL, 0, Serialized)
38 {
39 Return (\PPKG ())
40 }
41
42 /* Get critical temperature in degree celsius */
43 Method (GCRT, 0, NotSerialized) {
44 Local0 = \TCRT
45 if (Local0 > 0) {
46 Return (Local0)
47 }
48 Return (127)
49 }
50
51 /* Get passive temperature in degree celsius */
52 Method (GPSV, 0, NotSerialized) {
53 Local0 = \TPSV
54 if (Local0 > 0) {
55 Return (Local0)
56 }
57 Return (95)
58 }
59
60 Method (_CRT, 0, NotSerialized) {
61 Return (C2K (GCRT ()))
62 }
63
64 Method (_PSV, 0, NotSerialized) {
65 Return (C2K (GPSV ()))
66 }
67
68 Method(_TMP) {
69 Local0 = \_SB.PCI0.LPCB.EC.TMP0
70 /* Avoid tripping alarm if invalid value reported */
71 If (Local0 == 128) {
72 Return (C2K(40))
73 }
74 Return (C2K(Local0))
75 }
76
77 Method (_AC0) {
78 Local0 = GPSV ()
79
80 /* Active fan 10 degree below passive threshold */
81 Local0 -= 10
82
83 If (\FLVL) {
84 /* Turn of 5 degree below trip point */
85 Local0 -= 5
86 }
87
88 Return (C2K (Local0))
89 }
90
91 Name (_AL0, Package () { FAN })
92
93 PowerResource (FPWR, 0, 0)
94 {
95 /*
96 * WINDOWS BUG: Don't read from EmbeddedControl
97 * in PowerResources. Use system-memory instead!
98 */
99 Method (_STA) {
100 Return (\FLVL)
101 }
102
103 /*
104 * WINDOWS BUG: Don't write to FIELD elements located
105 * in another ACPI scope. Call a method that does it!
106 */
107 Method (_ON) {
108 \_SB.PCI0.LPCB.EC.FANE(1)
109 \FLVL = 1
110 Notify (\_TZ.THM0, NOTIFY_TZ_TRIPPTCHG)
111 }
112
113 Method (_OFF) {
114 \_SB.PCI0.LPCB.EC.FANE(0)
115 \FLVL = 0
116 Notify (\_TZ.THM0, NOTIFY_TZ_TRIPPTCHG)
117 }
118 }
119
120 Device (FAN)
121 {
122 Name (_HID, EISAID ("PNP0C0B"))
123 Name (_PR0, Package () { FPWR })
124 }
125 }
126 #if CONFIG(H8_HAS_2ND_THERMAL_ZONE)
127 ThermalZone(THM1)
128 {
129 /* Thermal zone polling frequency: 10 seconds */
130 Name (_TZP, 100)
131
132 /* Thermal sampling period for passive cooling: 10 seconds */
133 Name (_TSP, 100)
134
135 /* Coefficients for passive cooling */
136 Name (_TC1, 0x02)
137 Name (_TC2, 0x05)
138
139 /* Processors used for passive cooling */
140 Method (_PSL, 0, Serialized)
141 {
142 Return (\PPKG ())
143 }
144
145 Method (_CRT, 0, NotSerialized) {
146 Return (C2K (99))
147 }
148
149 Method (_PSV, 0, NotSerialized) {
150 Return (C2K (94))
151 }
152
153 Method(_TMP) {
154 Local0 = \_SB.PCI0.LPCB.EC.TMP1
155 /* Avoid tripping alarm if invalid value reported */
156 If (Local0 == 128) {
157 Return (C2K(40))
158 }
159 Return (C2K(Local0))
160 }
161 }
162 #endif
163 }