From: Daniel Thompson <daniel.thompson@linaro.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Lee Jones <lee@kernel.org>, Jingoo Han <jingoohan1@gmail.com>,
linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-fbdev@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH 2/2] backlight: pwm_bl: Don't disable the PWM to disable the backlight
Date: Tue, 10 Jan 2023 16:26:14 +0000 [thread overview]
Message-ID: <Y72RpjK4T2VEoIVI@aspen.lan> (raw)
In-Reply-To: <20230109204758.610400-2-u.kleine-koenig@pengutronix.de>
On Mon, Jan 09, 2023 at 09:47:58PM +0100, Uwe Kleine-König wrote:
> Most but not all PWMs drive the PWM pin to its inactive state when
> disabled. Rely on the lowlevel PWM implementation to implement
> duty_cycle = 0 in an energy efficient way and don't disable the PWM.
I'm a little worried about this one.
I thought the PWM APIs allow the duty cycle to be rounded up or down
slightly during the apply.
So when you say "rely on the lowlevel to implement duty_cycle = 0 to..."
is it confirmed that this is true (and that all PWMs *can* implement
a duty_cycle of 0 without rounding up)?
Daniel.
> This fixes backlight disabling e.g. on i.MX6 when an inverted PWM is
> used.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/video/backlight/pwm_bl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 0509fecd5715..7bdc5d570a12 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -109,7 +109,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
> pwm_backlight_power_off(pb);
>
> pwm_get_state(pb->pwm, &state);
> - state.enabled = false;
> + state.enabled = true;
> state.duty_cycle = 0;
> pwm_apply_state(pb->pwm, &state);
> }
> --
> 2.39.0
>
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Thompson <daniel.thompson@linaro.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org,
Jingoo Han <jingoohan1@gmail.com>, Lee Jones <lee@kernel.org>,
dri-devel@lists.freedesktop.org,
Thierry Reding <thierry.reding@gmail.com>,
kernel@pengutronix.de
Subject: Re: [PATCH 2/2] backlight: pwm_bl: Don't disable the PWM to disable the backlight
Date: Tue, 10 Jan 2023 16:26:14 +0000 [thread overview]
Message-ID: <Y72RpjK4T2VEoIVI@aspen.lan> (raw)
In-Reply-To: <20230109204758.610400-2-u.kleine-koenig@pengutronix.de>
On Mon, Jan 09, 2023 at 09:47:58PM +0100, Uwe Kleine-König wrote:
> Most but not all PWMs drive the PWM pin to its inactive state when
> disabled. Rely on the lowlevel PWM implementation to implement
> duty_cycle = 0 in an energy efficient way and don't disable the PWM.
I'm a little worried about this one.
I thought the PWM APIs allow the duty cycle to be rounded up or down
slightly during the apply.
So when you say "rely on the lowlevel to implement duty_cycle = 0 to..."
is it confirmed that this is true (and that all PWMs *can* implement
a duty_cycle of 0 without rounding up)?
Daniel.
> This fixes backlight disabling e.g. on i.MX6 when an inverted PWM is
> used.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/video/backlight/pwm_bl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 0509fecd5715..7bdc5d570a12 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -109,7 +109,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
> pwm_backlight_power_off(pb);
>
> pwm_get_state(pb->pwm, &state);
> - state.enabled = false;
> + state.enabled = true;
> state.duty_cycle = 0;
> pwm_apply_state(pb->pwm, &state);
> }
> --
> 2.39.0
>
next prev parent reply other threads:[~2023-01-10 16:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 20:47 [PATCH 1/2] backlight: pwm_bl: configure pwm only once per backlight toggle Uwe Kleine-König
2023-01-09 20:47 ` Uwe Kleine-König
2023-01-09 20:47 ` [PATCH 2/2] backlight: pwm_bl: Don't disable the PWM to disable the backlight Uwe Kleine-König
2023-01-09 20:47 ` Uwe Kleine-König
2023-01-10 16:26 ` Daniel Thompson [this message]
2023-01-10 16:26 ` Daniel Thompson
2023-01-10 17:35 ` Uwe Kleine-König
2023-01-10 17:50 ` Daniel Thompson
2023-01-10 16:17 ` [PATCH 1/2] backlight: pwm_bl: configure pwm only once per backlight toggle Daniel Thompson
2023-01-10 16:17 ` Daniel Thompson
2023-01-10 17:17 ` Uwe Kleine-König
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=Y72RpjK4T2VEoIVI@aspen.lan \
--to=daniel.thompson@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=kernel@pengutronix.de \
--cc=lee@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.