[PATCH] fbdev: Resurrect hooks to get EDID from firmware
authorAntonino A. Daplas <adaplas@gmail.com>
Fri, 9 Sep 2005 20:04:34 +0000 (13:04 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 9 Sep 2005 20:57:59 +0000 (13:57 -0700)
For the i386, code is already present in video.S that gets the EDID from the
video BIOS.  Make this visible so drivers can also use this data as fallback
when i2c does not work.

To ensure that the EDID block is returned for the primary graphics adapter
only, by check if the IORESOURCE_ROM_SHADOW flag is set.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/boot/video.S
arch/i386/kernel/setup.c
drivers/video/fbmon.c
include/linux/fb.h

index 02bf625a681b041af67a6fb0de21df98da61a662..92f6694701420a1ef102f9155d2c1e1c349c91f5 100644 (file)
@@ -1949,7 +1949,7 @@ store_edid:
        movw    $0x4f15, %ax                    # do VBE/DDC
        movw    $0x01, %bx
        movw    $0x00, %cx
-       movw    $0x01, %dx
+       movw    $0x00, %dx
        movw    $0x140, %di
        int     $0x10
 
index a659d274914cf26ccbc7431900d6423a391f66b1..fa0c69eb937a08af6873b0a9914af32da6fd366e 100644 (file)
@@ -139,6 +139,7 @@ struct sys_desc_table_struct {
        unsigned char table[0];
 };
 struct edid_info edid_info;
+EXPORT_SYMBOL_GPL(edid_info);
 struct ist_info ist_info;
 #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \
        defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
index c2718bb949493bc8fb6a61a7e0ef94fd281650fb..791bec3d672af47d999e798baf87760cc4b17188 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/tty.h>
 #include <linux/fb.h>
 #include <linux/module.h>
+#include <video/edid.h>
 #ifdef CONFIG_PPC_OF
 #include <linux/pci.h>
 #include <asm/prom.h>
@@ -1251,9 +1252,41 @@ int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)
                -EINVAL : 0;
 }
 
+#if defined(__i386__)
+#include <linux/pci.h>
+
+/*
+ * We need to ensure that the EDID block is only returned for
+ * the primary graphics adapter.
+ */
+
+const unsigned char *fb_firmware_edid(struct device *device)
+{
+       struct pci_dev *dev = NULL;
+       struct resource *res = NULL;
+       unsigned char *edid = NULL;
+
+       if (device)
+               dev = to_pci_dev(device);
+
+       if (dev)
+               res = &dev->resource[PCI_ROM_RESOURCE];
+
+       if (res && res->flags & IORESOURCE_ROM_SHADOW)
+               edid = edid_info.dummy;
+
+       return edid;
+}
+#else
+const unsigned char *fb_firmware_edid(struct device *device)
+{
+       return NULL;
+}
+#endif /* _i386_ */
+
 EXPORT_SYMBOL(fb_parse_edid);
 EXPORT_SYMBOL(fb_edid_to_monspecs);
-
+EXPORT_SYMBOL(fb_firmware_edid);
 EXPORT_SYMBOL(fb_get_mode);
 EXPORT_SYMBOL(fb_validate_mode);
 EXPORT_SYMBOL(fb_destroy_modedb);
index 70da819df0f537917b3ab290938421ed39c68a56..e3e16f43b1bb0564dce0f23476479eeb5d0455b1 100644 (file)
@@ -859,7 +859,9 @@ extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
 extern int fb_validate_mode(const struct fb_var_screeninfo *var,
                            struct fb_info *info);
 extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
-extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs);
+extern const unsigned char *fb_firmware_edid(struct device *device);
+extern void fb_edid_to_monspecs(unsigned char *edid,
+                               struct fb_monspecs *specs);
 extern void fb_destroy_modedb(struct fb_videomode *modedb);
 
 /* drivers/video/modedb.c */