• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* SPDX-License-Identifier: GPL-2.0-only */
2
3Device(EC)
4{
5	Name (_HID, EISAID("PNP0C09"))
6	Name (_UID, 0)
7
8	Name (_GPE, 0x17)
9	Mutex (ECLK, 0)
10
11	OperationRegion(ERAM, EmbeddedControl, 0x00, 0x100)
12	Field (ERAM, ByteAcc, NoLock, Preserve)
13	{
14		Offset (0x8),
15		PAGE, 8,	/* Information Page Selector */
16		Offset (0x70),
17		    ,   1,
18		LIDS,   1,
19		    ,   3,
20		HPAC,   1,
21		Offset (0x88),
22		B0PR,	1,	/* Battery 0 present */
23		B0CH,	1,	/* Battery 0 charging */
24		B0DI,	1,	/* Battery 0 discharging */
25		Offset (0xA8),
26		TMP0,	8,
27		TMP1,	8,
28	}
29
30	Device(LID)
31	{
32		Name(_HID, "PNP0C0D")
33		Method(_LID, 0, NotSerialized)
34		{
35			return (LIDS)
36		}
37	}
38
39	Method(_Q52, 0, NotSerialized)
40	{
41		Notify(LID, 0x80)
42	}
43
44	Method(_Q53, 0, NotSerialized)
45	{
46		Notify(^LID, 0x80)
47	}
48
49	/* PAGE = 0 */
50	Field (ERAM, ByteAcc, NoLock, Preserve)
51	{
52		Offset (0xe0),
53		BARC, 16,		/* Battery remaining capacity */
54		BAFC, 16,		/* Battery full charge capacity */
55		, 16,
56		BAPR, 16,		/* Battery present rate */
57		BAVO, 16,		/* Battery Voltage */
58	}
59
60	/* PAGE = 1 */
61	Field (ERAM, ByteAcc, NoLock, Preserve)
62	{
63		Offset (0xe0),
64		BADC,	16,		/* Design Capacity */
65		BADV,	16,		/* Design voltage */
66		BASN,	16
67	}
68
69	/* PAGE = 2 */
70	Field (ERAM, ByteAcc, NoLock, Preserve)
71	{
72		Offset (0xe0),
73		BANA,	128,		/* Battery name */
74	}
75
76	/* PAGE = 4 */
77	Field (ERAM, ByteAcc, NoLock, Preserve)
78	{
79		Offset (0xe0),
80		BATY,	128,		/* Battery type */
81	}
82
83	/* PAGE = 5 */
84	Field (ERAM, ByteAcc, NoLock, Preserve)
85	{
86		Offset (0xe0),
87		BAOE,	128,		/* Battery OEM info */
88	}
89
90	Method (_CRS, 0, Serialized)
91	{
92		Name (ECMD, ResourceTemplate()
93		{
94			IO (Decode16, 0x62, 0x62, 1, 1)
95			IO (Decode16, 0x66, 0x66, 1, 1)
96		})
97		Return (ECMD)
98	}
99	Method (_INI, 0, NotSerialized)
100	{
101	}
102
103	/* Decrease brightness.  */
104	Method(_Q1D, 0, NotSerialized)
105	{
106		\_SB.PCI0.GFX0.DECB()
107	}
108	/* Increase brightness.  */
109	Method(_Q1C, 0, NotSerialized)
110	{
111		\_SB.PCI0.GFX0.INCB()
112	}
113
114#include "battery.asl"
115#include "ac.asl"
116#include "thermal.asl"
117}
118