From patchwork Thu Nov 21 17:43:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 3220021 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 52BBAC045B for ; Thu, 21 Nov 2013 17:44:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 09355206EB for ; Thu, 21 Nov 2013 17:44:12 +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 7D9E8206D7 for ; Thu, 21 Nov 2013 17:44:10 +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 1VjYII-0007tb-1M; Thu, 21 Nov 2013 17:43:58 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjYIF-0001Wp-HY; Thu, 21 Nov 2013 17:43:55 +0000 Received: from va3ehsobe006.messaging.microsoft.com ([216.32.180.16] helo=va3outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VjYIA-0001Vg-IW for linux-arm-kernel@lists.infradead.org; Thu, 21 Nov 2013 17:43:52 +0000 Received: from mail178-va3-R.bigfish.com (10.7.14.244) by VA3EHSOBE008.bigfish.com (10.7.40.28) with Microsoft SMTP Server id 14.1.225.22; Thu, 21 Nov 2013 17:43:29 +0000 Received: from mail178-va3 (localhost [127.0.0.1]) by mail178-va3-R.bigfish.com (Postfix) with ESMTP id F121C3C0193; Thu, 21 Nov 2013 17:43:28 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h1d1ah1d2ah1fc6hzz1de098h8275bh1de097hz2dh2a8h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1fe8h1ff5h2218h2216h226dh22d0h1155h) Received: from mail178-va3 (localhost.localdomain [127.0.0.1]) by mail178-va3 (MessageSwitch) id 1385055806829079_29224; Thu, 21 Nov 2013 17:43:26 +0000 (UTC) Received: from VA3EHSMHS024.bigfish.com (unknown [10.7.14.252]) by mail178-va3.bigfish.com (Postfix) with ESMTP id B8C108006D; Thu, 21 Nov 2013 17:43:26 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS024.bigfish.com (10.7.99.34) with Microsoft SMTP Server (TLS) id 14.16.227.3; Thu, 21 Nov 2013 17:43:23 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.3.158.2; Thu, 21 Nov 2013 17:43:22 +0000 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.244.102]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id rALHhJqA018002; Thu, 21 Nov 2013 10:43:19 -0700 From: Fabio Estevam To: Subject: [PATCH] backlight: pwm_bl: Do not make the regulator mandatory Date: Thu, 21 Nov 2013 15:43:15 -0200 Message-ID: <1385055795-24002-1-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.8.1.2 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131121_124350_692662_07B3754B X-CRM114-Status: GOOD ( 14.03 ) X-Spam-Score: -4.2 (----) Cc: marex@denx.de, linux-pwm@vger.kernel.org, shawn.guo@linaro.org, Fabio Estevam , 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.7 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 Commit 22ceeee1 (pwm-backlight: Add power supply support) caused breakage on boards that do not define the backlight regulator on their dts files. Instead of making the backlight regulator mandatory, treat it as optional instead, so that we do not have breakage. This avoids the need for adding a dummy regulator on every dts file that uses the pwm-backlight. Tested on a mx6qsabresd. Signed-off-by: Fabio Estevam Acked-by: Marek Vasut --- .../devicetree/bindings/video/backlight/pwm-backlight.txt | 2 +- drivers/video/backlight/pwm_bl.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt index 764db86..ed3dc3c 100644 --- a/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt +++ b/Documentation/devicetree/bindings/video/backlight/pwm-backlight.txt @@ -10,13 +10,13 @@ Required properties: last value in the array represents a 100% duty cycle (brightest). - default-brightness-level: the default brightness level (index into the array defined by the "brightness-levels" property) - - power-supply: regulator for supply voltage Optional properties: - pwm-names: a list of names for the PWM devices specified in the "pwms" property (see PWM binding[0]) - enable-gpios: contains a single GPIO specifier for the GPIO which enables and disables the backlight (see GPIO binding[1]) + - power-supply: regulator for supply voltage [0]: Documentation/devicetree/bindings/pwm/pwm.txt [1]: Documentation/devicetree/bindings/gpio/gpio.txt diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index fb80d68..fb3008c 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -50,9 +50,11 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb, int brightness) if (pb->enabled) return; - err = regulator_enable(pb->power_supply); - if (err < 0) - dev_err(pb->dev, "failed to enable power supply\n"); + if (!IS_ERR(pb->power_supply)) { + err = regulator_enable(pb->power_supply); + if (err < 0) + dev_err(pb->dev, "failed to enable power supply\n"); + } if (gpio_is_valid(pb->enable_gpio)) { if (pb->enable_gpio_flags & PWM_BACKLIGHT_GPIO_ACTIVE_LOW) @@ -80,7 +82,8 @@ static void pwm_backlight_power_off(struct pwm_bl_data *pb) gpio_set_value(pb->enable_gpio, 0); } - regulator_disable(pb->power_supply); + if (!IS_ERR(pb->power_supply)) + regulator_disable(pb->power_supply); pb->enabled = false; } @@ -283,10 +286,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) } pb->power_supply = devm_regulator_get(&pdev->dev, "power"); - if (IS_ERR(pb->power_supply)) { - ret = PTR_ERR(pb->power_supply); - goto err_gpio; - } pb->pwm = devm_pwm_get(&pdev->dev, NULL); if (IS_ERR(pb->pwm)) {