summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/acpi/dptc.asl
blob: 84238d99a82d33bb7984de68f644123f6a78e5ef (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
/* SPDX-License-Identifier: GPL-2.0-only */

External(\_SB.DDEF, MethodObj)
External(\_SB.DTHL, MethodObj)
External(\_SB.DTAB, MethodObj)

Scope (\_SB)
{
    Method (DPTC, 0, Serialized)
    {
        /* If _SB.DDEF is not present, DPTC is not enabled so return early. */
        If (!CondRefOf (\_SB.DDEF))
        {
            Return (0)
        }

        /* If _SB.DTHL is not present, then DPTC Tablet Mode is not enabled.
         * Throttle the SOC if the battery is not present (BTEX), the battery level is critical
         * (BFCR), or the battery is cutoff (BFCT). */
        If (CondRefOf (\_SB.DTHL) &&
            (!\_SB.PCI0.LPCB.EC0.BTEX || \_SB.PCI0.LPCB.EC0.BFCR || \_SB.PCI0.LPCB.EC0.BFCT))
        {
            \_SB.DTHL()
            Return (0)
        }

        /* If _SB.DTAB is not present, then DPTC Tablet Mode is not enabled. */
        If (CondRefOf (\_SB.DTAB) && (\_SB.PCI0.LPCB.EC0.TBMD == 1))
        {
            \_SB.DTAB()
            Return (0)
        }

#if CONFIG(FEATURE_DYNAMIC_DPTC)
        \_SB.DTTS()
#else
        \_SB.DDEF()
#endif
        Return (0)
    }
}