Debian Codegraph @

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

raw
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #define JT_FUNC_SUPPORT 0
4 #define JT_FUNC_CAPS 1
5 #define JT_FUNC_POWERCONTROL 3
6 #define JT_FUNC_PLATPOLICY 4
7
8 Method (NVJT, 2, Serialized)
9 {
10 Switch (ToInteger(Arg0))
11 {
12 Case (JT_FUNC_SUPPORT)
13 {
14 Return (ITOB(
15 (1 << JT_FUNC_SUPPORT) |
16 (1 << JT_FUNC_CAPS) |
17 (1 << JT_FUNC_POWERCONTROL)))
18 }
19 Case (JT_FUNC_CAPS)
20 {
21 Return (ITOB(
22 (1 << 0) | /* JTE: G-Sync NVSR Power Features Enabled */
23 (1 << 1) | /* NVSE: NVSR Disabled */
24 (2 << 3) | /* PPR: Panel Power Rail */
25 (0 << 5) | /* SRPR: Self-Refresh Controller Power Rail */
26 (0 << 6) | /* FBPR: FB Power Rail */
27 (0 << 8) | /* GPR: GPU Power Rail */
28 (0 << 10) | /* GCR: GC6 ROM */
29 (1 << 11) | /* PTH: No SMI Handler */
30 (0 << 12) | /* NOT: Supports Notify on GC6 State done */
31 (1 << 13) | /* MHYB: MS Hybrid Support (deferred GC6) */
32 (1 << 14) | /* RPC: Root Port Control */
33 (2 << 15) | /* GC6 Version (GC6-R) */
34 (0 << 17) | /* GEI: GC6 Exit ISR Support */
35 (0 << 18) | /* GSW: GC6 Self Wakeup */
36 (0x200 << 20))) /* MXRV: Highest Revision */
37 }
38 Case (JT_FUNC_POWERCONTROL)
39 {
40 CreateField (Arg1, 0, 3, GPC) /* GPU Power Control */
41 CreateField (Arg1, 4, 1, PPC) /* Panel Power Control */
42 CreateField (Arg1, 14, 2, DFGC) /* Defer GC6 enter/exit */
43 CreateField (Arg1, 16, 3, GPCX) /* Deferred GC6 exit */
44
45 /* Deferred GC6 entry/exit is requested */
46 If (ToInteger(GPC) != 0 || ToInteger(DFGC) != 0)
47 {
48 DFEN = ToInteger(DFGC)
49 DFCI = ToInteger(GPC)
50 DFCO = ToInteger(GPCX)
51 }
52
53 Local0 = Buffer (4) { 0x0 }
54 CreateField (Local0, 0, 3, CGCS) /* Current GC State */
55 CreateField (Local0, 3, 1, CGPS) /* Current GPU power status */
56 CreateField (Local0, 7, 1, CPSS) /* Current panel and SRC state */
57
58 /* Leave early if deferred GC6 is requested */
59 If (DFEN != 0)
60 {
61 CGCS = 1
62 CGPS = 1
63 Return (Local0)
64 }
65
66 Switch (ToInteger(GPC))
67 {
68 /* Get GCU GCx Sleep Status */
69 Case (NVJT_GPC_GSS)
70 {
71 If (PSTA () != 0)
72 {
73 CGPS = 1
74 CGCS = 1
75 }
76 Else
77 {
78 CGPS = 0
79 CGCS = 3
80 }
81 }
82 Case (NVJT_GPC_EGNS)
83 {
84 /* Enter GC6; no self-refresh */
85 GC6I ()
86 CPSS = 1
87 CGCS = 0
88 }
89 Case (NVJT_GPC_EGIS)
90 {
91 /* Enter GC6; enable self-refresh */
92 GC6I ()
93 If (ToInteger (PPC) == 0)
94 {
95 CPSS = 0
96 }
97 CGCS = 0
98 }
99 Case (NVJT_GPS_XGXS)
100 {
101 /* Exit GC6; stop self-refresh */
102 GC6O ()
103 CGCS = 1
104 CGPS = 1
105 If (ToInteger (PPC) != 0)
106 {
107 CPSS = 0
108 }
109 }
110 Case (NVJT_GPS_XGIS)
111 {
112 /* Exit GC6 for self-refresh */
113 GC6O ()
114 CGCS = 1
115 CGPS = 1
116 If (ToInteger (PPC) != 0)
117 {
118 CPSS = 0
119 }
120 }
121 }
122
123 Return (Local0)
124 }
125 }
126
127 Return (NV_ERROR_UNSUPPORTED)
128 }