Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1966880ybe; Thu, 12 Sep 2019 02:20:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWMCDE7O45QyBhFASS5e8mUtB3rsnPOhSj9x3uHaUaGv4fYOAP6dWF4NLWfYPth+zJ0Zzv X-Received: by 2002:aa7:cd73:: with SMTP id ca19mr40878741edb.266.1568280058867; Thu, 12 Sep 2019 02:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568280058; cv=none; d=google.com; s=arc-20160816; b=ads9pVvfKwI+SSkowDmQPKCjrIbZ7b7cQ01HMfO1hNDxTgvV9kvKTGeQ3D3JRA9rOz UzbcKAM2rT4DVF21aTlp+0UsED9LmzC+w4UV0A3G6fAHbKT5hLmqkN+yXHEobQzbfcxB OeYz1OlSHuRQIufTrYV82XoqJRHI7Geljgzpb+GIkiBvqkuzcp+Wyrk+mwlp9Y33GESK sx85cWm8AB3rdgfvHE58c5qkTrHPhe7hnsf1WWDf0c1AfCi18ISEEWG9Zm4+T593ZkCO eNWGi0agP1yU95X4w1ZiJwu+oyn5VkEQ7QGhG9coNnr43yjZap6KnfLEDs9vw16pZbZX vRKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Nabyzt7ZNfI2GC8vuMbUvyEMGGfNet5Q3cJhBhtdhB4=; b=PAq2Wjh5waJxoUmij3/qscnmKylQBjli2w3L/lSCc/K1ZbKMLurqIFrjVmn0HCj/W+ BhDv3N0RCJshrTdtrkOT/MthTtNhJsBuOT2GWPn0r6I0FERMhvLQw2B4p5F43yQ/hSDY HRgbEAwem7VmBQAyRMMbXeRHkiApXQ3kbo4JKCsY12ZsgRIUW1+tPHZ8crfYVFlLP5/M t7VzmZqiZc+vojtoWlad8TfM3uQsNpzDdcwWuBNEsvzxkU3DA4Im/9V63l/djdthkiCa DFpiEUFEWXzPHsBm6Z0Lug8WP573z9YD8hyWfMfIGLTEovziV5g8LAlDon2C6k0eut/L 6TGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Wq0rUCRG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x22si13554635edi.382.2019.09.12.02.20.35; Thu, 12 Sep 2019 02:20:58 -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=pass header.i=@linaro.org header.s=google header.b=Wq0rUCRG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730454AbfILJSR (ORCPT + 99 others); Thu, 12 Sep 2019 05:18:17 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41385 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726159AbfILJSQ (ORCPT ); Thu, 12 Sep 2019 05:18:16 -0400 Received: by mail-wr1-f66.google.com with SMTP id h7so26585833wrw.8 for ; Thu, 12 Sep 2019 02:18:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Nabyzt7ZNfI2GC8vuMbUvyEMGGfNet5Q3cJhBhtdhB4=; b=Wq0rUCRG5tJLLgE6MWPhkRG8ybUxTrM0lLW+DTbMHhnduPs7tV/5JWHTc2x7XTGY21 ItmLWpSnDhcJDB6VVGUmiJhMPH/c4B9xbd7VOYSrHe+N2TorZ3VdTvo+SvMitkqqCJSD 9MO7We6vXQC74VJaFERbF4w/AkH55BatgfBlBZz6hs3zgBl6Lp9mtIFMC4ASVrZxVrV0 cAx8XCw9PFir8uyHo5eF8xAEBHDffovVSF35r40o8Q7T26veq+aaExdSiJDngIESpW3O B2BMW70hlGwx4jxxO9tNVFhm21OTquM4bhXwGbqDvWmNCda5RR1OEUWQJJWB7n3qgMnU 0FtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Nabyzt7ZNfI2GC8vuMbUvyEMGGfNet5Q3cJhBhtdhB4=; b=BOB+UTJ5z+fBOgTHyUaF5Xdk5PWQt1HQ/c1izE8Fqg9rEfMkkPqExE5VJMzn+WYIYN dYMPo+bVuq8c6DiIMOnbu+6M+B9YhUvKs2tVsKW7yA3lO3GLpgdUavr/AXYKrhrz8bst D0Qw5BJHQoUc+Df4g7N7gCh/+BQHlThebCpHmEXRr+UXaxJajhcRpkXgsZZEjTdXCemw Zg+kHaK06qlBc9MphyT2ulUpDG6CJGcgm3jnt+psv1NZ3gofRuXuUrNcvEGkYwj54jJT z2gPkXTRQVzPpp6F6nd28aiqT34CgISwct09qVmAUEVuZPxPZ7B4jVUxSv/hT0C9mnUV dYlA== X-Gm-Message-State: APjAAAU34OFYiVy7DfXT40q3GYYr3t2OURmK7YkFziztwx1qsa7CGkZp gZXmgbD4wxbvcawo9iLIL20ogQ== X-Received: by 2002:a05:6000:1632:: with SMTP id v18mr15980991wrb.233.1568279894345; Thu, 12 Sep 2019 02:18:14 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id x17sm5359764wmj.19.2019.09.12.02.18.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Sep 2019 02:18:13 -0700 (PDT) Date: Thu, 12 Sep 2019 10:18:11 +0100 From: Daniel Thompson To: Dan Murphy Cc: Andreas Kemnade , lee.jones@linaro.org, jingoohan1@gmail.com, jacek.anaszewski@gmail.com, pavel@ucw.cz, 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: Re: [PATCH v2 2/2] backlight: lm3630a: add an enable gpio for the HWEN pin Message-ID: <20190912091811.evlmeeuoai6phy3l@holly.lan> References: <20190910212909.18095-1-andreas@kemnade.info> <20190910212909.18095-3-andreas@kemnade.info> <20190911102533.not4ta3xwgm6bhjo@holly.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 11, 2019 at 01:48:36PM -0500, Dan Murphy wrote: > > On 9/11/19 5:25 AM, Daniel Thompson wrote: > > On Tue, Sep 10, 2019 at 11:29:09PM +0200, Andreas Kemnade wrote: > > > 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 > > Nitpicking... but I don't think linux/gpio.h is used anymore. > > > > > > > #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; > > the enable gpio is optional so if it fails you log the error and move on Isn't the effect of this to cope gracefully if enable-gpios is absent but to fail with an error if enable-gpios exists and is broken. I thought this code pattern is fairly common. > Also on driver removal did you want to set the GPIO to low to disable the > device to save power? As it happens I offered to opposite feedback for v1: https://lists.freedesktop.org/archives/dri-devel/2019-September/234918.html Basically if the power matters then we should take care of things in the PM code path (which for this driver means reacting properly to suspended flag when updating the brightness). If the power doesn't matter then, given unallocated GPIO pins are in an unknown state anyway, there is no point in tidying up because we don't know what value to restore. Daniel.