summaryrefslogtreecommitdiff
path: root/src/ec/hp/kbc1126/acpi/ac.asl
blob: 76ff3e08844b3c204289801429629814007576d4 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
 * This file is part of the coreboot project.
 *
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; version 2 of
 * the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

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 (_STA)
	{
		Return (0x0F)
	}

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

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