From patchwork Wed Oct 23 08:29:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis Carikli X-Patchwork-Id: 3086741 Return-Path: X-Original-To: patchwork-linux-arm@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 B1900BF924 for ; Wed, 23 Oct 2013 08:30:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98D12202C7 for ; Wed, 23 Oct 2013 08:30:18 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3AC5C202BE for ; Wed, 23 Oct 2013 08:30:17 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYtpT-0007Im-Cr; Wed, 23 Oct 2013 08:30:11 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYtpR-0007e3-7Q; Wed, 23 Oct 2013 08:30:09 +0000 Received: from smtp6-g21.free.fr ([2a01:e0c:1:1599::15]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYtpM-0007dE-Tq for linux-arm-kernel@lists.infradead.org; Wed, 23 Oct 2013 08:30:06 +0000 Received: from denis-N73SV.local.eukrea.com (unknown [88.170.243.169]) by smtp6-g21.free.fr (Postfix) with ESMTP id F2CB8822FC; Wed, 23 Oct 2013 10:29:41 +0200 (CEST) From: Denis Carikli To: Sascha Hauer Subject: [PATCHv5][ 2/9] video: imxfb: Introduce regulator support. Date: Wed, 23 Oct 2013 10:29:27 +0200 Message-Id: <1382516974-13371-2-git-send-email-denis@eukrea.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1382516974-13371-1-git-send-email-denis@eukrea.com> References: <1382516974-13371-1-git-send-email-denis@eukrea.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131023_043005_713082_92AFD86A X-CRM114-Status: GOOD ( 12.38 ) X-Spam-Score: -1.2 (-) Cc: Fabio Estevam , linux-fbdev@vger.kernel.org, Denis Carikli , Tomi Valkeinen , =?UTF-8?q?Eric=20B=C3=A9nard?= , Shawn Guo , Jean-Christophe Plagniol-Villard , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This commit is based on the following commit by Fabio Estevam: 4344429 video: mxsfb: Introduce regulator support Cc: Fabio Estevam Cc: Sascha Hauer Cc: linux-arm-kernel@lists.infradead.org Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: Eric BĂ©nard Signed-off-by: Denis Carikli --- drivers/video/imxfb.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c index 44ee678..4bf3837 100644 --- a/drivers/video/imxfb.c +++ b/drivers/video/imxfb.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -145,6 +146,7 @@ struct imxfb_info { struct clk *clk_ipg; struct clk *clk_ahb; struct clk *clk_per; + struct regulator *reg_lcd; enum imxfb_type devtype; bool enabled; @@ -563,12 +565,23 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi) static void imxfb_enable_controller(struct imxfb_info *fbi) { + int ret; if (fbi->enabled) return; pr_debug("Enabling LCD controller\n"); + if (fbi->reg_lcd) { + ret = regulator_enable(fbi->reg_lcd); + if (ret) { + dev_err(&fbi->pdev->dev, + "lcd regulator enable failed with error: %d\n", + ret); + return; + } + } + writel(fbi->screen_dma, fbi->regs + LCDC_SSA); /* panning offset 0 (0 pixel offset) */ @@ -597,6 +610,8 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) static void imxfb_disable_controller(struct imxfb_info *fbi) { + int ret; + if (!fbi->enabled) return; @@ -613,6 +628,14 @@ static void imxfb_disable_controller(struct imxfb_info *fbi) fbi->enabled = false; writel(0, fbi->regs + LCDC_RMCR); + + if (fbi->reg_lcd) { + ret = regulator_disable(fbi->reg_lcd); + if (ret) + dev_err(&fbi->pdev->dev, + "lcd regulator disable failed with error: %d\n", + ret); + } } static int imxfb_blank(int blank, struct fb_info *info) @@ -1020,6 +1043,12 @@ static int imxfb_probe(struct platform_device *pdev) goto failed_register; } + fbi->reg_lcd = devm_regulator_get(&pdev->dev, "lcd"); + if (IS_ERR(fbi->reg_lcd)) { + dev_info(&pdev->dev, "No lcd regulator used.\n"); + fbi->reg_lcd = NULL; + } + imxfb_enable_controller(fbi); fbi->pdev = pdev; #ifdef PWMR_BACKLIGHT_AVAILABLE