From patchwork Wed Jul 29 12:27:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 51661 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 811F622DB5 for ; Wed, 29 Jul 2015 12:27:28 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf3372206lbc.0 for ; Wed, 29 Jul 2015 05:27:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=/kvVSPvpURSlbLePKx+6T30b9JSUkWdPVGMehKf51S8=; b=YMabwc/Elzoxlkm9yRCWO0EsViYD9LyjVE5nDFLRmH2tRCxA+OSJj/IxbxPnQSHW93 49alqhRCT214Rqzhu7Wazxlzw7fmlsIwhnhCNbxn74Ik8xMm0cII4fSCZs3Jhm5zA/FR gdKLwJ9wRPYMNcg4hA/gPNrDf+OUyReWJtWh6KcWniTemFmc+jVoUNPle3rU7ZiKtYbA Lul/5u6VIqcUrk/rhV53niB9RyZyeeIQ+dAP92ez2h+PhMj6HX/0f4sQk4yUTnrh/DNS CGTpNG41g4V9Y4o4O6dR/xuMZRk7cWpvsJz8hmlAZyViruKFM6b+DugAcC1nmguEocK3 FAbQ== X-Gm-Message-State: ALoCoQnHQueK3BlsyOZ9x7FH39rWQRyG3YuD3wvyhmiJ1eT6HKf29MFd2rxdxzjaoQvqy5S8Y8Yq X-Received: by 10.112.181.37 with SMTP id dt5mr16025894lbc.10.1438172847409; Wed, 29 Jul 2015 05:27:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.194 with SMTP id y2ls35543lad.16.gmail; Wed, 29 Jul 2015 05:27:27 -0700 (PDT) X-Received: by 10.112.239.43 with SMTP id vp11mr35494173lbc.75.1438172847265; Wed, 29 Jul 2015 05:27:27 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id p7si21395893lag.32.2015.07.29.05.27.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 05:27:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbbst4 with SMTP id st4so5487190lbb.1 for ; Wed, 29 Jul 2015 05:27:26 -0700 (PDT) X-Received: by 10.152.1.66 with SMTP id 2mr39318585lak.56.1438172846796; Wed, 29 Jul 2015 05:27:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp2724524lba; Wed, 29 Jul 2015 05:27:25 -0700 (PDT) X-Received: by 10.66.159.225 with SMTP id xf1mr94359268pab.50.1438172844783; Wed, 29 Jul 2015 05:27:24 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fb10si44875234pdb.169.2015.07.29.05.27.23; Wed, 29 Jul 2015 05:27:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-fbdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751473AbbG2M1X (ORCPT + 2 others); Wed, 29 Jul 2015 08:27:23 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:36513 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750883AbbG2M1W (ORCPT ); Wed, 29 Jul 2015 08:27:22 -0400 Received: by lbbud7 with SMTP id ud7so1836608lbb.3 for ; Wed, 29 Jul 2015 05:27:21 -0700 (PDT) X-Received: by 10.112.63.169 with SMTP id h9mr38770276lbs.104.1438172841012; Wed, 29 Jul 2015 05:27:21 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by smtp.gmail.com with ESMTPSA id s5sm5246750las.5.2015.07.29.05.27.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 05:27:19 -0700 (PDT) From: Linus Walleij To: linux-fbdev@vger.kernel.org, Tomi Valkeinen , Jean-Christophe Plagniol-Villard Cc: linux-arm-kernel@lists.infradead.org, Linus Walleij Subject: [PATCH 1/2] ARM: integrator: move framebuffers to driver Date: Wed, 29 Jul 2015 14:27:11 +0200 Message-Id: <1438172831-11450-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-fbdev-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Commit 11c32d7b6274cb0f554943d65bd4a126c4a86dcd "video: move Versatile CLCD helpers" already moved the CLCD mode setting helpers for Versatile and Integrator/CP to drivers/video/fbdev. Let's do the same for the IM-PD1 add-on board, copy the missing displays into the database and simplify the code. Signed-off-by: Linus Walleij --- FBDEV maintainers: requesting your ACK so I can take this into the ARM SoC tree. --- arch/arm/mach-integrator/impd1.c | 181 +++--------------------------- drivers/video/fbdev/amba-clcd-versatile.c | 80 +++++++++++++ 2 files changed, 94 insertions(+), 167 deletions(-) diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index 38b0da300dd5..f164643b7c59 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -64,131 +65,6 @@ static struct mmci_platform_data mmc_data = { /* * CLCD support */ -#define PANEL PROSPECTOR - -#define LTM10C209 1 -#define PROSPECTOR 2 -#define SVGA 3 -#define VGA 4 - -#if PANEL == VGA -#define PANELTYPE vga -static struct clcd_panel vga = { - .mode = { - .name = "VGA", - .refresh = 60, - .xres = 640, - .yres = 480, - .pixclock = 39721, - .left_margin = 40, - .right_margin = 24, - .upper_margin = 32, - .lower_margin = 11, - .hsync_len = 96, - .vsync_len = 2, - .sync = 0, - .vmode = FB_VMODE_NONINTERLACED, - }, - .width = -1, - .height = -1, - .tim2 = TIM2_BCD | TIM2_IPC, - .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), - .caps = CLCD_CAP_5551, - .connector = IMPD1_CTRL_DISP_VGA, - .bpp = 16, - .grayscale = 0, -}; - -#elif PANEL == SVGA -#define PANELTYPE svga -static struct clcd_panel svga = { - .mode = { - .name = "SVGA", - .refresh = 0, - .xres = 800, - .yres = 600, - .pixclock = 27778, - .left_margin = 20, - .right_margin = 20, - .upper_margin = 5, - .lower_margin = 5, - .hsync_len = 164, - .vsync_len = 62, - .sync = 0, - .vmode = FB_VMODE_NONINTERLACED, - }, - .width = -1, - .height = -1, - .tim2 = TIM2_BCD, - .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), - .connector = IMPD1_CTRL_DISP_VGA, - .caps = CLCD_CAP_5551, - .bpp = 16, - .grayscale = 0, -}; - -#elif PANEL == PROSPECTOR -#define PANELTYPE prospector -static struct clcd_panel prospector = { - .mode = { - .name = "PROSPECTOR", - .refresh = 0, - .xres = 640, - .yres = 480, - .pixclock = 40000, - .left_margin = 33, - .right_margin = 64, - .upper_margin = 36, - .lower_margin = 7, - .hsync_len = 64, - .vsync_len = 25, - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - .vmode = FB_VMODE_NONINTERLACED, - }, - .width = -1, - .height = -1, - .tim2 = TIM2_BCD, - .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), - .caps = CLCD_CAP_5551, - .fixedtimings = 1, - .connector = IMPD1_CTRL_DISP_LCD, - .bpp = 16, - .grayscale = 0, -}; - -#elif PANEL == LTM10C209 -#define PANELTYPE ltm10c209 -/* - * Untested. - */ -static struct clcd_panel ltm10c209 = { - .mode = { - .name = "LTM10C209", - .refresh = 0, - .xres = 640, - .yres = 480, - .pixclock = 40000, - .left_margin = 20, - .right_margin = 20, - .upper_margin = 19, - .lower_margin = 19, - .hsync_len = 20, - .vsync_len = 10, - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, - .vmode = FB_VMODE_NONINTERLACED, - }, - .width = -1, - .height = -1, - .tim2 = TIM2_BCD, - .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), - .caps = CLCD_CAP_5551, - .fixedtimings = 1, - .connector = IMPD1_CTRL_DISP_LCD, - .bpp = 16, - .grayscale = 0, -}; -#endif - /* * Disable all display connectors on the interface module. */ @@ -206,51 +82,22 @@ static void impd1fb_clcd_enable(struct clcd_fb *fb) fb->panel->connector | IMPD1_CTRL_DISP_ENABLE); } -static int impd1fb_clcd_setup(struct clcd_fb *fb) -{ - unsigned long framebase = fb->dev->res.start + 0x01000000; - unsigned long framesize = SZ_1M; - int ret = 0; +#define PANEL "PROSPECTOR" - fb->panel = &PANELTYPE; - - if (!request_mem_region(framebase, framesize, "clcd framebuffer")) { - printk(KERN_ERR "IM-PD1: unable to reserve framebuffer\n"); - return -EBUSY; - } - - fb->fb.screen_base = ioremap(framebase, framesize); - if (!fb->fb.screen_base) { - printk(KERN_ERR "IM-PD1: unable to map framebuffer\n"); - ret = -ENOMEM; - goto free_buffer; - } - - fb->fb.fix.smem_start = framebase; - fb->fb.fix.smem_len = framesize; - - return 0; - - free_buffer: - release_mem_region(framebase, framesize); - return ret; -} - -static int impd1fb_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma) +static int impd1fb_clcd_setup(struct clcd_fb *fb) { - unsigned long start, size; + fb->panel = versatile_clcd_get_panel(PANEL); - start = vma->vm_pgoff + (fb->fb.fix.smem_start >> PAGE_SHIFT); - size = vma->vm_end - vma->vm_start; + if (!fb->panel) + return -EINVAL; - return remap_pfn_range(vma, vma->vm_start, start, size, - vma->vm_page_prot); -} + if (!strcmp(PANEL, "VGA") || !strcmp(PANEL, "SVGA") || + !strcmp(PANEL, "XVGA")) + fb->panel->connector = IMPD1_CTRL_DISP_VGA; + else + fb->panel->connector = IMPD1_CTRL_DISP_LCD; -static void impd1fb_clcd_remove(struct clcd_fb *fb) -{ - iounmap(fb->fb.screen_base); - release_mem_region(fb->fb.fix.smem_start, fb->fb.fix.smem_len); + return versatile_clcd_setup_dma(fb, SZ_1M); } static struct clcd_board impd1_clcd_data = { @@ -261,8 +108,8 @@ static struct clcd_board impd1_clcd_data = { .disable = impd1fb_clcd_disable, .enable = impd1fb_clcd_enable, .setup = impd1fb_clcd_setup, - .mmap = impd1fb_clcd_mmap, - .remove = impd1fb_clcd_remove, + .mmap = versatile_clcd_mmap_dma, + .remove = versatile_clcd_remove_dma, }; struct impd1_device { diff --git a/drivers/video/fbdev/amba-clcd-versatile.c b/drivers/video/fbdev/amba-clcd-versatile.c index 7a8afcd4573e..293499981031 100644 --- a/drivers/video/fbdev/amba-clcd-versatile.c +++ b/drivers/video/fbdev/amba-clcd-versatile.c @@ -28,6 +28,31 @@ static struct clcd_panel vga = { .bpp = 16, }; +static struct clcd_panel svga = { + .mode = { + .name = "SVGA", + .refresh = 0, + .xres = 800, + .yres = 600, + .pixclock = 27778, + .left_margin = 20, + .right_margin = 20, + .upper_margin = 5, + .lower_margin = 5, + .hsync_len = 164, + .vsync_len = 62, + .sync = 0, + .vmode = FB_VMODE_NONINTERLACED, + }, + .width = -1, + .height = -1, + .tim2 = TIM2_BCD, + .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), + .caps = CLCD_CAP_5551, + .bpp = 16, + .grayscale = 0, +}; + static struct clcd_panel xvga = { .mode = { .name = "XVGA", @@ -126,12 +151,67 @@ static struct clcd_panel epson_l2f50113t00 = { .bpp = 16, }; +static struct clcd_panel prospector = { + .mode = { + .name = "PROSPECTOR", + .refresh = 0, + .xres = 640, + .yres = 480, + .pixclock = 40000, + .left_margin = 33, + .right_margin = 64, + .upper_margin = 36, + .lower_margin = 7, + .hsync_len = 64, + .vsync_len = 25, + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .vmode = FB_VMODE_NONINTERLACED, + }, + .width = -1, + .height = -1, + .tim2 = TIM2_BCD, + .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), + .caps = CLCD_CAP_5551, + .fixedtimings = 1, + .bpp = 16, + .grayscale = 0, +}; + +static struct clcd_panel ltm10c209 = { + .mode = { + .name = "LTM10C209", + .refresh = 0, + .xres = 640, + .yres = 480, + .pixclock = 40000, + .left_margin = 20, + .right_margin = 20, + .upper_margin = 19, + .lower_margin = 19, + .hsync_len = 20, + .vsync_len = 10, + .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .vmode = FB_VMODE_NONINTERLACED, + }, + .width = -1, + .height = -1, + .tim2 = TIM2_BCD, + .cntl = CNTL_LCDTFT | CNTL_LCDVCOMP(1), + .caps = CLCD_CAP_5551, + .fixedtimings = 1, + .bpp = 16, + .grayscale = 0, +}; + static struct clcd_panel *panels[] = { &vga, + &svga, &xvga, &sanyo_tm38qv67a02a, &sanyo_2_5_in, &epson_l2f50113t00, + &prospector, + <m10c209, }; struct clcd_panel *versatile_clcd_get_panel(const char *name)