From: Thierry Reding <thierry.reding@gmail.com>
To: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Paul Cercueil <paul@crapouillou.net>,
Lee Jones <lee.jones@linaro.org>,
Jingoo Han <jingoohan1@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
od@zcrc.me, linux-pwm@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] backlight: pwm_bl: Set pin to sleep state when powered down
Date: Tue, 25 Jun 2019 09:38:39 +0000 [thread overview]
Message-ID: <20190625093839.GB1516@ulmo> (raw)
In-Reply-To: <20190624112844.fmwbfpdxjkst3u7r@holly.lan>
[-- Attachment #1: Type: text/plain, Size: 2989 bytes --]
On Mon, Jun 24, 2019 at 12:28:44PM +0100, Daniel Thompson wrote:
> On Fri, Jun 21, 2019 at 03:56:08PM +0200, Thierry Reding wrote:
> > On Fri, Jun 21, 2019 at 01:41:45PM +0100, Daniel Thompson wrote:
> > > On 22/05/2019 17:34, Paul Cercueil wrote:
> > > > When the driver probes, the PWM pin is automatically configured to its
> > > > default state, which should be the "pwm" function.
> > >
> > > At which point in the probe... and by who?
> >
> > The driver core will select the "default" state of a device right before
> > calling the driver's probe, see:
> >
> > drivers/base/pinctrl.c: pinctrl_bind_pins()
> >
> > which is called from:
> >
> > drivers/base/dd.c: really_probe()
> >
>
> Thanks. I assumed it would be something like that... although given
> pwm-backlight is essentially a wrapper driver round a PWM I wondered why
> the pinctrl was on the backlight node (rather than the PWM node).
I agree with this. We're defining the pin control state for the PWM pin,
so in my opinion it should be the PWM driver that controls it.
One reason why I think this is important is if we ever end up with a
device that requires pins from two different controllers to be
configured at runtime, then how would we model that? Since pin control
states cannot be aggregated, so you'd have to have multiple "default"
states, each for the pins that they control.
On the other hand if we associate the pin control states with each of
the resources that need those states, then when those resources are
controlled, they will automatically know how to deal with the states.
The top-level device (i.e. backlight) doesn't need to concern itself
with those details.
> Looking at the DTs in the upstream kernel it looks like ~20% of the
> backlight drivers have pinctrl on the backlight node. Others presumable
> have none or have it on the PWM node (and it looks like support for
> sleeping the pins is *very* rare amoung the PWM drivers).
I suspect that that's mostly a sign of our device trees and kernel
subsystems still maturing. For example, I think it's fairly rare for a
device to seamlessly take over the display configuration from the
bootloader. Most of the time you'll just see things go black (that's
actually one of the better cases) when the kernel takes over and then
the backlight will come up again at some point.
Taking over the bootloader's display configuration is pretty hard and
there are numerous pieces to the puzzle (need to make sure clocks and
power supplies are not automatically disabled after the initcalls,
display drivers need to know how to read out hardware, claim whatever
memory region the bootloader was using for a bootsplash, backlight is
supposed to remain enabled if the bootloader turned it on, ...).
I don't think the fact that PWM drivers don't support this implies that
hardware doesn't support it. I think we've just never needed it before
because we get away with it.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-06-25 9:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-22 16:34 [PATCH] backlight: pwm_bl: Set pin to sleep state when powered down Paul Cercueil
2019-06-21 12:41 ` Daniel Thompson
2019-06-21 13:56 ` Thierry Reding
2019-06-24 11:28 ` Daniel Thompson
2019-06-24 14:31 ` Paul Cercueil
2019-06-24 15:46 ` Daniel Thompson
2019-06-24 16:06 ` Paul Cercueil
2019-06-25 9:47 ` Thierry Reding
2019-07-07 2:13 ` Paul Cercueil
2019-06-25 9:38 ` Thierry Reding [this message]
2019-06-26 8:58 ` Uwe Kleine-König
2019-06-26 9:58 ` Thierry Reding
2019-06-26 10:16 ` Uwe Kleine-König
2019-06-24 14:39 ` Paul Cercueil
2019-06-24 22:02 ` Linus Walleij
2019-06-25 7:42 ` Uwe Kleine-König
2019-06-25 9:58 ` Thierry Reding
2019-06-25 19:19 ` 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=20190625093839.GB1516@ulmo \
--to=thierry.reding@gmail.com \
--cc=b.zolnierkie@samsung.com \
--cc=daniel.thompson@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jingoohan1@gmail.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=od@zcrc.me \
--cc=paul@crapouillou.net \
/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).