public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Maximilian Weigand <mweigand2017@gmail.com>
Cc: "Lee Jones" <lee@kernel.org>,
	"Daniel Thompson" <daniel.thompson@linaro.org>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Helge Deller" <deller@gmx.de>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org,
	"Maximilian Weigand" <mweigand@mweigand.net>
Subject: Re: [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank
Date: Tue, 9 May 2023 18:52:32 +0200	[thread overview]
Message-ID: <20230509165232.GA1072872@ravnborg.org> (raw)
In-Reply-To: <20230505185752.969476-1-mweigand2017@gmail.com>

On Fri, May 05, 2023 at 08:57:52PM +0200, Maximilian Weigand wrote:
> From: Maximilian Weigand <mweigand@mweigand.net>
> 
> Use display_is_blank() to determine if the led strings should be turned
> off in the update_status() functions of both strings.
> 
> Signed-off-by: Maximilian Weigand <mweigand@mweigand.net>
> ---
>  drivers/video/backlight/lm3630a_bl.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
> index d8c42acecb5d..5498b57329f9 100644
> --- a/drivers/video/backlight/lm3630a_bl.c
> +++ b/drivers/video/backlight/lm3630a_bl.c
> @@ -202,7 +202,9 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
>  	usleep_range(1000, 2000);
>  	/* minimum brightness is 0x04 */
>  	ret = lm3630a_write(pchip, REG_BRT_A, bl->props.brightness);
> -	if (bl->props.brightness < 0x4)
> +
> +	if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
You could replace bl->props.brightness with backlight_get_brightness(bl)
to avoid direct access to the properties.

> +		/* turn the string off  */
>  		ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0);
>  	else
>  		ret |= lm3630a_update(pchip, REG_CTRL,
> @@ -277,7 +279,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
>  	usleep_range(1000, 2000);
>  	/* minimum brightness is 0x04 */
>  	ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness);
> -	if (bl->props.brightness < 0x4)
> +
> +	if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
Same here

	Sam

  parent reply	other threads:[~2023-05-09 16:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 18:57 [PATCH v1] backlight: lm3630a: turn off both led strings when display is blank Maximilian Weigand
2023-05-09 13:27 ` Daniel Thompson
2023-05-10  8:51   ` Maximilian Weigand
2023-05-09 16:52 ` Sam Ravnborg [this message]
2023-05-10  8:52   ` Maximilian Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230509165232.GA1072872@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=daniel.thompson@linaro.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jingoohan1@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mweigand2017@gmail.com \
    --cc=mweigand@mweigand.net \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox