Debian Codegraph @

src/soc/intel/common/acpi/dptf/charger.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 Device (TCHG)
4 {
5 Name (_HID, DPTF_GEN_DEVICE)
6
7 Name (_UID, 0)
8 Name (PTYP, 0x0B)
9 Name (_STR, Unicode("Battery Charger"))
10
11 Method (_STA)
12 {
13 If (\DPTE == 1) {
14 Return (0xF)
15 } Else {
16 Return (0x0)
17 }
18 }
19
20 /* Return charger performance states defined by mainboard */
21 Method (PPSS)
22 {
23 Return (\_SB.CHPS)
24 }
25
26 /* Return maximum charger current limit */
27 Method (PPPC)
28 {
29 /* Convert size of PPSS table to index */
30 Local0 = SizeOf (\_SB.CHPS)
31 Local0--
32
33 /* Check if charging is disabled (AC removed) */
34 If (\_SB.PCI0.LPCB.EC0.ACEX == 0) {
35 /* Return last power state */
36 Return (Local0)
37 } Else {
38 /* Return highest power state */
39 Return (0)
40 }
41
42 Return (0)
43 }
44
45 /* Set charger current limit */
46 Method (SPPC, 1)
47 {
48 /* Retrieve Control (index 4) for specified PPSS level */
49 Local0 = DeRefOf (DeRefOf (\_SB.CHPS[ToInteger (Arg0)])[4])
50
51 /* Pass Control value to EC to limit charging */
52 \_SB.PCI0.LPCB.EC0.CHGS (Local0)
53 }
54
55 /* Initialize charger participant */
56 Method (INIT)
57 {
58 /* Disable charge limit */
59 \_SB.PCI0.LPCB.EC0.CHGD ()
60 }
61 }