From patchwork Fri Jul 22 13:54:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Murzin X-Patchwork-Id: 9243669 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6614A602F0 for ; Fri, 22 Jul 2016 13:55:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 569E527D8D for ; Fri, 22 Jul 2016 13:55:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49B2327FA7; Fri, 22 Jul 2016 13:55:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1A5127D8D for ; Fri, 22 Jul 2016 13:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754332AbcGVNzd (ORCPT ); Fri, 22 Jul 2016 09:55:33 -0400 Received: from foss.arm.com ([217.140.101.70]:53150 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754021AbcGVNzd (ORCPT ); Fri, 22 Jul 2016 09:55:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8EEEC434; Fri, 22 Jul 2016 06:56:44 -0700 (PDT) Received: from bc-d3-1-5.euhpc.arm.com. (bc-d3-1-5.euhpc.arm.com [10.6.16.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C34E53F215; Fri, 22 Jul 2016 06:55:31 -0700 (PDT) From: Vladimir Murzin To: linux-fbdev@vger.kernel.org Cc: tomi.valkeinen@ti.com, plagnioj@jcrosoft.com Subject: [PATCH 2/3] fbdev: vfb: add option for video mode Date: Fri, 22 Jul 2016 14:54:55 +0100 Message-Id: <1469195696-14753-3-git-send-email-vladimir.murzin@arm.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1469195696-14753-1-git-send-email-vladimir.murzin@arm.com> References: <1469195696-14753-1-git-send-email-vladimir.murzin@arm.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make vfb a bit more flexible in sense what it can represent and allow the end user to specify video mode parameters via newly introduced module option "mode". Since it is test module it is still up to the end user to make sure there is enough memory to satisfy video mode settings. Signed-off-by: Vladimir Murzin --- drivers/video/fbdev/vfb.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/video/fbdev/vfb.c b/drivers/video/fbdev/vfb.c index e9ecae2..2645875 100644 --- a/drivers/video/fbdev/vfb.c +++ b/drivers/video/fbdev/vfb.c @@ -37,6 +37,10 @@ static u_long videomemorysize = VIDEOMEMSIZE; module_param(videomemorysize, ulong, 0); MODULE_PARM_DESC(videomemorysize, "RAM available to frame buffer (in bytes)"); +static char *mode_option; +module_param(mode_option, charp, 0); +MODULE_PARM_DESC(mode_option, "Preferred video mode (e.g. 640x480-8@60)"); + /********************************************************************** * * Memory management @@ -86,26 +90,17 @@ static void rvfree(void *mem, unsigned long size) vfree(mem); } -static struct fb_var_screeninfo vfb_default = { +static struct fb_videomode vfb_default = { .xres = 640, .yres = 480, - .xres_virtual = 640, - .yres_virtual = 480, - .bits_per_pixel = 8, - .red = { 0, 8, 0 }, - .green = { 0, 8, 0 }, - .blue = { 0, 8, 0 }, - .activate = FB_ACTIVATE_TEST, - .height = -1, - .width = -1, - .pixclock = 20000, - .left_margin = 64, - .right_margin = 64, - .upper_margin = 32, - .lower_margin = 32, - .hsync_len = 64, - .vsync_len = 2, - .vmode = FB_VMODE_NONINTERLACED, + .pixclock = 20000, + .left_margin = 64, + .right_margin = 64, + .upper_margin = 32, + .lower_margin = 32, + .hsync_len = 64, + .vsync_len = 2, + .vmode = FB_VMODE_NONINTERLACED, }; static struct fb_fix_screeninfo vfb_fix = { @@ -479,6 +474,8 @@ static int __init vfb_setup(char *options) /* Test disable for backwards compatibility */ if (!strcmp(this_opt, "disable")) vfb_enable = 0; + else + mode_option = this_opt; } return 1; } @@ -506,11 +503,13 @@ static int vfb_probe(struct platform_device *dev) info->screen_base = (char __iomem *)videomemory; info->fbops = &vfb_ops; - retval = fb_find_mode(&info->var, info, NULL, - NULL, 0, NULL, 8); + if (!fb_find_mode(&info->var, info, mode_option, + NULL, 0, &vfb_default, 8)){ + fb_err(info, "Unable to find usable video mode.\n"); + retval = -EINVAL; + goto err1; + } - if (!retval || (retval == 4)) - info->var = vfb_default; vfb_fix.smem_start = (unsigned long) videomemory; vfb_fix.smem_len = videomemorysize; info->fix = vfb_fix;