Add Lenovo ThinkPad T60
[coreboot.git] / src / mainboard / lenovo / t60 / 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                            Sleep(250)
43                            /* connect dock */
44                            TRAP(SMI_DOCK_CONNECT)
45                         } else {
46                            /* disconnect dock */
47                            TRAP(SMI_DOCK_DISCONNECT)
48                         }
49
50                         Xor(Arg0, DSTA, Local0)
51                         Return (Local0)
52                 }
53
54                 Method(_STA, 0, NotSerialized)
55                 {
56                         Return (DSTA)
57                 }
58         }
59 }
60
61 Scope(\_SB.PCI0.LPCB.EC)
62 {
63         OperationRegion(PMH7, SystemIO, 0x15e0, 0x10)
64         Field(PMH7, ByteAcc, NoLock, Preserve)
65         {
66                 Offset(0x0c),
67                         PIDX, 8,
68                 Offset(0x0e),
69                         PDAT, 8,
70         }
71
72         IndexField(PIDX, PDAT, ByteAcc, NoLock, Preserve)
73         {
74                 Offset (0x61),
75                         DPWR, 1,
76         }
77
78         Method(_Q18, 0, NotSerialized)
79         {
80                Notify(\_SB.DOCK, 3)
81         }
82
83         Method(_Q37, 0, NotSerialized)
84         {
85                 if (DPWR) {
86                         Notify(\_SB.DOCK, 0)
87                 } else {
88                         Notify(\_SB.DOCK, 3)
89                 }
90         }
91 }