From patchwork Sat May 28 15:06:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tormod Volden X-Patchwork-Id: 826242 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4SF4g8j018815 for ; Sat, 28 May 2011 15:06:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753608Ab1E1PGQ (ORCPT ); Sat, 28 May 2011 11:06:16 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:45277 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753586Ab1E1PGP (ORCPT ); Sat, 28 May 2011 11:06:15 -0400 Received: by wya21 with SMTP id 21so1824701wya.19 for ; Sat, 28 May 2011 08:06:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=KA2CNWTILKE0crO/Jexb8SwLCWvC4n1M545fQeM9Lss=; b=sgJ4xvk2uJPaGkxtit9vJKfRqJ0JyNi4zJFT4qnSrvPnDwH5lsbd5BJXLEw/te/RM4 vyGpUAYldu0f1rq/P2Ph9kAQGuvbBuS3lLqOULImdRf6K/G0vJwq6gRAIv7FoYRoL3Ok Wd72LZmpDzmfubV0AxAmW85Xj3fpXnpAKqNFk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=V1Osna44UIxDG6m32QARFsJ5dJxG9RhrbR4T97xilzfNpjwsXu9DXc1OGQ8MooTd6g YkpZ9zN83YHn/+5wwvBGiTfRpUp4ggDZKa5+grTPDGxWlux/bntney7BsMHmsC8VkA4W mLaAq5dK+FnhBr+Df/xeAAghC3nc4HkG1Q7z4= Received: by 10.216.221.200 with SMTP id r50mr3253729wep.102.1306595174540; Sat, 28 May 2011 08:06:14 -0700 (PDT) Received: from localhost.localdomain (80-219-113-251.dclient.hispeed.ch [80.219.113.251]) by mx.google.com with ESMTPS id r20sm1543256wec.7.2011.05.28.08.06.13 (version=SSLv3 cipher=OTHER); Sat, 28 May 2011 08:06:13 -0700 (PDT) From: Tormod Volden To: linux-fbdev@vger.kernel.org Cc: Antonino Daplas Subject: [PATCH] savagefb: Use panel CVT mode as default Date: Sat, 28 May 2011 17:06:11 +0200 Message-Id: <1306595171-18633-1-git-send-email-lists.tormod@gmail.com> X-Mailer: git-send-email 1.7.0.4 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]); Sat, 28 May 2011 15:06:16 +0000 (UTC) From: Tormod Volden If there is no EDID but an LCD panel is detected, generate a CVT mode from the panel resolution (at 60 Hz), and use this as a default mode instead of the hardcoded 800x600x8 mode. Signed-off-by: Tormod Volden --- This is maybe tight for 2.6.40, however this is long-standing issue on savage-equipped laptops: The framebuffer would default to an antiquated resolution of 800x600 instead of using the LCD panel native mode (if there is no EDID). The logic was inspired by the xorg DDX, which also feeds the panel resolution (and 60 Hz) to a CVT function to get a mode in this case. I had to export fb_find_mode_cvt() from modedb.c for this. The alternative would be to build up a string similar to the mode_option given by the user and pass this to fb_find_mode but that seems awkward. Any suggestions or comments on this? I searched a number of other drivers to see if they do something similar, but I could not find any good match. Regards, Tormod drivers/video/modedb.c | 1 + drivers/video/savage/savagefb_driver.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 48c3ea8..cb175fe 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -1128,3 +1128,4 @@ EXPORT_SYMBOL(fb_find_best_mode); EXPORT_SYMBOL(fb_find_nearest_mode); EXPORT_SYMBOL(fb_videomode_to_modelist); EXPORT_SYMBOL(fb_find_mode); +EXPORT_SYMBOL(fb_find_mode_cvt); diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 9f172fa..eddca61 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c @@ -2243,6 +2243,22 @@ static int __devinit savagefb_probe(struct pci_dev* dev, &info->modelist); #endif info->var = savagefb_var800x600x8; + /* if a panel was detected, default to a CVT mode instead */ + if (par->SavagePanelWidth) { + struct fb_videomode cvt_mode; + + memset(&cvt_mode, 0, sizeof(cvt_mode)); + cvt_mode.xres = par->SavagePanelWidth; + cvt_mode.yres = par->SavagePanelHeight; + cvt_mode.refresh = 60; + /* FIXME: if we know there is only the panel + * we can enable reduced blanking as well */ + if (fb_find_mode_cvt(&cvt_mode, 0, 0)) + printk(KERN_WARNING "No CVT mode found for panel\n"); + else if (fb_find_mode(&info->var, info, NULL, NULL, 0, + &cvt_mode, 0) != 3) + info->var = savagefb_var800x600x8; + } if (mode_option) { fb_find_mode(&info->var, info, mode_option,