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