summaryrefslogtreecommitdiff
path: root/src/mainboard/google/brox/acpi/nvjt.asl
blob: 17011ec2dd3c0579e21beca42ae43fb092c1c12d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* SPDX-License-Identifier: GPL-2.0-or-later */

#define JT_FUNC_SUPPORT		0
#define JT_FUNC_CAPS		1
#define JT_FUNC_POWERCONTROL	3
#define JT_FUNC_PLATPOLICY	4

Method (NVJT, 2, Serialized)
{
	Switch (ToInteger(Arg0))
	{
		Case (JT_FUNC_SUPPORT)
		{
			Return (ITOB(
				(1 << JT_FUNC_SUPPORT) |
				(1 << JT_FUNC_CAPS) |
				(1 << JT_FUNC_POWERCONTROL) |
				(1 << JT_FUNC_PLATPOLICY)))
		}
		Case (JT_FUNC_CAPS)
		{
			Return (ITOB(
				(0 << 0) |		/* JTE: G-Sync NVSR Power Features Enabled */
				(1 << 0) |		/* NVSE: NVSR Disabled */
				(0 << 3) |		/* PPR: Panel Power Rail */
				(0 << 5) |		/* SRPR: Self-Refresh Controller Power Rail */
				(0 << 6) |		/* FBPR: FB Power Rail */
				(0 << 8) |		/* GPR: GPU Power Rail */
				(0 << 10) |		/* GCR: GC6 ROM */
				(1 << 11) |		/* PTH: No SMI Handler */
				(0 << 12) |		/* NOT: Supports Notify on GC6 State done */
				(1 << 13) |		/* MHYB: MS Hybrid Support (deferred GC6) */
				(0 << 14) |		/* RPC: Root Port Control */
				(0 << 15) |		/* GC6 Version (GC6-E) */
				(0 << 17) |		/* GEI: GC6 Exit ISR Support */
				(0 << 18) |		/* GSW: GC6 Self Wakeup */
				(0x200 << 20)))		/* MXRV: Highest Revision */
		}
		Case (JT_FUNC_POWERCONTROL)
		{
			CreateField (Arg1, 0, 3, GPC)	/* GPU Power Control */
			CreateField (Arg1, 4, 1, PPC)	/* Panel Power Control */
			CreateField (Arg1, 14, 2, DFGC)	/* Defer GC6 enter/exit */
			CreateField (Arg1, 16, 3, GPCX) /* Deferred GC6 exit */

			/* Deferred GC6 entry/exit is requested */
			If (ToInteger(GPC) != 0 || ToInteger(DFGC) != 0)
			{
				DFEN = ToInteger(DFGC)
				DFCI = ToInteger(GPC)
				DFCO = ToInteger(GPCX)
			}

			Local0 = Buffer (4) { 0x0 }
			CreateField (Local0, 0, 3, CGCS)	/* Current GC State */
			CreateField (Local0, 3, 1, CGPS)	/* Current GPU power status */
			CreateField (Local0, 7, 1, CPSS)	/* Current panel and SRC state */

			/* Leave early if deferred GC6 is requested */
			If (DFEN != 0)
			{
				CGCS = 1
				CGPS = 1
				Return (Local0)
			}

			Switch (ToInteger(GPC))
			{
				/* Get GCU GCx Sleep Status */
				Case (NVJT_GPC_GSS)
				{
					If (PSTA () != 0)
					{
						CGPS = 1
						CGCS = 1
					}
					Else
					{
						CGPS = 0
						CGCS = 3
					}
				}
				Case (NVJT_GPC_EGNS)
				{
					/* Enter GC6; no self-refresh */
					GC6I ()
					CPSS = 1
					CGCS = 0
				}
				Case (NVJT_GPC_EGIS)
				{
					/* Enter GC6; enable self-refresh */
					GC6I ()
					If (ToInteger (PPC) == 0)
					{
						CPSS = 0
					}
					CGCS = 0
				}
				Case (NVJT_GPS_XGXS)
				{
					/* Exit GC6; stop self-refresh */
					GC6O ()
					CGCS = 1
					CGPS = 1
					If (ToInteger (PPC) != 0)
					{
						CPSS = 0
					}
				}
				Case (NVJT_GPS_XGIS)
				{
					/* Exit GC6 for self-refresh */
					GC6O ()
					CGCS = 1
					CGPS = 1
					If (ToInteger (PPC) != 0)
					{
						CPSS = 0
					}
				}
			}

			Return (Local0)
		}
	}

	Return (NV_ERROR_UNSUPPORTED)
}