X60: use EC events 0x50/0x58 instead of GPIO GPE for Docking/Undocking
[coreboot.git] / src / mainboard / lenovo / x60 / acpi / dock.asl
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., 51 Franklin St, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21
22 #include "smi.h"
23
24 Scope (\_SB)
25 {
26         OperationRegion (DLPC, SystemIO, 0x164c, 1)
27         Field(DLPC, ByteAcc, NoLock, Preserve)
28         {
29                     ,   3,
30                 DSTA,   1,
31         }
32
33         Device(DOCK)
34         {
35                 Name(_HID, "ACPI0003")
36                 Name(_UID, 0x00)
37                 Name(_PCL, Package() { \_SB } )
38
39                 Method(_DCK, 1, NotSerialized)
40                 {
41                         if (Arg0) {
42                            /* connect dock */
43                            TRAP(SMI_DOCK_CONNECT)
44                         } else {
45                            /* disconnect dock */
46                            TRAP(SMI_DOCK_DISCONNECT)
47                         }
48
49                         Xor(Arg0, DSTA, Local0)
50                         Return (Local0)
51                 }
52
53                 Method(_STA, 0, NotSerialized)
54                 {
55                         Return (DSTA)
56                 }
57         }
58 }
59
60 Scope(\_SB.PCI0.LPCB.EC)
61 {
62         Method(_Q18, 0, NotSerialized)
63         {
64                Notify(\_SB.DOCK, 3)
65         }
66
67         Method(_Q50, 0, NotSerialized)
68         {
69                Notify(\_SB.DOCK, 3)
70         }
71
72         Method(_Q58, 0, NotSerialized)
73         {
74                Notify(\_SB.DOCK, 0)
75         }
76
77 }