-
Notifications
You must be signed in to change notification settings - Fork 4
/
SSDT-ClevoService.dsl
217 lines (190 loc) · 6.64 KB
/
SSDT-ClevoService.dsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20180427 (64-bit version)
* Copyright (c) 2000 - 2018 Intel Corporation
*/
DefinitionBlock ("", "SSDT", 1, "hack ", "CLEVO", 0x00000000)
{
External (_SB_.AC__, DeviceObj) // (from opcode)
External (_SB_.AC__.ACFG, IntObj) // (from opcode)
External (_SB_.DCHU.ZEVT, MethodObj) // 3 Arguments (from opcode)
External (_SB_.PCI0, DeviceObj) // (from opcode)
External (_SB_.PCI0.LPCB, DeviceObj) // (from opcode)
External (_SB_.PCI0.LPCB.EC__, DeviceObj) // (from opcode)
External (_SB_.PCI0.LPCB.EC__.AFLT, FieldUnitObj) // (from opcode)
External (_SB_.PCI0.LPCB.EC__.AIRP, FieldUnitObj) // (from opcode)
External (_SB_.PCI0.LPCB.EC__.BAT0, FieldUnitObj) // (from opcode)
External (_SB_.PCI0.LPCB.EC__.ECOK, IntObj) // (from opcode)
External (_SB_.PCI0.LPCB.EC__.OEM4, FieldUnitObj) // (from opcode)
External (_SB_.PCI0.LPCB.EC__.XQ50, MethodObj) // 0 Arguments (from opcode)
External (_SB_.PCI0.PEG0.PEGP._OFF, MethodObj) // 0 Arguments (from opcode)
External (_SB_.PCI0.LPCB.PS2K, DeviceObj) // (from opcode)
External (_SB_.WMI.WMBB, MethodObj) // (from opcode)
External (XWAK, MethodObj) // 1 Arguments (from opcode)
Scope (_SB.PCI0.LPCB.EC)
{
OperationRegion (EC82, EmbeddedControl, Zero, 0xFF)
Field (EC82, ByteAcc, Lock, Preserve)
{
Offset (0xD0),
FCP0, 8,
FCP1, 8,
FGP0, 8,
FGP1, 8,
Offset (0xE0),
FGP2, 8,
FGP3, 8,
}
}
Method (_WAK, 1, Serialized)
{
If ((Arg0 == 0) || (Arg0 > 4)) {Arg0 = 3} //OSX also uses Arg0=3. Force 3 for _WAK compatibility...
// Dual GPU OFF, remove it if not necessary
\_SB.PCI0.PEG0.PEGP._OFF ()
// After a sleep AFLT=1 means battery fail, we need to reset...
// Remove it if not necessary
Store (Zero, \_SB.PCI0.LPCB.EC.AFLT)
//After a sleep sleep the battery is not present, we need to set...
// Remove it if not necessary
Store (One, \_SB.PCI0.LPCB.EC.BAT0)
Notify (\_SB.CLV0, 0x83) //Set backlight according to settings
Return (XWAK (Arg0)) //We're going to call original _WAK method...
}
Scope (_SB.PCI0.LPCB.EC)
{
Method (_Q14, 0, NotSerialized) // _Qxx: EC Query
{
Notify (CLV0, 0x84) //Airplane key: switch-off Wifi & Bluetooth
Return (Zero)
}
Method (_Q50, 0, NotSerialized) // _Qxx: EC Query
{
Store (OEM4, Local0)
If (LEqual (Local0, 0x80))
{
Notify (CLV0, 0x80)
Return (Zero)
}
If (LEqual (Local0, 0x81))
{
Notify (CLV0, 0x81)
Return (Zero)
}
If (LEqual (Local0, 0x82))
{
Notify (CLV0, 0x82)
Return (Zero)
}
If (LEqual (Local0, 0x9F))
{
Notify (CLV0, 0x9F)
Return (Zero)
}
If (LEqual (Local0, 0xC9))
{
And (AIRP, 0xBF, AIRP) //Set Airplane led for Shift-Lock
Return (Zero)
}
If (LEqual (Local0, 0xCA))
{
Or (AIRP, 0x40, AIRP) //Reset Airplane led for Shift-Lock
Return (Zero)
}
XQ50 ()
Return (Zero)
}
}
Device (_SB.CLV0)
{
Name (_HID, EisaId ("PNP0C02")) // _HID: Hardware ID
Name (_CID, "MON0000") // _CID: Compatible ID
Name (KLVN, Zero)
//If you already have your own .dsl or .aml file,
//you can just copy the below CONF package to
Name (CONF, Package () //AutoDim configuration package
{
"KbdAutoDimTimerActive", ">y", //AutoDim Active...
"KbdAutoDimActive", ">y", //Dim activated... set ">n" for OFF
"KbdAutoDimTime", 180 //Two minutes, change it as you wish...
//"KbdDimmingLevel", 0x5,
//"KbdLevels", Package() {0x8, 0x20, 0x60, 0xFF},
})
Name (TACH, Package (0x06) //Add method for the 3 fans...
{
"CPU Fan",
"VEN1",
"GPU Fan #1",
"VEN2",
"GPU Fan #2",
"VEN3"
})
Method (VEN1, 0, Serialized)
{
If (\_SB.PCI0.LPCB.EC.ECOK)
{
Store (B1B2 (\_SB.PCI0.LPCB.EC.FCP1, \_SB.PCI0.LPCB.EC.FCP0), Local0)
If (LLessEqual (Local0, Zero))
{
Return (Zero)
}
Divide (0x0020E6BC, Local0, , Local0)
Return (Local0)
}
Return (Zero)
}
Method (VEN2, 0, Serialized)
{
If (\_SB.PCI0.LPCB.EC.ECOK)
{
Store (B1B2 (\_SB.PCI0.LPCB.EC.FGP1, \_SB.PCI0.LPCB.EC.FGP0), Local0)
If (LLessEqual (Local0, Zero))
{
Return (Zero)
}
Divide (0x0020E6BC, Local0, , Local0)
Return (Local0)
}
Return (Zero)
}
Method (VEN3, 0, Serialized)
{
If (\_SB.PCI0.LPCB.EC.ECOK)
{
Store (B1B2 (\_SB.PCI0.LPCB.EC.FGP3, \_SB.PCI0.LPCB.EC.FGP2), Local0)
If (LLessEqual (Local0, Zero))
{
Return (Zero)
}
Divide (0x0020E6BC, Local0, , Local0)
Return (Local0)
}
Return (Zero)
}
Method (CLVE, 3, Serialized)
{
If (CondRefOf( \_SB.DCHU.ZEVT )) //Vers 1.0.1 17/02/2020
{
\_SB.DCHU.ZEVT (Arg0, Arg1, Arg2)
} elseIf (CondRefOf( \_SB.WMI.WMBB )) //Added support for WMBB method
{
\_SB.WMI.WMBB (Arg0, Arg1, Arg2)
}
}
Method (_INI, 0, NotSerialized) // _INI: Initialize
{
// DGPU OFF, Remove it or update path as necessary...
If (CondRefOf (\_SB.PCI0.PEG0.PG00._OFF))
{
\_SB.PCI0.PEG0.PEGP._OFF ()
}
If (CondRefOf (\_SB.PCI0.LPCB.EC.AIRP))
{
And (\_SB.PCI0.LPCB.EC.AIRP, 0xBF, \_SB.PCI0.LPCB.EC.AIRP)
}
}
}
Method (B1B2, 2, NotSerialized)
{
Return (Or (Arg0, ShiftLeft (Arg1, 0x08)))
}
}