From patchwork Sat Feb 15 05:56:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Shiyan X-Patchwork-Id: 3655681 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3B75F9F3B2 for ; Sat, 15 Feb 2014 05:59:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2DA1F2020E for ; Sat, 15 Feb 2014 05:59:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2CE4A20203 for ; Sat, 15 Feb 2014 05:59:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750995AbaBOF7P (ORCPT ); Sat, 15 Feb 2014 00:59:15 -0500 Received: from fallback6.mail.ru ([94.100.176.134]:36485 "EHLO fallback6.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750983AbaBOF7O (ORCPT ); Sat, 15 Feb 2014 00:59:14 -0500 Received: from smtp25.mail.ru (smtp25.mail.ru [94.100.176.178]) by fallback6.mail.ru (mPOP.Fallback_MX) with ESMTP id DCCDA3175FBC for ; Sat, 15 Feb 2014 09:59:12 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail2; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=bc12OMM6JgCs4IE45gp4Hk8+61vUPJ3qBmHqkTOYkD0=; b=PrLxCg3Dkjg6L8qJ2tYce3Kku9js58d0II7vLd3pVYvZaF9TExFHrkWL+eJ+ZbYuoR02YWGOZg5aUuQptyeuBZ3FIMkyw0V7t9Yc52UPDuV/eYCw5pIyrb36cNBPyDek+Djqzqw0pKDlcfLSIc5gCBQPxeqcEaEKOL/lvCHjhz8=; Received: from [188.134.40.128] (port=53872 helo=shc.zet) by smtp25.mail.ru with esmtpa (envelope-from ) id 1WEYEz-00010T-O6; Sat, 15 Feb 2014 09:56:42 +0400 From: Alexander Shiyan To: linux-fbdev@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Sascha Hauer , Alexander Shiyan Subject: [PATCH 2/5] video: imxfb: Remove unused fields from platform data structure Date: Sat, 15 Feb 2014 09:56:23 +0400 Message-Id: <1392443786-30527-2-git-send-email-shc_work@mail.ru> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392443786-30527-1-git-send-email-shc_work@mail.ru> References: <1392443786-30527-1-git-send-email-shc_work@mail.ru> X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Mras: Ok Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RDNS_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some fields in platform data structure is never used by boards. This patch removes these fields and as a result optimizes private driver structure a bit. Additionally patch removes backligh_power() callback, so if it will be needed in the future, this feature should be added as pwm{gpio,etc.}-regulator to the board code or in the DTS. Signed-off-by: Alexander Shiyan --- drivers/video/imxfb.c | 64 ++++++++----------------------- include/linux/platform_data/video-imxfb.h | 10 ----- 2 files changed, 17 insertions(+), 57 deletions(-) diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index e50b67f..5b07053 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -156,11 +156,8 @@ struct imxfb_info { * the framebuffer memory region to. */ dma_addr_t map_dma; - u_char *map_cpu; u_int map_size; - u_char *screen_cpu; - dma_addr_t screen_dma; u_int palette_size; dma_addr_t dbar1; @@ -170,9 +167,8 @@ struct imxfb_info { u_int pwmr; u_int lscr1; u_int dmacr; - u_int cmap_inverse:1, - cmap_static:1, - unused:30; + bool cmap_inverse; + bool cmap_static; struct imx_fb_videomode *mode; int num_modes; @@ -180,8 +176,6 @@ struct imxfb_info { struct backlight_device *bl; #endif - void (*backlight_power)(int); - struct regulator *lcd_pwr; }; @@ -573,7 +567,7 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) pr_debug("Enabling LCD controller\n"); - writel(fbi->screen_dma, fbi->regs + LCDC_SSA); + writel(fbi->map_dma, fbi->regs + LCDC_SSA); /* panning offset 0 (0 pixel offset) */ writel(0x00000000, fbi->regs + LCDC_POS); @@ -592,9 +586,6 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) clk_prepare_enable(fbi->clk_ahb); clk_prepare_enable(fbi->clk_per); fbi->enabled = true; - - if (fbi->backlight_power) - fbi->backlight_power(1); } static void imxfb_disable_controller(struct imxfb_info *fbi) @@ -604,9 +595,6 @@ static void imxfb_disable_controller(struct imxfb_info *fbi) pr_debug("Disabling LCD controller\n"); - if (fbi->backlight_power) - fbi->backlight_power(0); - clk_disable_unprepare(fbi->clk_per); clk_disable_unprepare(fbi->clk_ipg); clk_disable_unprepare(fbi->clk_ahb); @@ -790,13 +778,9 @@ static int imxfb_init_fbinfo(struct platform_device *pdev) info->flags = FBINFO_FLAG_DEFAULT | FBINFO_READS_FAST; if (pdata) { - info->var.grayscale = pdata->cmap_greyscale; - fbi->cmap_inverse = pdata->cmap_inverse; - fbi->cmap_static = pdata->cmap_static; fbi->lscr1 = pdata->lscr1; fbi->dmacr = pdata->dmacr; fbi->pwmr = pdata->pwmr; - fbi->backlight_power = pdata->backlight_power; } else { np = pdev->dev.of_node; info->var.grayscale = of_property_read_bool(np, @@ -808,8 +792,6 @@ static int imxfb_init_fbinfo(struct platform_device *pdev) of_property_read_u32(np, "fsl,lscr1", &fbi->lscr1); of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr); - - fbi->backlight_power = NULL; } return 0; @@ -1003,32 +985,18 @@ static int imxfb_probe(struct platform_device *pdev) goto failed_ioremap; } - /* Seems not being used by anyone, so no support for oftree */ - if (!pdata || !pdata->fixed_screen_cpu) { - fbi->map_size = PAGE_ALIGN(info->fix.smem_len); - fbi->map_cpu = dma_alloc_writecombine(&pdev->dev, - fbi->map_size, &fbi->map_dma, GFP_KERNEL); + fbi->map_size = PAGE_ALIGN(info->fix.smem_len); + info->screen_base = dma_alloc_writecombine(&pdev->dev, fbi->map_size, + &fbi->map_dma, GFP_KERNEL); - if (!fbi->map_cpu) { - dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret); - ret = -ENOMEM; - goto failed_map; - } - - info->screen_base = fbi->map_cpu; - fbi->screen_cpu = fbi->map_cpu; - fbi->screen_dma = fbi->map_dma; - info->fix.smem_start = fbi->screen_dma; - } else { - /* Fixed framebuffer mapping enables location of the screen in eSRAM */ - fbi->map_cpu = pdata->fixed_screen_cpu; - fbi->map_dma = pdata->fixed_screen_dma; - info->screen_base = fbi->map_cpu; - fbi->screen_cpu = fbi->map_cpu; - fbi->screen_dma = fbi->map_dma; - info->fix.smem_start = fbi->screen_dma; + if (!info->screen_base) { + dev_err(&pdev->dev, "Failed to allocate video RAM: %d\n", ret); + ret = -ENOMEM; + goto failed_map; } + info->fix.smem_start = fbi->map_dma; + if (pdata && pdata->init) { ret = pdata->init(fbi->pdev); if (ret) @@ -1087,9 +1055,8 @@ failed_cmap: if (pdata && pdata->exit) pdata->exit(fbi->pdev); failed_platform_init: - if (pdata && !pdata->fixed_screen_cpu) - dma_free_writecombine(&pdev->dev,fbi->map_size,fbi->map_cpu, - fbi->map_dma); + dma_free_writecombine(&pdev->dev, fbi->map_size, info->screen_base, + fbi->map_dma); failed_map: iounmap(fbi->regs); failed_ioremap: @@ -1127,6 +1094,9 @@ static int imxfb_remove(struct platform_device *pdev) kfree(info->pseudo_palette); framebuffer_release(info); + dma_free_writecombine(&pdev->dev, fbi->map_size, info->screen_base, + fbi->map_dma); + iounmap(fbi->regs); release_mem_region(res->start, resource_size(res)); diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h index dd1bed9..18e9083 100644 --- a/include/linux/platform_data/video-imxfb.h +++ b/include/linux/platform_data/video-imxfb.h @@ -61,22 +61,12 @@ struct imx_fb_platform_data { struct imx_fb_videomode *mode; int num_modes; - u_int cmap_greyscale:1, - cmap_inverse:1, - cmap_static:1, - unused:29; - u_int pwmr; u_int lscr1; u_int dmacr; - u_char * fixed_screen_cpu; - dma_addr_t fixed_screen_dma; - int (*init)(struct platform_device *); void (*exit)(struct platform_device *); - - void (*backlight_power)(int); }; #endif /* ifndef __MACH_IMXFB_H__ */