blob: aa70050ff385ec01d48edeaceb34b47442d979ca [file] [log] [blame]
Tim Van Patten92443582022-08-23 16:06:33 -06001/* SPDX-License-Identifier: GPL-2.0-only */
2
3External(\_SB.DDEF, MethodObj)
Tim Van Pattena90aebb2022-08-16 12:09:23 -06004External(\_SB.DTHL, MethodObj)
Tim Van Patten92443582022-08-23 16:06:33 -06005External(\_SB.DTAB, MethodObj)
6
7Scope (\_SB)
8{
9 Method (DPTC, 0, Serialized)
10 {
11 /* If _SB.DDEF is not present, DPTC is not enabled so return early. */
12 If (!CondRefOf (\_SB.DDEF))
13 {
14 Return (Zero)
15 }
16
Tim Van Pattena90aebb2022-08-16 12:09:23 -060017 /* If _SB.DTHL is not present, then DPTC Tablet Mode is not enabled.
18 * Throttle the SOC if the battery is not present (BTEX), the battery level is critical
19 * (BFCR), or the battery is cutoff (BFCT). */
20 If (CondRefOf (\_SB.DTHL) &&
21 (!\_SB.PCI0.LPCB.EC0.BTEX || \_SB.PCI0.LPCB.EC0.BFCR || \_SB.PCI0.LPCB.EC0.BFCT))
22 {
23 \_SB.DTHL()
24 Return (Zero)
25 }
26
27 /* If _SB.DTAB is not present, then DPTC Tablet Mode is not enabled. */
Felix Singer7b8ac002022-12-26 08:45:56 +010028 If (CondRefOf (\_SB.DTAB) && (\_SB.PCI0.LPCB.EC0.TBMD == 1))
Tim Van Patten92443582022-08-23 16:06:33 -060029 {
30 \_SB.DTAB()
31 Return (Zero)
32 }
33
EricKY Cheng429b1992022-10-17 15:09:43 +080034#if CONFIG(FEATURE_DYNAMIC_DPTC)
35 \_SB.DTTS()
36#else
Tim Van Patten92443582022-08-23 16:06:33 -060037 \_SB.DDEF()
EricKY Cheng429b1992022-10-17 15:09:43 +080038#endif
Tim Van Patten92443582022-08-23 16:06:33 -060039 Return (Zero)
40 }
41}