Debian Codegraph @

src/mainboard/google/brya/acpi/nvop.asl

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