From patchwork Tue Aug 19 18:23:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 4745361 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD4D6C0338 for ; Tue, 19 Aug 2014 18:23:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C195F200FE for ; Tue, 19 Aug 2014 18:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9421A20155 for ; Tue, 19 Aug 2014 18:23:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751625AbaHSSXc (ORCPT ); Tue, 19 Aug 2014 14:23:32 -0400 Received: from mail-by2lp0242.outbound.protection.outlook.com ([207.46.163.242]:7932 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751496AbaHSSXb (ORCPT ); Tue, 19 Aug 2014 14:23:31 -0400 Received: from BN3PR0301CA0060.namprd03.prod.outlook.com (25.160.152.156) by BL2PR03MB243.namprd03.prod.outlook.com (10.255.231.23) with Microsoft SMTP Server (TLS) id 15.0.1010.18; Tue, 19 Aug 2014 18:23:23 +0000 Received: from BN1AFFO11FD048.protection.gbl (2a01:111:f400:7c10::158) by BN3PR0301CA0060.outlook.office365.com (2a01:111:e400:401e::28) with Microsoft SMTP Server (TLS) id 15.0.1010.18 via Frontend Transport; Tue, 19 Aug 2014 18:23:23 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD048.mail.protection.outlook.com (10.58.53.63) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Tue, 19 Aug 2014 18:23:23 +0000 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.244.72]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s7JINHjD015518; Tue, 19 Aug 2014 11:23:18 -0700 From: Fabio Estevam To: CC: , , , Fabio Estevam Subject: [RFC] fbdev: mxsfb: Add support for mx6sl and mx6sx Date: Tue, 19 Aug 2014 15:23:07 -0300 Message-ID: <1408472587-4998-1-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.9.1 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019006)(6009001)(189002)(199003)(105606002)(2351001)(77982001)(229853001)(85306004)(83072002)(110136001)(64706001)(33646002)(92726001)(106466001)(104016003)(36756003)(68736004)(50226001)(47776003)(80022001)(20776003)(74502001)(107046002)(86362001)(46102001)(48376002)(31966008)(95666004)(74662001)(21056001)(89996001)(85852003)(93916002)(77156001)(81156004)(87286001)(26826002)(76482001)(87936001)(88136002)(79102001)(84676001)(81542001)(102836001)(62966002)(104166001)(81342001)(19580405001)(92566001)(50466002)(50986999)(99396002)(97736001)(69596002)(4396001)(83322001)(6806004)(19580395003)(44976005)(32563001); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR03MB243; H:az84smr01.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 0308EE423E Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Fabio.Estevam@freescale.com; X-OriginatorOrg: freescale.com Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 mx6sl and mx6sx share the same LCD controller as mx23 and mx28. Add support for it. The basic difference is the number of clocks that are required: - mx23/mx28: only one clock - mx6sl: two clocks - mx6sx: three clocks Tested on a mx28evk and mx6slevk. Signed-off-by: Fabio Estevam --- I am sending it as RFC because the scrolling is showing some artifacts when I boot with console=tty0. The kernel messages are displayed correctly, but when it scrolls I see some garbage. Appreciate any comment/suggestion to improve this. drivers/video/fbdev/Kconfig | 2 +- drivers/video/fbdev/mxsfb.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index e911b9c..fd28987 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -2420,7 +2420,7 @@ config FB_JZ4740 config FB_MXS tristate "MXS LCD framebuffer support" - depends on FB && ARCH_MXS + depends on FB && (ARCH_MXS || ARCH_MXC) select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT diff --git a/drivers/video/fbdev/mxsfb.c b/drivers/video/fbdev/mxsfb.c index accf48a2..a567cc6 100644 --- a/drivers/video/fbdev/mxsfb.c +++ b/drivers/video/fbdev/mxsfb.c @@ -172,6 +172,10 @@ struct mxsfb_info { struct fb_info fb_info; struct platform_device *pdev; struct clk *clk; + struct clk *clk_axi; + struct clk *clk_disp_axi; + bool clk_axi_enabled; + bool clk_disp_axi_enabled; void __iomem *base; /* registers */ unsigned allocated_size; int enabled; @@ -185,6 +189,42 @@ struct mxsfb_info { #define mxsfb_is_v3(host) (host->devdata->ipversion == 3) #define mxsfb_is_v4(host) (host->devdata->ipversion == 4) +/* Enable lcdif axi clock */ +static inline void clk_enable_axi(struct mxsfb_info *host) +{ + if (!host->clk_axi_enabled && (!IS_ERR(host->clk_axi))) { + clk_prepare_enable(host->clk_axi); + host->clk_axi_enabled = true; + } +} + +/* Disable lcdif axi clock */ +static inline void clk_disable_axi(struct mxsfb_info *host) +{ + if (host->clk_axi_enabled && (!IS_ERR(host->clk_axi))) { + clk_disable_unprepare(host->clk_axi); + host->clk_axi_enabled = false; + } +} + +/* Enable DISP axi clock */ +static inline void clk_enable_disp_axi(struct mxsfb_info *host) +{ + if (!host->clk_disp_axi_enabled && (!IS_ERR(host->clk_disp_axi))) { + clk_prepare_enable(host->clk_disp_axi); + host->clk_disp_axi_enabled = true; + } +} + +/* Disable DISP axi clock */ +static inline void clk_disable_disp_axi(struct mxsfb_info *host) +{ + if (host->clk_disp_axi_enabled && (!IS_ERR(host->clk_disp_axi))) { + clk_disable_unprepare(host->clk_disp_axi); + host->clk_disp_axi_enabled = false; + } +} + static const struct mxsfb_devdata mxsfb_devdata[] = { [MXSFB_V3] = { .transfer_count = LCDC_V3_TRANSFER_COUNT, @@ -331,6 +371,8 @@ static void mxsfb_enable_controller(struct fb_info *fb_info) } } + clk_enable_axi(host); + clk_enable_disp_axi(host); clk_prepare_enable(host->clk); clk_set_rate(host->clk, PICOS2KHZ(fb_info->var.pixclock) * 1000U); @@ -374,6 +416,8 @@ static void mxsfb_disable_controller(struct fb_info *fb_info) writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4); clk_disable_unprepare(host->clk); + clk_disable_disp_axi(host); + clk_disable_axi(host); host->enabled = 0; @@ -867,6 +911,9 @@ static int mxsfb_probe(struct platform_device *pdev) goto fb_release; } + host->clk_axi = devm_clk_get(&host->pdev->dev, "axi"); + host->clk_disp_axi = devm_clk_get(&host->pdev->dev, "disp_axi"); + host->reg_lcd = devm_regulator_get(&pdev->dev, "lcd"); if (IS_ERR(host->reg_lcd)) host->reg_lcd = NULL;