All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Adam Ford <aford173@gmail.com>
Cc: linux-pwm@vger.kernel.org,
	"Daniel Thompson" <daniel.thompson@linaro.org>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	linux-fbdev@vger.kernel.org,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Enric Balletbo i Serra" <enric.balletbo@collabora.com>,
	"Lee Jones" <lee.jones@linaro.org>
Subject: Re: [PATCH] backlight: pwm_bl: configure pwm only once per backlight toggle
Date: Thu, 17 Oct 2019 13:05:19 +0000	[thread overview]
Message-ID: <20191017130519.GC3768303@ulmo> (raw)
In-Reply-To: <CAHCN7xJFDrsqzR2H2mNYhKB8iF7xYWb9kM+HdzukjDix461gsg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3510 bytes --]

On Thu, Oct 17, 2019 at 07:40:47AM -0500, Adam Ford wrote:
> On Thu, Oct 17, 2019 at 7:34 AM Adam Ford <aford173@gmail.com> wrote:
> >
> > On Thu, Oct 17, 2019 at 7:19 AM Uwe Kleine-König
> > <u.kleine-koenig@pengutronix.de> wrote:
> > >
> > > On Thu, Oct 17, 2019 at 12:47:27PM +0100, Daniel Thompson wrote:
> > > > On Thu, Oct 17, 2019 at 10:10:59AM +0200, Uwe Kleine-König wrote:
> > > > > A previous change in the pwm core (namely 01ccf903edd6 ("pwm: Let
> > > > > pwm_get_state() return the last implemented state")) changed the
> > > > > semantic of pwm_get_state() and disclosed an (as it seems) common
> > > > > problem in lowlevel PWM drivers. By not relying on the period and duty
> > > > > cycle being retrievable from a disabled PWM this type of problem is
> > > > > worked around.
> > > > >
> > > > > Apart from this issue only calling the pwm_get_state/pwm_apply_state
> > > > > combo once is also more effective.
> > > >
> > > > I'm only interested in the second paragraph here.
> > > >
> > > > There seems to be a reasonable consensus that the i.MX27 and cros-ec
> > > > PWM drivers should be fixed for the benefit of other PWM clients.
> > > > So we make this change because it makes the pwm-bl better... not to
> > > > work around bugs ;-).
> > >
> > > That's fine, still I think it's fair to explain the motivation of
> > > creating this patch.
> > >
> > > > > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> > > > > index 746eebc411df..ddebd62b3978 100644
> > > > > --- a/drivers/video/backlight/pwm_bl.c
> > > > > +++ b/drivers/video/backlight/pwm_bl.c
> > > > > @@ -67,40 +62,27 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb)
> > > > >
> > > > >  static void pwm_backlight_power_off(struct pwm_bl_data *pb)
> > > > >  {
> > > > > -   struct pwm_state state;
> > > > > -
> > > > > -   pwm_get_state(pb->pwm, &state);
> > > > > -   if (!pb->enabled)
> > > > > -           return;
> > > > > -
> > > >
> > > > Why remove the pb->enabled check? I thought that was there to ensure we
> > > > don't mess up the regular reference counts.
> > >
> > > I havn't looked yet, but I guess I have to respin. Expect a v2 later
> > > today.
> >
> > I would agree that a high-level fix is better than a series of low
> > level driver fixes.  For what its worth, your V1 patch worked fine on
> > my i.MX6Q.  I can test the V2 patch when its ready.
> 
> I may have spoken too soon.  The patch fixes the display in that it
> comes on when it previously did not, but changes to brightness do not
> appear to do anything anymore.  I don't have an oscilloscope where I
> am now, so I cannot verify whether or not the PWM duty cycle changes.
> 
> To my eye, the following do not appear to change the brightness of the screen:
>      echo 7 > /sys/devices/soc0/backlight-lvds/backlight/backlight-lvds/brightness
>      echo 2 > /sys/devices/soc0/backlight-lvds/backlight/backlight-lvds/brightness
>      echo 5 > /sys/devices/soc0/backlight-lvds/backlight/backlight-lvds/brightness

Hi Adam,

can you try the i.MX PWM patch that I posted earlier instead? I really
think we need to fix this in the PWM drivers because they are broken.
pwm-backlight is not. -rc3 is really not a time to work around breakage
in consumers.

If my patch doesn't help, can you try reverting the offending patch? If
we can't come up with a good fix for the drivers, reverting is the next
best option.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Adam Ford <aford173@gmail.com>
Cc: linux-pwm@vger.kernel.org,
	"Daniel Thompson" <daniel.thompson@linaro.org>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	linux-fbdev@vger.kernel.org,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Enric Balletbo i Serra" <enric.balletbo@collabora.com>,
	"Lee Jones" <lee.jones@linaro.org>
Subject: Re: [PATCH] backlight: pwm_bl: configure pwm only once per backlight toggle
Date: Thu, 17 Oct 2019 15:05:19 +0200	[thread overview]
Message-ID: <20191017130519.GC3768303@ulmo> (raw)
In-Reply-To: <CAHCN7xJFDrsqzR2H2mNYhKB8iF7xYWb9kM+HdzukjDix461gsg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 3510 bytes --]

On Thu, Oct 17, 2019 at 07:40:47AM -0500, Adam Ford wrote:
> On Thu, Oct 17, 2019 at 7:34 AM Adam Ford <aford173@gmail.com> wrote:
> >
> > On Thu, Oct 17, 2019 at 7:19 AM Uwe Kleine-König
> > <u.kleine-koenig@pengutronix.de> wrote:
> > >
> > > On Thu, Oct 17, 2019 at 12:47:27PM +0100, Daniel Thompson wrote:
> > > > On Thu, Oct 17, 2019 at 10:10:59AM +0200, Uwe Kleine-König wrote:
> > > > > A previous change in the pwm core (namely 01ccf903edd6 ("pwm: Let
> > > > > pwm_get_state() return the last implemented state")) changed the
> > > > > semantic of pwm_get_state() and disclosed an (as it seems) common
> > > > > problem in lowlevel PWM drivers. By not relying on the period and duty
> > > > > cycle being retrievable from a disabled PWM this type of problem is
> > > > > worked around.
> > > > >
> > > > > Apart from this issue only calling the pwm_get_state/pwm_apply_state
> > > > > combo once is also more effective.
> > > >
> > > > I'm only interested in the second paragraph here.
> > > >
> > > > There seems to be a reasonable consensus that the i.MX27 and cros-ec
> > > > PWM drivers should be fixed for the benefit of other PWM clients.
> > > > So we make this change because it makes the pwm-bl better... not to
> > > > work around bugs ;-).
> > >
> > > That's fine, still I think it's fair to explain the motivation of
> > > creating this patch.
> > >
> > > > > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> > > > > index 746eebc411df..ddebd62b3978 100644
> > > > > --- a/drivers/video/backlight/pwm_bl.c
> > > > > +++ b/drivers/video/backlight/pwm_bl.c
> > > > > @@ -67,40 +62,27 @@ static void pwm_backlight_power_on(struct pwm_bl_data *pb)
> > > > >
> > > > >  static void pwm_backlight_power_off(struct pwm_bl_data *pb)
> > > > >  {
> > > > > -   struct pwm_state state;
> > > > > -
> > > > > -   pwm_get_state(pb->pwm, &state);
> > > > > -   if (!pb->enabled)
> > > > > -           return;
> > > > > -
> > > >
> > > > Why remove the pb->enabled check? I thought that was there to ensure we
> > > > don't mess up the regular reference counts.
> > >
> > > I havn't looked yet, but I guess I have to respin. Expect a v2 later
> > > today.
> >
> > I would agree that a high-level fix is better than a series of low
> > level driver fixes.  For what its worth, your V1 patch worked fine on
> > my i.MX6Q.  I can test the V2 patch when its ready.
> 
> I may have spoken too soon.  The patch fixes the display in that it
> comes on when it previously did not, but changes to brightness do not
> appear to do anything anymore.  I don't have an oscilloscope where I
> am now, so I cannot verify whether or not the PWM duty cycle changes.
> 
> To my eye, the following do not appear to change the brightness of the screen:
>      echo 7 > /sys/devices/soc0/backlight-lvds/backlight/backlight-lvds/brightness
>      echo 2 > /sys/devices/soc0/backlight-lvds/backlight/backlight-lvds/brightness
>      echo 5 > /sys/devices/soc0/backlight-lvds/backlight/backlight-lvds/brightness

Hi Adam,

can you try the i.MX PWM patch that I posted earlier instead? I really
think we need to fix this in the PWM drivers because they are broken.
pwm-backlight is not. -rc3 is really not a time to work around breakage
in consumers.

If my patch doesn't help, can you try reverting the offending patch? If
we can't come up with a good fix for the drivers, reverting is the next
best option.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-10-17 13:05 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17  8:10 [PATCH] backlight: pwm_bl: configure pwm only once per backlight toggle Uwe Kleine-König
2019-10-17  8:10 ` Uwe Kleine-König
2019-10-17  9:48 ` Michal Vokáč
2019-10-17  9:48   ` Michal Vokáč
2019-10-17 10:11   ` Uwe Kleine-König
2019-10-17 10:11     ` Uwe Kleine-König
2019-10-17 11:11     ` Thierry Reding
2019-10-17 11:11       ` Thierry Reding
2019-10-17 12:09       ` Uwe Kleine-König
2019-10-17 12:09         ` Uwe Kleine-König
2019-10-17 12:59         ` Thierry Reding
2019-10-17 12:59           ` Thierry Reding
2019-10-17 13:58           ` Michal Vokáč
2019-10-17 13:58             ` Michal Vokáč
2019-10-17 15:14             ` Thierry Reding
2019-10-17 15:14               ` Thierry Reding
2019-10-17 17:07               ` Adam Ford
2019-10-17 17:07                 ` Adam Ford
2019-10-17 17:13                 ` Thierry Reding
2019-10-17 17:13                   ` Thierry Reding
2019-10-17 17:44                   ` Adam Ford
2019-10-17 17:44                     ` Adam Ford
2019-10-18  9:36                     ` Michal Vokáč
2019-10-18  9:36                       ` Michal Vokáč
2019-10-23 14:16                       ` Adam Ford
2019-10-23 14:16                         ` Adam Ford
2019-10-23 14:23                         ` Fabio Estevam
2019-10-23 14:23                           ` Fabio Estevam
2019-10-23 15:05                           ` Uwe Kleine-König
2019-10-23 15:05                             ` Uwe Kleine-König
2019-10-17 20:25               ` Uwe Kleine-König
2019-10-17 20:25                 ` Uwe Kleine-König
2019-10-17 19:44           ` Uwe Kleine-König
2019-10-17 19:44             ` Uwe Kleine-König
2019-10-17 13:30       ` Adam Ford
2019-10-17 13:30         ` Adam Ford
2019-10-17 13:59         ` Adam Ford
2019-10-17 13:59           ` Adam Ford
2019-10-17 10:59   ` Michal Vokáč
2019-10-17 10:59     ` Michal Vokáč
2019-10-17 20:19     ` Uwe Kleine-König
2019-10-17 20:19       ` Uwe Kleine-König
2019-10-17 11:47 ` Daniel Thompson
2019-10-17 11:47   ` Daniel Thompson
2019-10-17 12:19   ` Uwe Kleine-König
2019-10-17 12:19     ` Uwe Kleine-König
2019-10-17 12:34     ` Adam Ford
2019-10-17 12:34       ` Adam Ford
2019-10-17 12:40       ` Adam Ford
2019-10-17 12:40         ` Adam Ford
2019-10-17 13:05         ` Thierry Reding [this message]
2019-10-17 13:05           ` Thierry Reding
2019-10-17 13:09           ` Adam Ford
2019-10-17 13:09             ` Adam Ford
2019-10-17 13:18     ` Daniel Thompson
2019-10-17 13:18       ` Daniel Thompson
2019-10-17 18:28       ` Uwe Kleine-König
2019-10-17 18:28         ` Uwe Kleine-König
2019-10-17 12:53 ` Adam Ford
2019-10-17 12:53   ` Adam Ford
2019-10-17 14:51 ` Adam Ford
2019-10-17 14:51   ` Adam Ford

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=20191017130519.GC3768303@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=aford173@gmail.com \
    --cc=daniel.thompson@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=enric.balletbo@collabora.com \
    --cc=jingoohan1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --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.