Patchwork New patch to review: 0645233 i945 GMA: restore tft brightness from cmos

login
register
about
Submitter gerrit@coreboot.org
Date 2011-06-12 13:34:14
Message ID <E1QVknu-0005ad-W1@ra.coresystems.de>
Download mbox | patch
Permalink /patch/3114/
State New, archived
Headers show

Comments

gerrit@coreboot.org - 2011-06-12 13:34:14
Sven Schnelle (svens@stackframe.org) just uploaded a new patch set to gerrit, which you can find at
http://review.coreboot.org/24

-gerrit

Patch

commit 064523307500960ef9f4f583755db418256783cd
Author: Sven Schnelle <svens@stackframe.org>
Date:   Sun Jun 12 14:30:10 2011 +0200

    i945 GMA: restore tft brightness from cmos
    
    Change-Id: Iaf10f125425a1abcf17ffca1d6e246f955f941cc
    Signed-off-by: Sven Schnelle <svens@stackframe.org>

diff --git a/src/mainboard/lenovo/t60/cmos.layout b/src/mainboard/lenovo/t60/cmos.layout
index a946b4b..b5e3e2c 100644
--- a/src/mainboard/lenovo/t60/cmos.layout
+++ b/src/mainboard/lenovo/t60/cmos.layout
@@ -109,6 +109,7 @@  entries
 
 1060         1       e       1        touchpad
 1064         8       h       0        volume
+1072         8       h       0        tft_brightness
 # -----------------------------------------------------------------
 
 enumerations
diff --git a/src/mainboard/lenovo/t60/romstage.c b/src/mainboard/lenovo/t60/romstage.c
index b659aa8..11283fc 100644
--- a/src/mainboard/lenovo/t60/romstage.c
+++ b/src/mainboard/lenovo/t60/romstage.c
@@ -336,6 +336,4 @@  void main(unsigned long bist)
 		pci_write_config32(PCI_DEV(0, 0x00, 0), SKPAD, 0xcafed00d);
 	}
 #endif
-	/* Set legacy Brightness control to full brightness */
-	pci_write_config8(PCI_DEV(0, 2, 1), 0xf4, 0xff);
 }
diff --git a/src/mainboard/lenovo/x60/cmos.layout b/src/mainboard/lenovo/x60/cmos.layout
index 1875e59..b6914c8 100644
--- a/src/mainboard/lenovo/x60/cmos.layout
+++ b/src/mainboard/lenovo/x60/cmos.layout
@@ -107,7 +107,9 @@  entries
 1048         4       r       0        C0DRT1
 1052         4       r       0        C1DRT1
 
+# keep those offsets in sync with ACPI code!
 1064         8       h       0        volume
+1072         8       h       0        tft_brightness
 # -----------------------------------------------------------------
 
 enumerations
diff --git a/src/mainboard/lenovo/x60/romstage.c b/src/mainboard/lenovo/x60/romstage.c
index 9d01bf2..6219da4 100644
--- a/src/mainboard/lenovo/x60/romstage.c
+++ b/src/mainboard/lenovo/x60/romstage.c
@@ -338,6 +338,4 @@  void main(unsigned long bist)
 		pci_write_config32(PCI_DEV(0, 0x00, 0), SKPAD, 0xcafed00d);
 	}
 #endif
-	/* Set legacy Brightness control to full brightness */
-	pci_write_config8(PCI_DEV(0, 2, 1), 0xf4, 0xff);
 }
diff --git a/src/northbridge/intel/i945/gma.c b/src/northbridge/intel/i945/gma.c
index a43ef25..340ddcd 100644
--- a/src/northbridge/intel/i945/gma.c
+++ b/src/northbridge/intel/i945/gma.c
@@ -21,6 +21,7 @@ 
 #include <device/device.h>
 #include <device/pci.h>
 #include <device/pci_ids.h>
+#include <pc80/mc146818rtc.h>
 
 static void gma_func0_init(struct device *dev)
 {
@@ -36,11 +37,17 @@  static void gma_func0_init(struct device *dev)
 static void gma_func1_init(struct device *dev)
 {
 	u32 reg32;
+	u8 val;
 
 	/* IGD needs to be Bus Master, also enable IO accesss */
 	reg32 = pci_read_config32(dev, PCI_COMMAND);
 	pci_write_config32(dev, PCI_COMMAND, reg32 |
 			PCI_COMMAND_MASTER | PCI_COMMAND_IO);
+
+	if (!get_option(&val, "tft_brightness"))
+		pci_write_config8(dev, 0xf4, val);
+	else
+		pci_write_config8(dev, 0xf4, 0xff);
 }
 
 static void gma_set_subsystem(device_t dev, unsigned vendor, unsigned device)