From patchwork Thu Dec 27 00:25:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Prisk X-Patchwork-Id: 1911701 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 7DB7FDF230 for ; Thu, 27 Dec 2012 00:29:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1To1IH-0004Na-Qr; Thu, 27 Dec 2012 00:25:53 +0000 Received: from server.prisktech.co.nz ([115.188.14.127]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1To1IE-0004Mz-9Q for linux-arm-kernel@lists.infradead.org; Thu, 27 Dec 2012 00:25:50 +0000 Received: from localhost.localdomain (unknown [192.168.0.102]) by server.prisktech.co.nz (Postfix) with ESMTP id 1C788FC0754; Thu, 27 Dec 2012 13:25:52 +1300 (NZDT) From: Tony Prisk To: Florian Schandinat Subject: [PATCH fix-3.8] video: vt8500: Fix X crash when initializing framebuffer. Date: Thu, 27 Dec 2012 13:25:43 +1300 Message-Id: <1356567943-3836-1-git-send-email-linux@prisktech.co.nz> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121226_192550_631597_E6FF215B X-CRM114-Status: GOOD ( 14.23 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Tony Prisk , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch adds support for .fb_check_var which is required when X attempts to initialize the framebuffer. The only supported resolution is the native resolution of the LCD panel, so we test against the resolution supplied from the DT panel definition. Signed-off-by: Tony Prisk --- drivers/video/wm8505fb.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index 77539c1..c84e376 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -41,10 +41,18 @@ #define to_wm8505fb_info(__info) container_of(__info, \ struct wm8505fb_info, fb) + +struct lcd_params { + u32 pixel_width; + u32 pixel_height; + u32 color_depth; +}; + struct wm8505fb_info { struct fb_info fb; void __iomem *regbase; unsigned int contrast; + struct lcd_params lcd_params; }; @@ -248,8 +256,21 @@ static int wm8505fb_blank(int blank, struct fb_info *info) return 0; } +static int wm8505fb_check_var(struct fb_var_screeninfo *var, + struct fb_info *info) +{ + struct wm8505fb_info *fbi = to_wm8505fb_info(info); + if (!fbi) return -EINVAL; + + if (info->var.bits_per_pixel != fbi->lcd_params.color_depth) return -EINVAL; + if (info->var.xres != fbi->lcd_params.pixel_width) return -EINVAL; + if (info->var.yres != fbi->lcd_params.pixel_height) return -EINVAL; + return 0; +} + static struct fb_ops wm8505fb_ops = { .owner = THIS_MODULE, + .fb_check_var = wm8505fb_check_var, .fb_set_par = wm8505fb_set_par, .fb_setcolreg = wm8505fb_setcolreg, .fb_fillrect = wmt_ge_fillrect, @@ -354,6 +375,10 @@ static int __devinit wm8505fb_probe(struct platform_device *pdev) goto failed_free_res; } + fbi->lcd_params.pixel_width = of_mode.xres; + fbi->lcd_params.pixel_height = of_mode.yres; + fbi->lcd_params.color_depth = bpp; + of_mode.vmode = FB_VMODE_NONINTERLACED; fb_videomode_to_var(&fbi->fb.var, &of_mode);