From patchwork Tue Sep 10 21:29:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Kemnade X-Patchwork-Id: 11140081 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E0DC1395 for ; Tue, 10 Sep 2019 21:29:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1036E216F4 for ; Tue, 10 Sep 2019 21:29:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kemnade.info header.i=@kemnade.info header.b="Izn17ZFm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbfIJV3m (ORCPT ); Tue, 10 Sep 2019 17:29:42 -0400 Received: from mail.andi.de1.cc ([85.214.55.253]:51578 "EHLO mail.andi.de1.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbfIJV3m (ORCPT ); Tue, 10 Sep 2019 17:29:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20180802; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Dk2cypFp9qRpGk+x/WI3YUW36HoBZTZBqKH2frB5PD4=; b=Izn17ZFma0evvGmBQDZxmLni0R HXOg5DQ5qjJLlPOEUCKD26G+ZT1QiaWtj/6JESRhVjm8weV2TIhziqkxRY6AJNN8qz3A+zaffogdN otbKK1wAEO9mGfJzd2BkqWZ6GXIlNP9hwrtRgEsVtqkLwmxuzSvaM+yUUODtcWY439qA=; Received: from p200300ccff17ef001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff17:ef00:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i7nhf-0001id-DV; Tue, 10 Sep 2019 23:29:35 +0200 Received: from andi by aktux with local (Exim 4.92) (envelope-from ) id 1i7nhe-0004ik-Th; Tue, 10 Sep 2019 23:29:34 +0200 From: Andreas Kemnade To: lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, jacek.anaszewski@gmail.com, pavel@ucw.cz, dmurphy@ti.com, robh+dt@kernel.org, mark.rutland@arm.com, b.zolnierkie@samsung.com, dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, "H. Nikolaus Schaller" Cc: Andreas Kemnade Subject: [PATCH v2 1/2] dt-bindings: backlight: lm3630a: add enable_gpios Date: Tue, 10 Sep 2019 23:29:08 +0200 Message-Id: <20190910212909.18095-2-andreas@kemnade.info> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190910212909.18095-1-andreas@kemnade.info> References: <20190910212909.18095-1-andreas@kemnade.info> MIME-Version: 1.0 X-Spam-Score: -1.0 (-) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org add enable-gpios to describe HWEN pin Signed-off-by: Andreas Kemnade Acked-by: Daniel Thompson --- changes in v2: add example .../bindings/leds/backlight/lm3630a-backlight.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml index dc129d9a329e..1fa83feffe16 100644 --- a/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml +++ b/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml @@ -29,6 +29,10 @@ properties: '#size-cells': const: 0 + enable-gpios: + description: GPIO to use to enable/disable the backlight (HWEN pin). + maxItems: 1 + required: - compatible - reg @@ -92,6 +96,7 @@ examples: i2c { #address-cells = <1>; #size-cells = <0>; + enable-gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; led-controller@38 { compatible = "ti,lm3630a"; From patchwork Tue Sep 10 21:29:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Kemnade X-Patchwork-Id: 11140083 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7597A1395 for ; Tue, 10 Sep 2019 21:29:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 550B721924 for ; Tue, 10 Sep 2019 21:29:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kemnade.info header.i=@kemnade.info header.b="kPrtb/y9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726341AbfIJV3x (ORCPT ); Tue, 10 Sep 2019 17:29:53 -0400 Received: from mail.andi.de1.cc ([85.214.55.253]:52728 "EHLO mail.andi.de1.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbfIJV3x (ORCPT ); Tue, 10 Sep 2019 17:29:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20180802; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=EuNSm48CMbzA/IOyJAJF78zX5ZK+bFhFwE66o29+ttQ=; b=kPrtb/y95jmQGogILCuqeK/ieR szk3ONSSsy88GSFSCb/u1L0EBiBo///bR+zB4zcHHdUzijuNRFLsBOsQWHgJLQiATAE4eBpcu2dcz v0TC140uevcbTCzFAdbQL25J/1W4mnF20l0W/61WItA4upYj2dTUpV4HLNlIrWgirCQw=; Received: from p200300ccff17ef001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff17:ef00:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i7nho-0001iz-W6; Tue, 10 Sep 2019 23:29:45 +0200 Received: from andi by aktux with local (Exim 4.92) (envelope-from ) id 1i7nho-0004in-Nd; Tue, 10 Sep 2019 23:29:44 +0200 From: Andreas Kemnade To: lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, jacek.anaszewski@gmail.com, pavel@ucw.cz, dmurphy@ti.com, robh+dt@kernel.org, mark.rutland@arm.com, b.zolnierkie@samsung.com, dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, "H. Nikolaus Schaller" Cc: Andreas Kemnade Subject: [PATCH v2 2/2] backlight: lm3630a: add an enable gpio for the HWEN pin Date: Tue, 10 Sep 2019 23:29:09 +0200 Message-Id: <20190910212909.18095-3-andreas@kemnade.info> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190910212909.18095-1-andreas@kemnade.info> References: <20190910212909.18095-1-andreas@kemnade.info> MIME-Version: 1.0 X-Spam-Score: -1.0 (-) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org For now just enable it in the probe function to allow i2c access. Disabling also means resetting the register values to default and according to the datasheet does not give power savings Tested on Kobo Clara HD. Signed-off-by: Andreas Kemnade --- changes in v2: - simplification - correct gpio direction initialisation drivers/video/backlight/lm3630a_bl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index 8f84f3684f04..9d0639d4202d 100644 --- a/drivers/video/backlight/lm3630a_bl.c +++ b/drivers/video/backlight/lm3630a_bl.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #include @@ -48,6 +50,7 @@ struct lm3630a_chip { struct lm3630a_platform_data *pdata; struct backlight_device *bleda; struct backlight_device *bledb; + struct gpio_desc *enable_gpio; struct regmap *regmap; struct pwm_device *pwmd; }; @@ -535,6 +538,13 @@ static int lm3630a_probe(struct i2c_client *client, } pchip->pdata = pdata; + pchip->enable_gpio = devm_gpiod_get_optional(&client->dev, "enable", + GPIOD_OUT_HIGH); + if (IS_ERR(pchip->enable_gpio)) { + rval = PTR_ERR(pchip->enable_gpio); + return rval; + } + /* chip initialize */ rval = lm3630a_chip_init(pchip); if (rval < 0) {