[PATCH 2/3] acpi_video: Intel video is not always i915

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Alan Cox <alan@xxxxxxxxxxxxxxx>

Handle the GMA500/600/36x0 cases. Also stop it poking at random registers on
the i740 cards that may be out there still.

This should also allow the legacy gma500 stub driver to go away as the ACPI
video layer will now do the right thing rather than assume all the world is
Gen graphics and need the gma500 stub as a workaround.

Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
---

 drivers/acpi/video.c |   54 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 66e8f73..b2ae7aa 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1743,25 +1743,63 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
 	return 0;
 }
 
+static int __init is_gma_pvr(struct pci_dev *dev)
+{
+	/* Medfield */
+	if ((dev->device & 0xFFF8) == 0x0130)
+		return 1;
+	/* GMA36x0 */
+	if ((dev->device & 0xFFF8) == 0x0be0)
+		return 1;
+	/* GMA600 */
+	if ((dev->device & 0xFFF8) == 0x4100)
+		return 1;
+	/* GMA500 */
+	if ((dev->device & 0xFFFE) == 0x8108)
+		return 1;
+	/* E620 */
+	if (dev->device == 0x4108)
+		return 1;
+	return 0;
+}
+
+static int __init is_i740(struct pci_dev *dev)
+{
+	if (dev->device == 0x00D1)
+		return 1;
+	if (dev->device == 0x7000)
+		return 1;
+	return 0;
+}
+
 static int __init intel_opregion_present(void)
 {
-	int i915 = 0;
-#if defined(CONFIG_DRM_I915) || defined(CONFIG_DRM_I915_MODULE)
+	int opregion = 0;
 	struct pci_dev *dev = NULL;
-	u32 address;
 
 	for_each_pci_dev(dev) {
 		if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
 			continue;
 		if (dev->vendor != PCI_VENDOR_ID_INTEL)
 			continue;
-		pci_read_config_dword(dev, 0xfc, &address);
-		if (!address)
+		/* We don't want to poke around undefined i740 registers */
+		if (is_i740(dev))
 			continue;
-		i915 = 1;
-	}
+#if defined(CONFIG_DRM_GMA500) || defined(CONFIG_DRM_GMA500_MODULE)
+		if (is_gma_pvr(dev))
+			opregion = 1;
 #endif
-	return i915;
+#if defined(CONFIG_DRM_I915) || defined(CONFIG_DRM_I915_MODULE)
+		if (!is_gma_pvr(dev)) {
+			u32 address;
+			pci_read_config_dword(dev, 0xfc, &address);
+			if (!address)
+				continue;
+			opregion = 1;
+		}
+#endif
+	}
+	return opregion;
 }
 
 int acpi_video_register(void)

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux