igd.asl rewrite
[coreboot.git] / src / mainboard / packardbell / ms2290 / acpi / ec.asl
blobf06aba757d65687c7770e2ae640b0f2e8d6ce8d2
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (c) 2011 Sven Schnelle <svens@stackframe.org>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; version 2 of
9  * the License.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc.
19  */
21 Device(EC)
23         Name (_HID, EISAID("PNP0C09"))
24         Name (_UID, 0)
26         Name (_GPE, 0x17)
27         Mutex (ECLK, 0)
29         OperationRegion(ERAM, EmbeddedControl, 0x00, 0x100)
30         Field (ERAM, ByteAcc, NoLock, Preserve)
31         {
32                 Offset (0x8),
33                 PAGE, 8,        /* Information Page Selector */
34                 Offset (0x70),
35                     ,   1,
36                 LIDS,   1,
37                     ,   3,
38                 HPAC,   1,
39                 Offset (0x88),
40                 B0PR,   1,      /* Battery 0 present */
41                 B0CH,   1,      /* Battery 0 charging */
42                 B0DI,   1,      /* Battery 0 discharging */
43                 Offset (0xA8),
44                 TMP0,   8,
45                 TMP1,   8,
46         }
48         Device(LID)
49         {
50                 Name(_HID, "PNP0C0D")
51                 Method(_LID, 0, NotSerialized)
52                 {
53                         return (LIDS)
54                 }
55         }
57         Method(_Q52, 0, NotSerialized)
58         {
59                 Notify(LID, 0x80)
60         }
62         Method(_Q53, 0, NotSerialized)
63         {
64                 Notify(^LID, 0x80)
65         }
67         /* PAGE = 0 */
68         Field (ERAM, ByteAcc, NoLock, Preserve)
69         {
70                 Offset (0xe0),
71                 BARC, 16,               /* Battery remaining capacity */
72                 BAFC, 16,               /* Battery full charge capacity */
73                 , 16,
74                 BAPR, 16,               /* Battery present rate */
75                 BAVO, 16,               /* Battery Voltage */
76         }
78         /* PAGE = 1 */
79         Field (ERAM, ByteAcc, NoLock, Preserve)
80         {
81                 Offset (0xe0),
82                 BADC,   16,             /* Design Capacity */
83                 BADV,   16,             /* Design voltage */
84                 BASN,   16
85         }
87         /* PAGE = 2 */
88         Field (ERAM, ByteAcc, NoLock, Preserve)
89         {
90                 Offset (0xe0),
91                 BANA,   128,            /* Battery name */
92         }
94         /* PAGE = 4 */
95         Field (ERAM, ByteAcc, NoLock, Preserve)
96         {
97                 Offset (0xe0),
98                 BATY,   128,            /* Battery type */
99         }
101         /* PAGE = 5 */
102         Field (ERAM, ByteAcc, NoLock, Preserve)
103         {
104                 Offset (0xe0),
105                 BAOE,   128,            /* Battery OEM info */
106         }
108         Method (_CRS, 0)
109         {
110                 Name (ECMD, ResourceTemplate()
111                 {
112                         IO (Decode16, 0x62, 0x62, 1, 1)
113                         IO (Decode16, 0x66, 0x66, 1, 1)
114                 })
115                 Return (ECMD)
116         }
117         Method (_INI, 0, NotSerialized)
118         {
119         }
121         /* Decrease brightness.  */
122         Method(_Q1D, 0, NotSerialized)
123         {
124                 \_SB.PCI0.GFX0.DECB()
125         }
126         /* Increase brightness.  */
127         Method(_Q1C, 0, NotSerialized)
128         {
129                 \_SB.PCI0.GFX0.INCB()
130         }
132 #include "battery.asl"
133 #include "ac.asl"
134 #include "thermal.asl"