aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/fbmon.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 563a98b88e9b..a0b5a93b72d2 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -973,6 +973,63 @@ void fb_edid_to_monspecs(unsigned char *edid, struct fb_monspecs *specs)
973 DPRINTK("========================================\n"); 973 DPRINTK("========================================\n");
974} 974}
975 975
976void fb_edid_add_monspecs(unsigned char *edid, struct fb_monspecs *specs)
977{
978 unsigned char *block;
979 struct fb_videomode *mode, *m;
980 int num = 0, i, first = 1;
981
982 if (edid == NULL)
983 return;
984
985 if (!edid_checksum(edid))
986 return;
987
988 if (edid[0] != 0x2)
989 return;
990
991 mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL);
992 if (mode == NULL)
993 return;
994
995 block = edid + edid[0x2];
996
997 DPRINTK(" Extended Detailed Timings\n");
998
999 for (i = 0; i < (128 - edid[0x2]) / DETAILED_TIMING_DESCRIPTION_SIZE;
1000 i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) {
1001 if (!(block[0] == 0x00 && block[1] == 0x00)) {
1002 get_detailed_timing(block, &mode[num]);
1003 if (first) {
1004 mode[num].flag |= FB_MODE_IS_FIRST;
1005 first = 0;
1006 }
1007 num++;
1008 }
1009 }
1010
1011 /* Yikes, EDID data is totally useless */
1012 if (!num) {
1013 kfree(mode);
1014 return;
1015 }
1016
1017 m = kzalloc((specs->modedb_len + num) *
1018 sizeof(struct fb_videomode), GFP_KERNEL);
1019
1020 if (!m) {
1021 kfree(mode);
1022 return;
1023 }
1024
1025 memmove(m, specs->modedb, specs->modedb_len * sizeof(struct fb_videomode));
1026 memmove(m + specs->modedb_len, mode, num * sizeof(struct fb_videomode));
1027 kfree(mode);
1028 kfree(specs->modedb);
1029 specs->modedb = m;
1030 specs->modedb_len = specs->modedb_len + num;
1031}
1032
976/* 1033/*
977 * VESA Generalized Timing Formula (GTF) 1034 * VESA Generalized Timing Formula (GTF)
978 */ 1035 */