From patchwork Fri Mar 22 14:15:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 2320471 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 102AA400E6 for ; Fri, 22 Mar 2013 14:15:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933135Ab3CVOPb (ORCPT ); Fri, 22 Mar 2013 10:15:31 -0400 Received: from gloria.sntech.de ([95.129.55.99]:40362 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932116Ab3CVOP3 (ORCPT ); Fri, 22 Mar 2013 10:15:29 -0400 Received: from 146-52-57-5-dynip.superkabel.de ([146.52.57.5] helo=marty.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1UJ2ki-00081n-OU; Fri, 22 Mar 2013 15:15:28 +0100 From: Heiko =?utf-8?q?St=C3=BCbner?= To: Florian Tobias Schandinat Subject: [PATCH 5/9] AUO-K190x: move var resolution-handling into check_var Date: Fri, 22 Mar 2013 15:15:27 +0100 User-Agent: KMail/1.13.7 (Linux/3.2.0-3-686-pae; KDE/4.8.4; i686; ; ) Cc: Tomi Valkeinen , "linux-fbdev" References: <201303221512.28604.heiko@sntech.de> In-Reply-To: <201303221512.28604.heiko@sntech.de> MIME-Version: 1.0 Message-Id: <201303221515.27264.heiko@sntech.de> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Provides a central place for this, which will be helpful for the following changes. Signed-off-by: Heiko Stübner --- drivers/video/auo_k190x.c | 43 ++++++++++++++++++++++--------------------- 1 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/video/auo_k190x.c b/drivers/video/auo_k190x.c index 9cd9b7e..7f4c4ef 100644 --- a/drivers/video/auo_k190x.c +++ b/drivers/video/auo_k190x.c @@ -376,16 +376,25 @@ static int auok190xfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { struct device *dev = info->device; + struct auok190xfb_par *par = info->par; + struct panel_info *panel = &panel_table[par->resolution]; int size; - if (info->var.xres != var->xres || info->var.yres != var->yres || - info->var.xres_virtual != var->xres_virtual || - info->var.yres_virtual != var->yres_virtual) { - pr_info("%s: Resolution not supported: X%u x Y%u\n", - __func__, var->xres, var->yres); - return -EINVAL; + /* + * Dimensions + */ + + if (par->rotation & 1) { + var->xres = panel->h; + var->yres = panel->w; + } else { + var->xres = panel->w; + var->yres = panel->h; } + var->xres_virtual = var->xres; + var->yres_virtual = var->yres; + /* * Memory limit */ @@ -899,21 +908,6 @@ int __devinit auok190x_common_probe(struct platform_device *pdev, panel = &panel_table[board->resolution]; - /* if 90 degree rotation, switch width and height */ - if (board->rotation & 1) { - info->var.xres = panel->h; - info->var.yres = panel->w; - info->var.xres_virtual = panel->h; - info->var.yres_virtual = panel->w; - info->fix.line_length = panel->h * info->var.bits_per_pixel / 8; - } else { - info->var.xres = panel->w; - info->var.yres = panel->h; - info->var.xres_virtual = panel->w; - info->var.yres_virtual = panel->h; - info->fix.line_length = panel->w * info->var.bits_per_pixel / 8; - } - par->resolution = board->resolution; par->rotation = board->rotation; @@ -934,6 +928,13 @@ int __devinit auok190x_common_probe(struct platform_device *pdev, info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; info->fbops = &auok190xfb_ops; + ret = auok190xfb_check_var(&info->var, info); + if (ret) + goto err_defio; + + info->fix.line_length = info->var.xres_virtual * + info->var.bits_per_pixel / 8; + /* deferred io init */ info->fbdefio = devm_kzalloc(info->device,