summaryrefslogtreecommitdiffstats
path: root/src/mainboard/packardbell/ms2290/acpi/ec.asl
blob: 37a7424180d2a8f9b2341c28cc92d6060cbf0b35 (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
115
116
117
118
/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */

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

	Name (_GPE, 0x17)
	Mutex (ECLK, 0)

	OperationRegion(ERAM, EmbeddedControl, 0x00, 0x100)
	Field (ERAM, ByteAcc, NoLock, Preserve)
	{
		Offset (0x8),
		PAGE, 8,	/* Information Page Selector */
		Offset (0x70),
		    ,   1,
		LIDS,   1,
		    ,   3,
		HPAC,   1,
		Offset (0x88),
		B0PR,	1,	/* Battery 0 present */
		B0CH,	1,	/* Battery 0 charging */
		B0DI,	1,	/* Battery 0 discharging */
		Offset (0xA8),
		TMP0,	8,
		TMP1,	8,
	}

	Device(LID)
	{
		Name(_HID, "PNP0C0D")
		Method(_LID, 0, NotSerialized)
		{
			return (LIDS)
		}
	}

	Method(_Q52, 0, NotSerialized)
	{
		Notify(LID, 0x80)
	}

	Method(_Q53, 0, NotSerialized)
	{
		Notify(^LID, 0x80)
	}

	/* PAGE = 0 */
	Field (ERAM, ByteAcc, NoLock, Preserve)
	{
		Offset (0xe0),
		BARC, 16,		/* Battery remaining capacity */
		BAFC, 16,		/* Battery full charge capacity */
		, 16,
		BAPR, 16,		/* Battery present rate */
		BAVO, 16,		/* Battery Voltage */
	}

	/* PAGE = 1 */
	Field (ERAM, ByteAcc, NoLock, Preserve)
	{
		Offset (0xe0),
		BADC,	16,		/* Design Capacity */
		BADV,	16,		/* Design voltage */
		BASN,	16
	}

	/* PAGE = 2 */
	Field (ERAM, ByteAcc, NoLock, Preserve)
	{
		Offset (0xe0),
		BANA,	128,		/* Battery name */
	}

	/* PAGE = 4 */
	Field (ERAM, ByteAcc, NoLock, Preserve)
	{
		Offset (0xe0),
		BATY,	128,		/* Battery type */
	}

	/* PAGE = 5 */
	Field (ERAM, ByteAcc, NoLock, Preserve)
	{
		Offset (0xe0),
		BAOE,	128,		/* Battery OEM info */
	}

	Method (_CRS, 0, Serialized)
	{
		Name (ECMD, ResourceTemplate()
		{
			IO (Decode16, 0x62, 0x62, 1, 1)
			IO (Decode16, 0x66, 0x66, 1, 1)
		})
		Return (ECMD)
	}
	Method (_INI, 0, NotSerialized)
	{
	}

	/* Decrease brightness.  */
	Method(_Q1D, 0, NotSerialized)
	{
		\_SB.PCI0.GFX0.DECB()
	}
	/* Increase brightness.  */
	Method(_Q1C, 0, NotSerialized)
	{
		\_SB.PCI0.GFX0.INCB()
	}

#include "battery.asl"
#include "ac.asl"
#include "thermal.asl"
}