summaryrefslogtreecommitdiff
path: root/src/ec/hp/kbc1126/acpi/ac.asl
blob: 97430455a05039b0e4073765ec0cceb84e96d93b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* SPDX-License-Identifier: GPL-2.0-only */

Name (ACST, 0x01)
Name (SMAR, 0x00)

Field (ECRM, ByteAcc, NoLock, Preserve)
{
	Offset (0x84),
	ADP,    1,
	ADID,   2
}

Method (UPAD, 0, Serialized)
{
	Acquire (BTMX, 0xFFFF)
	If ((GACP & 0x01))
	{
		GACP &= 0x06
		Release (BTMX)
		Acquire (ECMX, 0xFFFF)
		Local0 = ADP
		Local1 = ADID
		Release (ECMX)
		ACST = Local0
		SMAR = Local1
	}
	Else
	{
		Release (BTMX)
	}
}

Method (GPID, 0, Serialized)
{
	UPAD ()
	Return (SMAR)
}

Method (GACS, 0, Serialized) /* get AC status */
{
	UPAD ()
	Return (ACST)
}

Device (AC)
{
	Name (_HID, "ACPI0003")
	Name (_PCL, Package () { \_SB })

	Method (_PSR)
	{
		Local0 = GACS ()
		PWRS = Local0 /* GNVS.PWRS */
		Local1 = GPID ()
		ACST = Local0
		SMAR = Local1
		Return (Local0)
	}
}

Method (_Q06)
{
	Printf ("EC: AC STATUS")
	PWUP (0x05, (0x02 | 0x01))
	If (BTDR (0x02))
	{
		Notify (AC, 0x80)
		PNOT ()
	}
}