1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #define GPS_FUNC_SUPPORT 0
4 #define GPS_FUNC_GETCALLBACKS 0x13
5 #define GPS_FUNC_PSHARESTATUS 0x20
6 #define GPS_FUNC_PSHAREPARAMS 0x2a
7 #define GPS_FUNC_REQUESTDXSTATE 0x12
9 #define QUERY_GET_STATUS 0
10 #define QUERY_GET_SUPPORTED_FIELDS 1
11 #define QUERY_GET_CURRENT_LIMITS 2
13 #define EC_D_NOTIFY_MASK 0x7
15 /* GPS return Package */
16 Name (GPSP, Buffer (0x28) {0x0})
17 CreateDWordField (GPSP, 0, RETN)
18 CreateDWordField (GPSP, 4, VRV1)
19 CreateDWordField (GPSP, 8, TGPU)
21 /* GETCALLBACKS return value
22 [0]: Callback for post-mode set
23 [1]: Callback for pre-mode set
24 [2]: Callback for post power state transition */
25 Name (GPSR, Buffer (4) { 0x4, 0x0, 0x0, 0x0 })
27 Method (GPS, 2, Serialized)
29 Switch (ToInteger (Arg0))
31 Case (GPS_FUNC_SUPPORT)
34 (1 << GPS_FUNC_SUPPORT) |
35 (1 << GPS_FUNC_GETCALLBACKS) |
36 (1 << GPS_FUNC_PSHARESTATUS) |
37 (1 << GPS_FUNC_PSHAREPARAMS) |
38 (1 << GPS_FUNC_REQUESTDXSTATE)))
40 Case (GPS_FUNC_GETCALLBACKS)
42 CreateDWordField (Arg1, 0, QURY)
44 /* Driver querying for which callbacks the ACPI code
45 wants callbacks for. */
53 Printf("GPS: Kernel driver callback post power state transition")
57 Case (GPS_FUNC_PSHARESTATUS)
60 (0 << 0) | /* GPS_FUNC_PSHAREPARAMS should not be called
61 again after initialization, i.e., its return
62 value is not dynamically updated. */
63 (1 << 0) | /* System uses both a GPIO and ACPI notification
64 codes to set multiple GPU power limits. */
65 (0 << 21))) /* EDPpeak limit is default */
67 Case (GPS_FUNC_PSHAREPARAMS)
69 CreateField (Arg1, 0, 4, QUTY) /* Query type */
71 /* Version of return value */
73 Switch (ToInteger (QUTY))
75 Case (QUERY_GET_STATUS)
79 Case (QUERY_GET_SUPPORTED_FIELDS)
81 /* Only GPU temperature is supported */
82 RETN = 0x100 | ToInteger (QUTY)
85 Case (QUERY_GET_CURRENT_LIMITS)
87 /* Request a limit of '0' for the GPU temperature,
88 meaning there is no limit. */
95 Case (GPS_FUNC_REQUESTDXSTATE)
97 Local0 = ToInteger(\_SB.PCI0.LPCB.EC0.GPUD) & EC_D_NOTIFY_MASK
98 \_SB.PCI0.PEG0.PEGP.DNOT (Local0, 1)
99 Return (NV_ERROR_SUCCESS)
103 Return (NV_ERROR_UNSUPPORTED)