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