[coreboot-gerrit] Patch set updated for coreboot: b9b253d lenovo/x200: Dock support

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Tue Aug 19 00:49:44 CEST 2014


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6705

-gerrit

commit b9b253d4583646bd6463c328d8d68432168ad60c
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Mon Aug 18 23:52:53 2014 +0200

    lenovo/x200: Dock support
    
    Change-Id: I4e25630ae82e8030a9d6bfccb60844c301b1d635
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 src/mainboard/lenovo/x200/acpi/dock.asl | 78 +++++++++++++++++++++++++++++++++
 src/mainboard/lenovo/x200/dock.c        | 10 ++---
 src/mainboard/lenovo/x200/dsdt.asl      |  3 ++
 3 files changed, 86 insertions(+), 5 deletions(-)

diff --git a/src/mainboard/lenovo/x200/acpi/dock.asl b/src/mainboard/lenovo/x200/acpi/dock.asl
new file mode 100644
index 0000000..e742c43
--- /dev/null
+++ b/src/mainboard/lenovo/x200/acpi/dock.asl
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (c) 2011 Sven Schnelle <svens at stackframe.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+Scope (\_SB)
+{
+	Device(DOCK)
+	{
+		Name(_HID, "ACPI0003")
+		Name(_UID, 0x00)
+		Name(_PCL, Package() { \_SB } )
+
+		Method(_DCK, 1, NotSerialized)
+		{
+			if (Arg0) {
+			   /* connect dock */
+			   Store (1, \GP28)
+			   Store (1, \_SB.PCI0.LPCB.EC.DKR1)
+			} else {
+			   /* disconnect dock */
+			   Store (0, \GP28)
+			   Store (0, \_SB.PCI0.LPCB.EC.DKR1)
+			}
+			Xor(Arg0, \_SB.PCI0.LPCB.EC.DKR1, Local0)
+			Return (Local0)
+		}
+
+		Method(_STA, 0, NotSerialized)
+		{
+			Return (\_SB.PCI0.LPCB.EC.DKR1)
+		}
+	}
+}
+
+Scope(\_SB.PCI0.LPCB.EC)
+{
+	Method(_Q18, 0, NotSerialized)
+	{
+		Notify(\_SB.DOCK, 3)
+	}
+
+	Method(_Q45, 0, NotSerialized)
+	{
+		Notify(\_SB.DOCK, 3)
+	}
+
+	Method(_Q50, 0, NotSerialized)
+	{
+		Notify(\_SB.DOCK, 3)
+	}
+
+	Method(_Q58, 0, NotSerialized)
+	{
+		Notify(\_SB.DOCK, 0)
+	}
+
+	Method(_Q37, 0, NotSerialized)
+	{
+		Notify(\_SB.DOCK, 0)
+	}
+}
diff --git a/src/mainboard/lenovo/x200/dock.c b/src/mainboard/lenovo/x200/dock.c
index 5b23f87..6f9e953 100644
--- a/src/mainboard/lenovo/x200/dock.c
+++ b/src/mainboard/lenovo/x200/dock.c
@@ -44,16 +44,16 @@ void h8_mainboard_init_dock (void)
 
 void dock_connect(void)
 {
+	u16 gpiobase = pci_read_config16(LPC_DEV, D31F0_GPIO_BASE) & 0xfffc;
 	ec_set_bit(0x02, 0);
-	ec_set_bit(0x1a, 0);
-	ec_set_bit(0xfe, 4);
+	outl(inl(gpiobase + 0x0c) | (1 << 28), gpiobase + 0x0c);
 }
 
 void dock_disconnect(void)
 {
+	u16 gpiobase = pci_read_config16(LPC_DEV, D31F0_GPIO_BASE) & 0xfffc;
 	ec_clr_bit(0x02, 0);
-	ec_clr_bit(0x1a, 0);
-	ec_clr_bit(0xfe, 4);
+	outl(inl(gpiobase + 0x0c) & ~(1 << 28), gpiobase + 0x0c);
 }
 
 int dock_present(void)
@@ -61,5 +61,5 @@ int dock_present(void)
 	u16 gpiobase = pci_read_config16(LPC_DEV, D31F0_GPIO_BASE) & 0xfffc;
 	u8 st = inb(gpiobase + 0x0c);
 
-	return !((st >> 3) & 1);
+	return ((st >> 2) & 7) != 7;
 }
diff --git a/src/mainboard/lenovo/x200/dsdt.asl b/src/mainboard/lenovo/x200/dsdt.asl
index 8d06e24..bcfe47d 100644
--- a/src/mainboard/lenovo/x200/dsdt.asl
+++ b/src/mainboard/lenovo/x200/dsdt.asl
@@ -56,4 +56,7 @@ DefinitionBlock(
 
 	/* Chipset specific sleep states */
 	#include <southbridge/intel/i82801ix/acpi/sleepstates.asl>
+
+	/* Dock support code */
+	#include "acpi/dock.asl"
 }



More information about the coreboot-gerrit mailing list