From patchwork Fri Aug 26 12:38:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 1102172 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7QCd8Yn030363 for ; Fri, 26 Aug 2011 12:39:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752796Ab1HZMjH (ORCPT ); Fri, 26 Aug 2011 08:39:07 -0400 Received: from na3sys009aog111.obsmtp.com ([74.125.149.205]:37021 "EHLO na3sys009aog111.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808Ab1HZMjG (ORCPT ); Fri, 26 Aug 2011 08:39:06 -0400 Received: from mail-bw0-f52.google.com ([209.85.214.52]) (using TLSv1) by na3sys009aob111.postini.com ([74.125.148.12]) with SMTP ID DSNKTleT6Cubl85qNQYzy47sc+cS6s7hFPAe@postini.com; Fri, 26 Aug 2011 05:39:06 PDT Received: by mail-bw0-f52.google.com with SMTP id zs2so4179863bkb.39 for ; Fri, 26 Aug 2011 05:39:04 -0700 (PDT) Received: by 10.204.6.201 with SMTP id a9mr528985bka.335.1314362344596; Fri, 26 Aug 2011 05:39:04 -0700 (PDT) Received: from localhost.localdomain (a62-248-128-208.elisa-laajakaista.fi [62.248.128.208]) by mx.google.com with ESMTPS id zy14sm62227bkb.23.2011.08.26.05.39.02 (version=SSLv3 cipher=OTHER); Fri, 26 Aug 2011 05:39:03 -0700 (PDT) From: Tomi Valkeinen To: linux-fbdev@vger.kernel.org Cc: Tomi Valkeinen Subject: [PATCH] fbdev: fix parsing of standard timings Date: Fri, 26 Aug 2011 15:38:48 +0300 Message-Id: <1314362328-30456-1-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 26 Aug 2011 12:39:08 +0000 (UTC) The standard timings parses uses 1:1 dimensions when the ratio in the EDID data is 0. However, for EDID 1.3 and later the dimensions are 16:10 when the ratio is 0. Pass the version and revision numbers to get_std_timing() which can then make the right decision about dimensions. Signed-off-by: Tomi Valkeinen --- drivers/video/fbmon.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c index 4f57485..6a6f92e 100644 --- a/drivers/video/fbmon.c +++ b/drivers/video/fbmon.c @@ -493,7 +493,8 @@ static int get_est_timing(unsigned char *block, struct fb_videomode *mode) return num; } -static int get_std_timing(unsigned char *block, struct fb_videomode *mode) +static int get_std_timing(unsigned char *block, struct fb_videomode *mode, + int ver, int rev) { int xres, yres = 0, refresh, ratio, i; @@ -504,7 +505,10 @@ static int get_std_timing(unsigned char *block, struct fb_videomode *mode) ratio = (block[1] & 0xc0) >> 6; switch (ratio) { case 0: - yres = xres; + if (ver < 1 || (ver == 1 && rev < 3)) + yres = xres; + else + yres = (xres * 10)/16; break; case 1: yres = (xres * 3)/4; @@ -533,12 +537,12 @@ static int get_std_timing(unsigned char *block, struct fb_videomode *mode) } static int get_dst_timing(unsigned char *block, - struct fb_videomode *mode) + struct fb_videomode *mode, int ver, int rev) { int j, num = 0; for (j = 0; j < 6; j++, block += STD_TIMING_DESCRIPTION_SIZE) - num += get_std_timing(block, &mode[num]); + num += get_std_timing(block, &mode[num], ver, rev); return num; } @@ -599,6 +603,10 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize) struct fb_videomode *mode, *m; unsigned char *block; int num = 0, i, first = 1; + int ver, rev; + + ver = edid[EDID_STRUCT_VERSION]; + rev = edid[EDID_STRUCT_REVISION]; mode = kzalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL); if (mode == NULL) @@ -632,12 +640,12 @@ static struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize) DPRINTK(" Standard Timings\n"); block = edid + STD_TIMING_DESCRIPTIONS_START; for (i = 0; i < STD_TIMING; i++, block += STD_TIMING_DESCRIPTION_SIZE) - num += get_std_timing(block, &mode[num]); + num += get_std_timing(block, &mode[num], ver, rev); block = edid + DETAILED_TIMING_DESCRIPTIONS_START; for (i = 0; i < 4; i++, block+= DETAILED_TIMING_DESCRIPTION_SIZE) { if (block[0] == 0x00 && block[1] == 0x00 && block[3] == 0xfa) - num += get_dst_timing(block + 5, &mode[num]); + num += get_dst_timing(block + 5, &mode[num], ver, rev); } /* Yikes, EDID data is totally useless */