xref: /aosp_15_r20/external/coreboot/src/mainboard/google/skyrim/variants/winterhold/include/variant/acpi/dtts.asl (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1/* SPDX-License-Identifier: GPL-2.0-only */
2
3External(\_SB.DTTB, MethodObj)
4External(\_SB.DTTC, MethodObj)
5External(\_SB.DTTD, MethodObj)
6External(\_SB.DTTE, MethodObj)
7External(\_SB.DTTF, MethodObj)
8
9Scope (\_SB)
10{
11    //---------------------------------------------
12    // Table | A | B | C | D | E | F | First boot |
13    //---------------------------------------------
14    // PRTN  | 0 | 1 | 2 | 3 | 4 | 5 |     7      |
15    //---------------------------------------------
16    Name (PRTN, 7)
17
18    Method (DTTS, 0, Serialized)
19    {
20        // Set table A as default table after power on device
21        If (\_SB.PRTN == 7)
22        {
23            \_SB.DDEF()
24            \_SB.PRTN = 0
25            Return (0)
26        }
27
28        If (\_SB.PCI0.LPCB.EC0.STTB == 0) { // Desktop
29            If (\_SB.PCI0.LPCB.EC0.LIDS == 1) { // Lid-open
30                // Table A/B
31                If ((\_SB.PRTN == 0) || (\_SB.PRTN == 1)) {
32                    // AMB sensor trigger point
33                    // 43C will store 116(0x74) in mapped memory
34                    // 43C=316K, 316-200(offset)=116(0x74)
35                    If (\_SB.PCI0.LPCB.EC0.TIN4 >= 116) {
36                        \_SB.DTTB()
37                        \_SB.PRTN = 1
38                        Return (0)
39                    }
40                    // AMB sensor release point
41                    If ((\_SB.PCI0.LPCB.EC0.TIN4 <= 112)) {
42                        \_SB.DDEF()
43                        \_SB.PRTN = 0
44                        Return (0)
45                    }
46                    // Keep tht previous thermal table
47                    Return (0)
48                } Else {
49                    If (\_SB.PRTN == 3 || \_SB.PRTN == 5) {
50                        \_SB.DTTB()
51                        \_SB.PRTN = 1
52                        Return (0)
53                    } Else {
54                        \_SB.DDEF()
55                        \_SB.PRTN = 0
56                        Return (0)
57                    }
58                }
59            } Else { // Lid-close
60                // Table C/D
61                If (\_SB.PRTN == 2 || \_SB.PRTN == 3) {
62                    If (\_SB.PCI0.LPCB.EC0.TIN4 >= 116) {
63                        \_SB.DTTD()
64                        \_SB.PRTN = 3
65                        Return (0)
66                    }
67                    If(\_SB.PCI0.LPCB.EC0.TIN4 <= 112) {
68                        \_SB.DTTC()
69                        \_SB.PRTN = 2
70                        Return (0)
71                    }
72                    // Keep tht previous thermal table
73                    Return (0)
74                } Else {
75                    If (\_SB.PRTN == 1 || \_SB.PRTN == 5) {
76                        \_SB.DTTD()
77                        \_SB.PRTN = 3
78                        Return (0)
79                    } Else {
80                        \_SB.DTTC()
81                        \_SB.PRTN = 2
82                        Return (0)
83                    }
84                }
85            }
86        } Else { // Laptop
87            // Table E/F
88            If (\_SB.PRTN == 4 || \_SB.PRTN == 5) {
89                // AMB sensor trigger point
90                If (\_SB.PCI0.LPCB.EC0.TIN4 >= 115) {
91                    \_SB.DTTF()
92                    \_SB.PRTN = 5
93                    Return (0)
94                }
95                // AMB sensor release point
96                If ((\_SB.PCI0.LPCB.EC0.TIN4 <= 111)) {
97                    \_SB.DTTE()
98                    \_SB.PRTN = 4
99                    Return (0)
100                }
101                // Keep tht previous thermal table
102                Return (0)
103            } Else {
104                If (\_SB.PRTN == 1 || \_SB.PRTN == 3) {
105                    \_SB.DTTF()
106                    \_SB.PRTN = 5
107                    Return (0)
108                } Else {
109                    \_SB.DTTE()
110                    \_SB.PRTN = 4
111                    Return (0)
112                }
113            }
114        } // Desktop/Laptop End
115    }
116}
117