From patchwork Tue Mar 1 10:47:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 8464141 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C3D84C0553 for ; Tue, 1 Mar 2016 10:50:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A587020295 for ; Tue, 1 Mar 2016 10:50:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D6D8201BC for ; Tue, 1 Mar 2016 10:50:28 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aahq2-0000GR-80; Tue, 01 Mar 2016 10:47:34 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aahpy-0000F8-Gr for linux-arm-kernel@lists.infradead.org; Tue, 01 Mar 2016 10:47:31 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1aahpZ-0006HU-VS; Tue, 01 Mar 2016 11:47:05 +0100 Received: from ukl by dude.hi.pengutronix.de with local (Exim 4.86) (envelope-from ) id 1aahpY-0000Pj-K1; Tue, 01 Mar 2016 11:47:04 +0100 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: kernel@pengutronix.de, Jean-Christophe Plagniol-Villard , Tomi Valkeinen Subject: [PATCH RFC] video: fbdev: imxfb: make the driver cooperate Date: Tue, 1 Mar 2016 11:47:03 +0100 Message-Id: <1456829223-1526-1-git-send-email-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.7.0 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160301_024730_745552_05FC0379 X-CRM114-Status: GOOD ( 13.96 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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.2 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 The .get_power and .set_power callbacks didn't adhere to the expected(?) convention to enable the power when the power parameter is zero. Moreover ensure that the regulator is enabled together with the lcd controller. Without these changes there is nothing visible after bootup because the regulator is kept off (or disabled by the regulator core because it's not used). The lcd regulator is enabled only after 10 minutes of idle when it should really go off. Signed-off-by: Uwe Kleine-König --- Hello, this introduces a new warning because the return value of regulator_enable isn't checked. If it's agreed that the patch is ok in general I can fix this up, but I don't know if fbdev is already too dead even for fixes like this. Best regards Uwe drivers/video/fbdev/imxfb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index cee88603efc9..7d763164820c 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -499,6 +499,9 @@ static void imxfb_enable_controller(struct imxfb_info *fbi) clk_prepare_enable(fbi->clk_ipg); clk_prepare_enable(fbi->clk_ahb); clk_prepare_enable(fbi->clk_per); + if (!IS_ERR(fbi->lcd_pwr)) + regulator_enable(fbi->lcd_pwr); + fbi->enabled = true; } @@ -513,6 +516,8 @@ static void imxfb_disable_controller(struct imxfb_info *fbi) clk_disable_unprepare(fbi->clk_ipg); clk_disable_unprepare(fbi->clk_ahb); fbi->enabled = false; + if (!IS_ERR(fbi->lcd_pwr)) + regulator_disable(fbi->lcd_pwr); writel(0, fbi->regs + LCDC_RMCR); } @@ -759,9 +764,9 @@ static int imxfb_lcd_get_power(struct lcd_device *lcddev) struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); if (!IS_ERR(fbi->lcd_pwr)) - return regulator_is_enabled(fbi->lcd_pwr); + return !regulator_is_enabled(fbi->lcd_pwr); - return 1; + return 0; } static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power) @@ -769,7 +774,7 @@ static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power) struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); if (!IS_ERR(fbi->lcd_pwr)) { - if (power) + if (!power) return regulator_enable(fbi->lcd_pwr); else return regulator_disable(fbi->lcd_pwr);