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