From patchwork Fri Nov 8 16:31:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Denis Carikli X-Patchwork-Id: 3159011 Return-Path: X-Original-To: patchwork-linux-arm@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 AEC829F326 for ; Fri, 8 Nov 2013 16:32:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 039BB20383 for ; Fri, 8 Nov 2013 16:32:25 +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 37BB9200D7 for ; Fri, 8 Nov 2013 16:32:23 +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 1Veoyq-0007Gs-6e; Fri, 08 Nov 2013 16:32:20 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Veoyn-0008E9-QH; Fri, 08 Nov 2013 16:32:17 +0000 Received: from smtp3-g21.free.fr ([2a01:e0c:1:1599::12]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Veoyi-0008DE-To for linux-arm-kernel@lists.infradead.org; Fri, 08 Nov 2013 16:32:15 +0000 Received: from denis-N73SV.local.eukrea.com (unknown [88.170.243.169]) by smtp3-g21.free.fr (Postfix) with ESMTP id 28360A61C4; Fri, 8 Nov 2013 17:31:40 +0100 (CET) From: Denis Carikli To: Richard Purdie Subject: [PATCHv6][ 1/2] backlight: gpio_backlight: Use a default state enum. Date: Fri, 8 Nov 2013 17:31:29 +0100 Message-Id: <1383928290-9487-1-git-send-email-denis@eukrea.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131108_113213_853618_217C1B35 X-CRM114-Status: GOOD ( 12.53 ) X-Spam-Score: -1.2 (-) Cc: Mark Rutland , devicetree@vger.kernel.org, Ian Campbell , =?UTF-8?q?Eric=20B=C3=A9nard?= , Pawel Moll , Stephen Warren , Jingoo Han , Rob Herring , Grant Likely , Denis Carikli , Thierry Reding , Laurent Pinchart , Sascha Hauer , Jean-Christophe Plagniol-Villard , linux-arm-kernel@lists.infradead.org, =?UTF-8?q?Lothar=20Wa=C3=9Fmann?= 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.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 That enum adds a "keep" state which permits to tell the driver trough its platform data not to touch the hardware during the probe. Cc: Richard Purdie Cc: Jingoo Han Cc: Laurent Pinchart Cc: Rob Herring Cc: Pawel Moll Cc: Mark Rutland Cc: Stephen Warren Cc: Ian Campbell Cc: devicetree@vger.kernel.org Cc: Sascha Hauer Cc: linux-arm-kernel@lists.infradead.org Cc: Lothar Waßmann Cc: Jean-Christophe Plagniol-Villard Cc: Thierry Reding Cc: Eric Bénard Signed-off-by: Denis Carikli --- ChangeLog v5->v6: - New patch. --- drivers/video/backlight/gpio_backlight.c | 7 +++++-- include/linux/platform_data/gpio_backlight.h | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 81fb127..6ddeba9 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -23,6 +23,7 @@ struct gpio_backlight { int gpio; int active; + enum gpio_backlight_default_state def_value; }; static int gpio_backlight_update_status(struct backlight_device *bl) @@ -103,8 +104,10 @@ static int gpio_backlight_probe(struct platform_device *pdev) return PTR_ERR(bl); } - bl->props.brightness = pdata->def_value; - backlight_update_status(bl); + if (pdata->def_value != BACKLIGHT_GPIO_DEFSTATE_KEEP) { + bl->props.brightness = pdata->def_value; + backlight_update_status(bl); + } platform_set_drvdata(pdev, bl); return 0; diff --git a/include/linux/platform_data/gpio_backlight.h b/include/linux/platform_data/gpio_backlight.h index 5ae0d9c..3b437b3 100644 --- a/include/linux/platform_data/gpio_backlight.h +++ b/include/linux/platform_data/gpio_backlight.h @@ -10,6 +10,12 @@ struct device; +enum gpio_backlight_default_state { + BACKLIGHT_GPIO_DEFSTATE_OFF, + BACKLIGHT_GPIO_DEFSTATE_ON, + BACKLIGHT_GPIO_DEFSTATE_KEEP, +}; + struct gpio_backlight_platform_data { struct device *fbdev; int gpio;