soc/mediatek/mt8196: Initialize SSPM
[coreboot2.git] / src / mainboard / google / brya / acpi / gps.asl
blobf201037f06133e2d53a3de01009281d47f8c2502
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #define GPS_FUNC_SUPPORT        0
4 #define GPS_FUNC_GETCALLBACKS   0x13
5 #define GPS_FUNC_PSHARESTATUS   0x20
6 #define GPS_FUNC_PSHAREPARAMS   0x2a
7 #define GPS_FUNC_REQUESTDXSTATE 0x12
9 #define QUERY_GET_STATUS                0
10 #define QUERY_GET_SUPPORTED_FIELDS      1
11 #define QUERY_GET_CURRENT_LIMITS        2
13 #define EC_D_NOTIFY_MASK        0x7
15 /* GPS return Package */
16 Name (GPSP, Buffer (0x28) {0x0})
17 CreateDWordField (GPSP, 0, RETN)
18 CreateDWordField (GPSP, 4, VRV1)
19 CreateDWordField (GPSP, 8, TGPU)
21 /* GETCALLBACKS return value
22    [0]: Callback for post-mode set
23    [1]: Callback for pre-mode set
24    [2]: Callback for post power state transition */
25 Name (GPSR, Buffer (4) { 0x4, 0x0, 0x0, 0x0 })
27 Method (GPS, 2, Serialized)
29         Switch (ToInteger (Arg0))
30         {
31                 Case (GPS_FUNC_SUPPORT)
32                 {
33                         Return (LTOB(
34                                 (1 << GPS_FUNC_SUPPORT) |
35                                 (1 << GPS_FUNC_GETCALLBACKS) |
36                                 (1 << GPS_FUNC_PSHARESTATUS) |
37                                 (1 << GPS_FUNC_PSHAREPARAMS) |
38                                 (1 << GPS_FUNC_REQUESTDXSTATE)))
39                 }
40                 Case (GPS_FUNC_GETCALLBACKS)
41                 {
42                         CreateDWordField (Arg1, 0, QURY)
44                         /* Driver querying for which callbacks the ACPI code
45                            wants callbacks for. */
46                         If (QURY == 0)
47                         {
48                                 Return (GPSR)
49                         }
51                         If (QURY & 0x4)
52                         {
53                                 Printf("GPS: Kernel driver callback post power state transition")
54                                 Return (GPSR)
55                         }
56                 }
57                 Case (GPS_FUNC_PSHARESTATUS)
58                 {
59                         Return (ITOB(
60                                 (0 << 0) |      /* GPS_FUNC_PSHAREPARAMS should not be called
61                                                    again after initialization, i.e., its return
62                                                    value is not dynamically updated. */
63                                 (1 << 0) |      /* System uses both a GPIO and ACPI notification
64                                                    codes to set multiple GPU power limits. */
65                                 (0 << 21)))     /* EDPpeak limit is default */
66                 }
67                 Case (GPS_FUNC_PSHAREPARAMS)
68                 {
69                         CreateField (Arg1, 0, 4, QUTY)   /* Query type */
71                         /* Version of return value */
72                         VRV1 = 0x10000
73                         Switch (ToInteger (QUTY))
74                         {
75                                 Case (QUERY_GET_STATUS)
76                                 {
77                                         Return (GPSP)
78                                 }
79                                 Case (QUERY_GET_SUPPORTED_FIELDS)
80                                 {
81                                         /* Only GPU temperature is supported */
82                                         RETN = 0x100 | ToInteger (QUTY)
83                                         Return (GPSP)
84                                 }
85                                 Case (QUERY_GET_CURRENT_LIMITS)
86                                 {
87                                         /* Request a limit of '0' for the GPU temperature,
88                                            meaning there is no limit. */
89                                         RETN = 0x102
90                                         TGPU = 0
91                                         Return (GPSP)
92                                 }
93                         }
94                 }
95                 Case (GPS_FUNC_REQUESTDXSTATE)
96                 {
97                         Local0 = ToInteger(\_SB.PCI0.LPCB.EC0.GPUD) & EC_D_NOTIFY_MASK
98                         \_SB.PCI0.PEG0.PEGP.DNOT (Local0, 1)
99                         Return (NV_ERROR_SUCCESS)
100                 }
101         }
103         Return (NV_ERROR_UNSUPPORTED)