Debian Codegraph @

src/ec/starlabs/merlin/acpi/hid.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #if CONFIG(EC_STARLABS_MERLIN)
4 Scope (\_SB.PCI0.LPCB.EC)
5 {
6 Method (_Q05, 0, NotSerialized) // Event: Backlight Brightness Down
7 {
8 ^^^^HIDD.HPEM (20)
9 }
10
11 Method (_Q06, 0, NotSerialized) // Event: Backlight Brightness Up
12 {
13 ^^^^HIDD.HPEM (19)
14 }
15 }
16 #endif
17
18 Device (HIDD) // HID Device
19 {
20 Name (_HID, "INTC1051") // Intel Ultrabook HID Platform Event Driver.
21 Name (HBSY, 0) // HID Busy
22 Name (HIDX, 0) // HID Index
23 Name (HMDE, 0) // HID Mode
24 Name (HRDY, 0) // HID Ready
25 Name (BTLD, 0) // Button Driver Loaded
26 Name (BTS1, 0) // Button Status
27 Method (_STA, 0, Serialized) // Status Method
28 {
29 // Usually, ACPI will check if the OS is 0x07DD (2013 - Windows 8.1ish)
30 // before showing the HID event filter. Seeing as we use Linux we show
31 // it regardless.
32 Return (0x0F)
33 }
34 //
35 // HID Driver Descriptor Method - Called by HID Driver during initialization
36 // to obtain HID Descriptor information.
37 //
38 // Input:
39 // None
40 //
41 // Output:
42 // Package containing a complete HID Descriptor information.
43 //
44 Name (DPKG, Package(4)
45 {
46 0x11111111,
47 0x22222222,
48 0x33333333,
49 0x44444444,
50 })
51 Method (HDDM, 0, Serialized)
52 {
53 Return (DPKG)
54 }
55 //
56 // HID Driver Event Method - Called by HID Driver to get the specific
57 // platform event.
58 //
59 // Input:
60 // None
61 //
62 // Output:
63 // Mode 0 = Index of HID Input Report, per pre-defined Table.
64 // Mode 1 = Package containing a complete HID Input Report.
65 //
66 Method (HDEM, 0, Serialized)
67 {
68 HBSY = 0x00 // Clear HID Busy.
69 // Simple Mode is hardcoded for now. Return Simple Mode HID Index Value.
70 If (HMDE == 0x00)
71 {
72 Return (HIDX)
73 }
74 Return (HMDE)
75 }
76 //
77 // HID Driver Mode Method - Called by HID Driver during initialization to get
78 // the platform mode of operation.
79 //
80 // Input:
81 // None
82 //
83 // Output:
84 // 0 = Simple Mode.
85 // 1 = Advanced Mode.
86 //
87 Method (HDMM, 0, Serialized)
88 {
89 Return (HMDE) // Return Mode of operation.
90 }
91 //
92 // HID Driver Status Method - called by HID Driver to report platform readiness status.
93 //
94 // Input: Driver Status.
95 // 0 = Driver Unloaded.
96 // 1 = Driver Loaded and Ready.
97 //
98 // Output: None
99 //
100 Method (HDSM, 1, Serialized)
101 {
102 HRDY = Arg0 // Store HID Ready Status.
103 // Eventually code will communicate to platform the Driver status (enabled/disabled).
104 }
105 //
106 // HID Platform Event Method - called by Platform to communicate HID Event to Driver.
107 //
108 // Input:
109 // Mode 0 = Index of HID Event.
110 // Mode 1 = Package containing a complete HID Report.
111 //
112 Method (HPEM, 1, Serialized) // HID Platform Event Method.
113 {
114 HBSY = 0x01 // Set HID Busy.
115 // Simple Mode is hardcoded for now. Simply store HID Index value.
116 If (HMDE == 0x00)
117 {
118 HIDX = Arg0
119 } Else {
120 HIDX = Arg0
121 }
122 Notify (\_SB.HIDD, 0xC0) // Notify Driver to get HID Event.
123 Local0 = 0x00 // Initialize Local0 as a timeout counter.
124 While((Local0 < 250) && HBSY) // Wait <= 1 second for Driver to ACK success.
125 {
126 Sleep (4) // Delay 4 ms.
127 Local0++ // Increment Timeout.
128 }
129 If (HBSY == 0x01) // Failure?
130 {
131 HBSY = 0x00 // Yes. Clear HID Busy Flag.
132 HIDX = 0x00 // Set HID Simple Mode Index = 0 = Undefined.
133 Return (0x01) // Return Failure.
134 } Else {
135 Return (0x00) // Return Success.
136 }
137 }
138 //
139 // HID Button Load Method - called by Platform to say HID driver is capable of receiving
140 // 5-button array notifications.
141 //
142 // Input:
143 // None
144 //
145 // Output:
146 // None
147 //
148 Method (BTNL, 0, Serialized) // HID Button Enable/Disable Method
149 {
150 BTS1 = 0x00
151 }
152 //
153 // HID Button Enable/Disable Method - called by Platform to disable/enable notification based
154 // on button press
155 //
156 // Input:
157 // Arg0 = Bit mask of buttons to Enable or Disable:
158 // 1 == Button should be Enabled
159 // 0 == Button should be Disabled
160 // Bits[0]: Power Button N/A to disable
161 // Bits[1]: Windows Button
162 // Bits[2]: Volume Up Button
163 // Bits[3]: Volume Down Button
164 // Bits[4]: Rotation Lock Button
165 // Bits[5:31]: Reserved
166 //
167 // Output:
168 // None
169 //
170 Method (BTNE, 1, Serialized) // HID Button Enable/Disable Method
171 {
172 Return (BTS1)
173 }
174 //
175 // HID Button Status - called by Platform to get what buttons are enabled and disabled
176 //
177 // Input:
178 // None
179 //
180 // Output:
181 // Bit mask of buttons' current status:
182 // 1 == Button is Enabled
183 // 0 == Button is Disabled
184 // Bits[0]: Power Button N/A to disable
185 // Bits[1]: Windows Button
186 // Bits[2]: Volume Up Button
187 // Bits[3]: Volume Down Button
188 // Bits[4]: Rotation Lock Button
189 // Bits[5:31]: Reserved
190 //
191 Method (BTNS, 0, Serialized)
192 {
193 Return (BTS1)
194 }
195 //
196 // HID Button Capabilities Method - called by Platform to determine what buttons are supported
197 //
198 // Input:
199 // None
200 //
201 // Output:
202 // Bit mask of buttons supported:
203 // 1 == Button is Supported
204 // 0 == Button is not Supported
205 // Bits[0]: Power Button (Must be 1)
206 // Bits[1]: Windows Button
207 // Bits[2]: Volume Up Button
208 // Bits[3]: Volume Down Button
209 // Bits[4]: Rotation Lock Button
210 // Bits[5:31]: Reserved
211 //
212 Method (BTNC, 0, Serialized) // HID Button Capabilities Method
213 {
214 Return (0x1F)
215 }
216
217 //
218 // HEBC: HID Event Base Capabilities [31:0]- To specify the base button capabilities supported
219 // on platform by returning a ULONG value with the following bit level definition
220 //
221 // Input:
222 // None
223 //
224 // 0 = Button not supported
225 // 1 = Button supported
226 // Output:
227 // Bits [0] - Windows Button (Windows 8.1 supported), Rotation Lock (Windows 8.1 supported):
228 // Num Lock, Home, End, Page Up, Page Down
229 // Bits [1] - Wireless Radio Control
230 // Bits [2] - System Power Down (Windows 8.1 supported)
231 // Bits [3] - System Hibernate
232 // Bits [4] - System Sleep/ System Wake
233 // Bits [5] - Scan Next Track
234 // Bits [6] - Scan Previous Track
235 // Bits [7] - Stop
236 // Bits [8] - Play/Pause
237 // Bits [9] - Mute
238 // Bits [10] - Volume Increment (Windows 8.1 supported)
239 // Bits [11] - Volume Decrement (Windows 8.1 supported)
240 // Bits [12] - Display Brightness Increment
241 // Bits [13] - Display Brightness Decrement
242 // Bits [14] - Lock Tablet
243 // Bits [15] - Release Tablet
244 // Bits [16] - Toggle Bezel
245 // Bits [17] - 5 button array (Windows 10 supported):
246 // (Power, Windows Home, Volume Up, Volume Down, Rotation Lock)
247 // Bits [18] - Button 1
248 // Bits [19] - Button 2
249 // Bits [20] - Button 3
250 // Bits [21] - Button 4
251 // Bits [22] - Button 5
252 // Bits [23-31] - reserved
253 //
254 // Modify below table if the target platform has different capabilities. Each bit
255 // corresponding the above table definition.
256 //
257 Name (HEB2, 0) // Extended 32bit capability definition for future enhancements.
258 Method (HEBC, 0, Serialized) {
259 // It's possible to return (\HEB1)
260 Return (0x00)
261 }
262 Method (H2BC, 0, Serialized) {
263 // It's possible to return (\HEB1)
264 Return (0x00)
265 }
266 //
267 // HEEC- Hid Event Extended Capabilities [32:63]
268 //
269 Method (HEEC, 0, Serialized) {
270 // It's possible to return (\HEB2)
271 Return (0x00)
272 }
273 //
274 // HIDD _DSM
275 // _DSM : Device Specific Method for the Windows Compatible Button Array.
276 //
277 // Arg0: UUID Unique function identifier
278 // Arg1: Integer Revision Level
279 // Arg2: Integer Function Index
280 // Arg3: Package Parameters
281 //
282 Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
283 {
284 // Compare passed in UUID to supported UUID.
285 If (Arg0 == ToUUID ("EEEC56B3-4442-408F-A792-4EDD4D758054"))
286 {
287 If (0x01 == ToInteger(Arg1)) // Revision 1.
288 {
289 Switch (ToInteger(Arg2)) // Switch to Function Index.
290 {
291 //
292 // Function 0, Query of supported functions.
293 //
294 Case (0x00)
295 {
296 Return (Buffer() {0xFF, 0x03}) // Total 9 function indices are supported including this.
297 }
298 //
299 // Function 1, BTNL. Button Load Method. No Input/Output.
300 //
301 Case (0x01)
302 {
303 BTNL()
304 }
305 //
306 // Function 2, HDMM. HID Driver Mode Method.
307 // Input:None
308 // Output:HDMM output. See HDMM
309 //
310 Case (0x02)
311 {
312 Return (HDMM())
313 }
314 //
315 // Function 3, HDSM. HID Driver Status Method.
316 // Input: 0 - The driver is not available. 1 - The driver is available.
317 // Output: None
318 //
319 Case (0x03)
320 {
321 HDSM (DeRefOf(Arg3[0]))
322 }
323 //
324 // Function 4, HDEM. HID Driver Event Method.
325 // Input: None.
326 // Output: Package contains Supported Keys (Mode 0)
327 //
328 Case (0x04)
329 {
330 Return (HDEM())
331 }
332 //
333 // Function 5 BTNS. Button Status Method.
334 // Input: None.
335 // Output: Int32 which contains a bit map of Buttons' enable/disable states
336 //
337 Case (0x05)
338 {
339 Return (BTNS())
340 }
341 //
342 // Function 6 BTNE. Button Enable/Disable Method.
343 // Input: Int32 Bit mask of buttons enable/disable control:
344 // 1 = Button should be Enabled
345 // 0 = Button should be Disabled
346 // Output: None.
347 //
348 Case (0x06)
349 {
350 BTNE (DeRefOf(Arg3[0]))
351 }
352 //
353 // Function 7 HEBC. Button implemented state.
354 // Input: None
355 // Output: Int32 Bit map which shows what buttons are implemented on this system.
356 //
357 Case (0x07)
358 {
359 Return (HEBC())
360 }
361 //
362 // Function 8 VGBS. Virtual GPIO Button Status.
363 // Input: None
364 // Output: Intger Bit map which shows what Virtual GPIO Button status. Currently only
365 // Dock/Slate modes are supported.
366 //
367 Case (0x08)
368 {
369 #if CONFIG(SYSTEM_TYPE_DETACHABLE)
370 Return (\_SB.PCI0.LPCB.EC.VBTN.VGBS())
371 #else
372 Return (0x00)
373 #endif
374 }
375 //
376 // Function 9 H2BC. Button implemented state.
377 // Input: None
378 // Output: Int32 Bit map which shows what buttons are implemented on this system.
379 //
380 Case (0x09)
381 {
382 Return (H2BC())
383 }
384 }
385 }
386 }
387 // If the code falls through to this point, just return a buffer of 0.
388 Return (Buffer() {0x00})
389 }
390 }