1 /* SPDX-License-Identifier: GPL-2.0-only */
5 Name (_HID, EisaId ("PNP0C09"))
7 Name (_GPE, EC_GPE_SWI)
11 Name (_CRS, ResourceTemplate () {
12 IO (Decode16, 0x62, 0x62, 0, 1)
13 IO (Decode16, 0x66, 0x66, 0, 1)
16 Method (_STA, 0, NotSerialized) // _STA: Status
21 OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF)
22 Field (ERAM, ByteAcc, Lock, Preserve)
25 LSTE, 1, /* lid state */
27 ACEX, 1, /* AC adapter present */
28 BTEX, 1, /* battery present */
31 BTDC, 16, /* battery design capacity - mAh */
32 BTFV, 16, /* battery last full voltage - mV */
33 BTFC, 16, /* battery last full capacity - mAh */
35 BTST, 3, /* battery state */
37 BTCR, 16, /* battery present current - mA */
38 BTRC, 16, /* battery remaining capacity - mAh */
39 BTVT, 16, /* battery present voltage - mV */
41 DSPO, 8, /* Display off - write 1 to power off display */
42 BCST, 8, /* battery charge start threshold - % */
43 BCET, 8, /* battery charge end threshold - % */
48 #include "battery.asl"
51 Method (PTS, 1, Serialized) {
52 Printf ("EC: PTS: %o", ToHexString(Arg0))
59 Method (WAK, 1, Serialized) {
60 Printf ("EC: WAK: %o", ToHexString(Arg0))
69 Method (_Q54, 0, NotSerialized) // Power button press
71 Printf ("EC: _Q54: power button press")
75 Method (_Q0A, 0, NotSerialized) // Charger plugged or unplugged
77 Printf ("EC: _Q0A: charger state changed")
81 Notify(BAT0, 0x81) // Information change
82 Notify(AC, 0x80) // Status change
85 Method (_Q0B, 0, NotSerialized) // Battery status change
87 Printf ("EC: _Q0B: battery state changed")
88 Notify(BAT0, 0x81) // Information change
89 Notify(BAT0, 0x80) // Status change
92 /* There is a lid/cover sensor, but it is not reliable with a soft cover. */
93 Method (_Q0C, 0, NotSerialized) // Cover closed
95 Printf ("EC: _Q0C: cover closed")
98 Method (_Q0D, 0, NotSerialized) // Cover opened
100 Printf ("EC: _Q0D: cover opened")
103 Method (_REG, 2, Serialized) // _REG: Region Availability
105 Printf ("EC: _REG: %o, %o", Arg0, Arg1)
106 If ((Arg0 == 0x03) && (Arg1 == One)) {
107 // EC is now available
110 // Set current AC and battery state
118 Printf ("EC is ready; BTEX=%o, ACEX=%o", BTEX, ACEX)