Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] fbdev: Resurrect hooks to get EDID from firmware

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>

authored by

Antonino A. Daplas and committed by
Linus Torvalds
5e518d76 53eed4ec

+39 -3
+1 -1
arch/i386/boot/video.S
··· 1949 1949 movw $0x4f15, %ax # do VBE/DDC 1950 1950 movw $0x01, %bx 1951 1951 movw $0x00, %cx 1952 - movw $0x01, %dx 1952 + movw $0x00, %dx 1953 1953 movw $0x140, %di 1954 1954 int $0x10 1955 1955
+1
arch/i386/kernel/setup.c
··· 139 139 unsigned char table[0]; 140 140 }; 141 141 struct edid_info edid_info; 142 + EXPORT_SYMBOL_GPL(edid_info); 142 143 struct ist_info ist_info; 143 144 #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \ 144 145 defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE)
+34 -1
drivers/video/fbmon.c
··· 29 29 #include <linux/tty.h> 30 30 #include <linux/fb.h> 31 31 #include <linux/module.h> 32 + #include <video/edid.h> 32 33 #ifdef CONFIG_PPC_OF 33 34 #include <linux/pci.h> 34 35 #include <asm/prom.h> ··· 1252 1251 -EINVAL : 0; 1253 1252 } 1254 1253 1254 + #if defined(__i386__) 1255 + #include <linux/pci.h> 1256 + 1257 + /* 1258 + * We need to ensure that the EDID block is only returned for 1259 + * the primary graphics adapter. 1260 + */ 1261 + 1262 + const unsigned char *fb_firmware_edid(struct device *device) 1263 + { 1264 + struct pci_dev *dev = NULL; 1265 + struct resource *res = NULL; 1266 + unsigned char *edid = NULL; 1267 + 1268 + if (device) 1269 + dev = to_pci_dev(device); 1270 + 1271 + if (dev) 1272 + res = &dev->resource[PCI_ROM_RESOURCE]; 1273 + 1274 + if (res && res->flags & IORESOURCE_ROM_SHADOW) 1275 + edid = edid_info.dummy; 1276 + 1277 + return edid; 1278 + } 1279 + #else 1280 + const unsigned char *fb_firmware_edid(struct device *device) 1281 + { 1282 + return NULL; 1283 + } 1284 + #endif /* _i386_ */ 1285 + 1255 1286 EXPORT_SYMBOL(fb_parse_edid); 1256 1287 EXPORT_SYMBOL(fb_edid_to_monspecs); 1257 - 1288 + EXPORT_SYMBOL(fb_firmware_edid); 1258 1289 EXPORT_SYMBOL(fb_get_mode); 1259 1290 EXPORT_SYMBOL(fb_validate_mode); 1260 1291 EXPORT_SYMBOL(fb_destroy_modedb);
+3 -1
include/linux/fb.h
··· 859 859 extern int fb_validate_mode(const struct fb_var_screeninfo *var, 860 860 struct fb_info *info); 861 861 extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var); 862 - extern void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs); 862 + extern const unsigned char *fb_firmware_edid(struct device *device); 863 + extern void fb_edid_to_monspecs(unsigned char *edid, 864 + struct fb_monspecs *specs); 863 865 extern void fb_destroy_modedb(struct fb_videomode *modedb); 864 866 865 867 /* drivers/video/modedb.c */