linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Linux regressions mailing list <regressions@lists.linux.dev>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [regression] stm32mp1xx based targets stopped entering suspend if pwm-leds exist
Date: Tue, 16 Apr 2024 13:15:19 +0100	[thread overview]
Message-ID: <20240416121519.GS2399047@google.com> (raw)
In-Reply-To: <256e3d3c-d43f-4bd6-9a7b-50fc870e75e4@leemhuis.info>

On Tue, 16 Apr 2024, Linux regression tracking (Thorsten Leemhuis) wrote:

> On 06.03.24 09:18, Uwe Kleine-König wrote:
> > On Wed, Mar 06, 2024 at 08:05:15AM +0100, Linux regression tracking (Thorsten Leemhuis) wrote:
> >>
> >> Uwe, I noticed a report about a regression in bugzilla.kernel.org that
> >> apparently is caused by a change of yours. As many (most?) kernel
> >> developers don't keep an eye on it, I decided to forward it by mail.
> >>
> >> Note, you have to use bugzilla to reach the reporter, as I sadly[1] can
> >> not CCed them in mails like this.
> >>
> >> Quoting from https://bugzilla.kernel.org/show_bug.cgi?id=218559 :
> >>
> >>> Commit 76fe464c8e64e71b2e4af11edeef0e5d85eeb6aa ("leds: pwm: Don't
> >>> disable the PWM when the LED should be off") prevents stm32mp1xx based
> >>> targets from entering suspend if pwm-leds exist, as the stm32 PWM driver
> >>> refuses to enter suspend if any PWM channels are still active ("PWM 0
> >>> still in use by consumer" see stm32_pwm_suspend in drivers/pwm/stm32-pwm.c).
> >>>
> >>> Reverting the mentioned commit fixes this behaviour but I'm not
> >>> certain if this is a problem with stm32-pwm or pwm-leds (what is the
> >>> usual behaviour for suspend with active PWM channels?).
> > 
> > I'd assume the following patch fixes this report. I didn't test it
> > though.
> 
> Jakob confirmed it helped in the bugzilla ticket. But the patch since
> then didn't make any progress afaics -- or did it and I just missed it
> in my search?

[...] 

> > ---->8----
> > From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > Subject: [PATCH] leds: pwm: Disable PWM when going to suspend
> > 
> > On stm32mp1xx based machines (and others) a PWM consumer has to disable
> > the PWM because an enabled PWM refuses to suspend. So check the
> > LED_SUSPENDED flag and depending on that set the .enabled property.
> > 
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=218559
> > Fixes: 76fe464c8e64 ("leds: pwm: Don't disable the PWM when the LED should be off")
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> >  drivers/leds/leds-pwm.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
> > index 4e3936a39d0e..e1b414b40353 100644
> > --- a/drivers/leds/leds-pwm.c
> > +++ b/drivers/leds/leds-pwm.c
> > @@ -53,7 +53,13 @@ static int led_pwm_set(struct led_classdev *led_cdev,
> >  		duty = led_dat->pwmstate.period - duty;
> >  
> >  	led_dat->pwmstate.duty_cycle = duty;
> > -	led_dat->pwmstate.enabled = true;
> > +	/*
> > +	 * Disabling a PWM doesn't guarantee that it emits the inactive level.
> > +	 * So keep it on. Only for suspending the PWM should be disabled because
> > +	 * otherwise it refuses to suspend. The possible downside is that the
> > +	 * LED might stay (or even go) on.
> > +	 */
> > +	led_dat->pwmstate.enabled = !(led_cdev->flags & LED_SUSPENDED);
> >  	return pwm_apply_might_sleep(led_dat->pwm, &led_dat->pwmstate);
> >  }
> > 
> > base-commit: 15facbd7bd3dbfa04721cb71e69954eb4686cb9e
> > ---->8----

Did you submit this?  I don't see it in LORE or in my inbox.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2024-04-16 12:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  7:05 [regression] stm32mp1xx based targets stopped entering suspend if pwm-leds exist Linux regression tracking (Thorsten Leemhuis)
2024-03-06  8:18 ` Uwe Kleine-König
2024-04-16  8:28   ` Linux regression tracking (Thorsten Leemhuis)
2024-04-16 12:15     ` Lee Jones [this message]
2024-04-16 13:18       ` Uwe Kleine-König
2024-04-17 14:49         ` Lee Jones
2024-04-17 15:38           ` [PATCH] leds: pwm: Disable PWM when going to suspend Uwe Kleine-König
2024-04-26  6:17             ` Uwe Kleine-König
2024-04-26  6:30               ` Linux regression tracking (Thorsten Leemhuis)
2024-05-02 17:02             ` (subset) " Lee Jones
2024-05-02 17:04               ` Lee Jones

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=20240416121519.GS2399047@google.com \
    --to=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=regressions@lists.linux.dev \
    --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;
as well as URLs for NNTP newsgroup(s).