From patchwork Sun Sep 8 20:37:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Kemnade X-Patchwork-Id: 11137327 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 8032F16C1 for ; Mon, 9 Sep 2019 07:23:37 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 681C421D6C for ; Mon, 9 Sep 2019 07:23:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 681C421D6C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kemnade.info Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A86BE8985A; Mon, 9 Sep 2019 07:23:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 2419 seconds by postgrey-1.36 at gabe; Sun, 08 Sep 2019 21:17:37 UTC Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0526F89789 for ; Sun, 8 Sep 2019 21:17:37 +0000 (UTC) Received: from p200300ccff4729001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff47:2900: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 1i73vo-0000wP-Ro; Sun, 08 Sep 2019 22:37:09 +0200 Received: from andi by aktux with local (Exim 4.92) (envelope-from ) id 1i73vo-0007rQ-HL; Sun, 08 Sep 2019 22:37:08 +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" Subject: [PATCH 1/2] backlight: lm3630a: add an enable gpio for the HWEN pin Date: Sun, 8 Sep 2019 22:37:03 +0200 Message-Id: <20190908203704.30147-2-andreas@kemnade.info> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190908203704.30147-1-andreas@kemnade.info> References: <20190908203704.30147-1-andreas@kemnade.info> MIME-Version: 1.0 X-Spam-Score: -1.0 (-) X-Mailman-Approved-At: Mon, 09 Sep 2019 07:23:02 +0000 X-Mailman-Original-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=fNJRiTsyDxjrEnQ50hBd8V4TRodHhVtOX3D2dnRGh6U=; b=Zl4qQ3/c4bdZqDPUnab9jcHbmk eS8vOSMg1SlvMJ9mmyb41bVnb8r8VvhQNwadgQhVIO3PAl015xgzPm0lrSnkZDJZym5QDD3U31e8i I4482ByZXavOa84eKpp0R3BxL2774bWLXw0SoESbig7f52zKFB7lUDiAMlTsu3BU/7kI=; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Kemnade Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" For now just enable it in the probe function to allow i2c access and disable it on remove. Disabling also means resetting the register values to default. Tested on Kobo Clara HD. Signed-off-by: Andreas Kemnade --- drivers/video/backlight/lm3630a_bl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c index b04b35d007a2..3b45a1733198 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; }; @@ -506,6 +509,14 @@ static int lm3630a_probe(struct i2c_client *client, return -ENOMEM; pchip->dev = &client->dev; + pchip->enable_gpio = devm_gpiod_get_optional(&client->dev, "enable", + GPIOD_ASIS); + if (IS_ERR(pchip->enable_gpio)) { + rval = PTR_ERR(pchip->enable_gpio); + return rval; + } + + pchip->regmap = devm_regmap_init_i2c(client, &lm3630a_regmap); if (IS_ERR(pchip->regmap)) { rval = PTR_ERR(pchip->regmap); @@ -535,6 +546,10 @@ static int lm3630a_probe(struct i2c_client *client, } pchip->pdata = pdata; + if (pchip->enable_gpio) { + gpiod_set_value_cansleep(pchip->enable_gpio, 1); + usleep_range(1000, 2000); + } /* chip initialize */ rval = lm3630a_chip_init(pchip); if (rval < 0) { @@ -586,6 +601,9 @@ static int lm3630a_remove(struct i2c_client *client) if (rval < 0) dev_err(pchip->dev, "i2c failed to access register\n"); + if (pchip->enable_gpio) + gpiod_set_value_cansleep(pchip->enable_gpio, 0); + if (pchip->irq) { free_irq(pchip->irq, pchip); flush_workqueue(pchip->irqthread); From patchwork Sun Sep 8 20:37:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Kemnade X-Patchwork-Id: 11137329 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 03DE216C1 for ; Mon, 9 Sep 2019 07:23:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF7B221D79 for ; Mon, 9 Sep 2019 07:23:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF7B221D79 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kemnade.info Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 95C0E89875; Mon, 9 Sep 2019 07:23:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 85F8989789 for ; Sun, 8 Sep 2019 21:17:39 +0000 (UTC) Received: from p200300ccff4729001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff47:2900: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 1i73vq-0000wT-5M; Sun, 08 Sep 2019 22:37:10 +0200 Received: from andi by aktux with local (Exim 4.92) (envelope-from ) id 1i73vp-0007rT-Sv; Sun, 08 Sep 2019 22:37:09 +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" Subject: [PATCH 2/2] dt-bindings: backlight: lm3630a: add enable_gpios Date: Sun, 8 Sep 2019 22:37:04 +0200 Message-Id: <20190908203704.30147-3-andreas@kemnade.info> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190908203704.30147-1-andreas@kemnade.info> References: <20190908203704.30147-1-andreas@kemnade.info> MIME-Version: 1.0 X-Spam-Score: -1.0 (-) X-Mailman-Approved-At: Mon, 09 Sep 2019 07:23:02 +0000 X-Mailman-Original-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=kpo4GcGSp/p9xK4M107Cs6yDAMCz9KA0m/IM/ACOm4E=; b=DU6vwmH4jkv/uSyC72u75opOru tJiAe0zAqAhQf8OWs+pSXGzo6uHU3Ab+7u5Byz3emvyTlLRzJuasaqMGR+n/1e6R0V/r6fL69nCRd TdEg4gpjSwZR97wFCRmmK5S6+FYXuE2J8xM3wGCEM0/TNagoJCLVOXbKseWO14fHBaAc=; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Kemnade Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" add enable-gpios to describe HWEN pin Signed-off-by: Andreas Kemnade --- .../devicetree/bindings/leds/backlight/lm3630a-backlight.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/lm3630a-backlight.yaml index dc129d9a329e..a9656d72b668 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