Debian Codegraph @

src/mainboard/novacustom/mtl-h/acpi/dgpu/nvop.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #define NVOP_FUNC_SUPPORT 0x00
4 #define NVOP_FUNC_OPTIMUS_CAPS 0x1a
5 #define NVOP_FUNC_OPTIMUS_STATUS 0x1b
6
7 Method (NVOP, 2, Serialized)
8 {
9 Switch (ToInteger (Arg0))
10 {
11 Case (NVOP_FUNC_SUPPORT)
12 {
13 Return (ITOB (
14 (1 << NVOP_FUNC_SUPPORT) |
15 (1 << NVOP_FUNC_OPTIMUS_CAPS) |
16 (1 << NVOP_FUNC_OPTIMUS_STATUS)))
17 }
18 Case (NVOP_FUNC_OPTIMUS_CAPS)
19 {
20 CreateField(Arg1, 0, 1, FLUP) /* Flag Update */
21 CreateField(Arg1, 1, 1, CSOT) /* Change configuration Space Owner Target */
22 CreateField(Arg1, 2, 1, CSOW) /* Change configuration Space Owner Write */
23 CreateField(Arg1, 24, 2, NPCE) /* New Power Control Enable setting */
24
25 /* Change Optimus power control capabilities */
26 If (ToInteger (FLUP) != 0 && ToInteger (NPCE) != 0)
27 {
28 OPCS = NPCE
29 }
30
31 /* Change PCI configuration space save/restore owner */
32 If (ToInteger (CSOW) == 1)
33 {
34 PCIO = CSOT
35 }
36
37 /* Current GPU Control Status */
38 If (PSTA () == 1)
39 {
40 Local0 = 3
41 }
42 Else
43 {
44 Local0 = 0
45 }
46
47 Return (ITOB (
48 (1 << 0) | /* Optimus Enabled */
49 (Local0 << 3) | /* Current GPU Control Status */
50 (1 << 6) | /* Shared Discrete GPU Hotplug Capabilities */
51 (0 << 7) | /* MUXed DDC/Aux Capabilities */
52 (PCIO << 8) | /* PCIe Configuration Space Owner */
53 (1 << 24) | /* Platform Optimus Power Capabilities */
54 (3 << 27))) /* Optimus HD Audio Codec Capabilities */
55 }
56 Case (NVOP_FUNC_OPTIMUS_STATUS)
57 {
58 Return (ITOB (
59 (1 << 0) | /* Optimus Audio Codec Control */
60 (0 << 2) | /* Request GPU Power State */
61 (0 << 4) | /* Evaluate Requested GPU Power State */
62 (0 << 5) | /* Request Optimus Adapter Policy */
63 (0 << 7))) /* Evaluate Requested Optimus Adapter Selection */
64 }
65 }
66
67 Return (NV_ERROR_UNSUPPORTED)
68 }