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