Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4579614ybe; Mon, 9 Sep 2019 11:14:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwy/s9/BHI7p7MXjZzIKVogH1ps3xpm74I625krAU4XUDicgp/8/dwwc5IhYF2nm3cr2HKX X-Received: by 2002:a50:9734:: with SMTP id c49mr26104296edb.93.1568052843938; Mon, 09 Sep 2019 11:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568052843; cv=none; d=google.com; s=arc-20160816; b=0cXMlSGty/nuYbiNdhCjnlbNbbzw/48JpGEljg+iq2CJs7nNv0PIKTPJj8mCxPgpjx qa7y6tNnMs0toQ91TsAia/Ft9qtsDmg0gLevjgsugAkpjvDQ530i/VcFbW339JQxeiGK ySgXkJIB6q/l2uq1NlJnOKcAp5FGB3w0K65d11YLKTsXjhS+wOx050SVdRllYASKwE7z 5ph5a8LF1CGh3zpglEqu5UWGJiK7kfldaKvYBB5MT2XJXwZMKD8LK+FGeIUZyVTEhuRp LNJHBI3z1nhcjd+m3Xr07L4su5GobVORJpyCTnStSzia8SMy8ND8hng0SdJATLFspOTY 8eRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fNJRiTsyDxjrEnQ50hBd8V4TRodHhVtOX3D2dnRGh6U=; b=hw9WphNag3UUqScRDRMFcR16QgusXwv7TZSXf3oqIIJCIcRlzS6BeDD/5RnPYlbzDo bhIDcGWevcOgrrmNpfcwcm0f8DYJCwY8hcMCUJ5uEcA52M1ikr/5M1G31+PYI4BDPCTx gNZiCZAIgQby0xfn6WTNyTyKq9ZJC0qYMlxMlw5IizmfFBgRQCapFzvy+mFKP2i4AROF aLJTjYNk89gv/O/dKXb685gZrolcanAy+2IeWnRwFSO78irpJOCnBlk8nkRkOYJqBd6Y vpbDeFIubKIOctAlzM17gqpgM+Ffx1TyQZV79DLXJ0y83I3aqlIj0+u+PeZ5xbI1ZAf5 PxBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b="Zl4qQ3/c"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t57si9295531edb.0.2019.09.09.11.13.40; Mon, 09 Sep 2019 11:14:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b="Zl4qQ3/c"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729360AbfIHUhU (ORCPT + 99 others); Sun, 8 Sep 2019 16:37:20 -0400 Received: from mail.andi.de1.cc ([85.214.55.253]:33294 "EHLO mail.andi.de1.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729230AbfIHUhU (ORCPT ); Sun, 8 Sep 2019 16:37:20 -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=fNJRiTsyDxjrEnQ50hBd8V4TRodHhVtOX3D2dnRGh6U=; b=Zl4qQ3/c4bdZqDPUnab9jcHbmk eS8vOSMg1SlvMJ9mmyb41bVnb8r8VvhQNwadgQhVIO3PAl015xgzPm0lrSnkZDJZym5QDD3U31e8i I4482ByZXavOa84eKpp0R3BxL2774bWLXw0SoESbig7f52zKFB7lUDiAMlTsu3BU/7kI=; 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" Cc: Andreas Kemnade 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 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.0 (-) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.20.1