summaryrefslogtreecommitdiff
path: root/src/mainboard/51nb/x210/acpi/ec.asl
blob: 78e156c6a26050311bf2296c8e63f7ae1d817d1f (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* SPDX-License-Identifier: GPL-2.0-or-later */

Device (EC)
{
	Name (_HID, EisaId ("PNP0C09"))
	Name (_UID, 0)

	Name (_GPE, 0x4F)  // _GPE: General Purpose Events
	Name (_CRS, ResourceTemplate () {
		IO (Decode16, 0x62, 0x62, 1, 1)
		IO (Decode16, 0x66, 0x66, 1, 1)
	})

	OperationRegion (ERAM, EmbeddedControl, Zero, 0xFF)
	Field (ERAM, ByteAcc, Lock, Preserve)
	{
		Offset (0x50),
		CTMP,   8,
		CFAN,   8,
		B1SS,   1,
		BSTS,   2,
		ACIN,   1,
		Offset (0x53),
		BKLG,   8,
		TOUP,   1,
		WIRE,   1,
		BLTH,   1,
		LIDC,   1,
		APFG,   1,
		WRST,   1,
		BTST,   1,
		ACEB,   1,
		CAME,   1,
		Offset (0x60),
		DGCP,   16,
		FLCP,   16,
		DGVO,   16,
		BDW,    16,
		BDL,    16,
		BPR,    16,
		BRC,    16,
		BPV,    16
	}

	Method (_REG, 2, NotSerialized)
	{
		/* Initialize AC power state */
		Store (ACIN, \PWRS)

		/* Initialize LID switch state */
		Store (LIDC, \LIDS)
	}

	/* KEY_BRIGHTNESSUP */
	Method (_Q04)
	{
		Notify(\_SB.PCI0.GFX0.LCD, 0x86)
	}

	/* KEY_BRIGHTNESSDOWN */
	Method (_Q05)
	{
		Notify(\_SB.PCI0.GFX0.LCD, 0x87)
	}

	/* Battery Information Event */
	Method (_Q0C)
	{
		Notify (BAT, 0x81)
	}

	/* AC event */
	Method (_Q0D)
	{
		Store (ACIN, \PWRS)
		Notify (AC, 0x80)
	}

	/* Lid event */
	Method (_Q0E)
	{
		Store (LIDC, \LIDS)
		Notify (LID0, 0x80)
	}

	/* Battery Information Event */
	Method (_Q13)
	{
		Notify (BAT, 0x81)
	}

	/* Battery Status Event */
	Method (_Q14)
	{
		Notify (BAT, 0x80)
	}

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

		Method (_STA)
		{
			Return (0x0F)
		}
		Method (_PSR)
		{
			Return (\PWRS)
		}
	}

	#include "battery.asl"
}