linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: "Clemens Gruber" <clemens.gruber@pqgruber.com>,
	"Sven Van Asbroeck" <thesven73@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>
Subject: Re: [PATCH v5 2/7] pwm: pca9685: Support hardware readout
Date: Mon, 22 Mar 2021 11:38:40 +0200	[thread overview]
Message-ID: <CAHp75Ve2FFEMsAv8S18bUDFsH2UkiQ5UvgcRtZ=j30syQtEirw@mail.gmail.com> (raw)
In-Reply-To: <YFhhGpiHDELxIo9V@orome.fritz.box>

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

On Monday, March 22, 2021, Thierry Reding <thierry.reding@gmail.com> wrote:

> On Fri, Jan 29, 2021 at 09:37:47PM +0100, Clemens Gruber wrote:
> > Hi Sven,
> >
> > On Fri, Jan 29, 2021 at 01:05:14PM -0500, Sven Van Asbroeck wrote:
> > > Hi Clemens,
> > >
> > > On Fri, Jan 29, 2021 at 11:31 AM Clemens Gruber
> > > <clemens.gruber@pqgruber.com> wrote:
> > > >
> > > > Ok, so you suggest we extend our get_state logic to deal with cases
> > > > like the following:
> > >
> > > Kind of. We can't control how other actors (bootloaders etc) program
> the
> > > chip. As far as I know, there are many, many different register
> settings that
> > > result in the same physical chip outputs. So if .probe() wants to
> preserve the
> > > existing chip settings, .get_state() has to be able to deal with every
> possible
> > > setting. Even invalid ones.
> >
> > Is the driver really responsible for bootloaders that program the chip
> > with invalid values?
> > The chip comes out of PoR with sane default values. If the bootloader of
> > a user messes them up, isn't that a bootloader problem instead of a
> > Linux kernel driver problem?
>
> It is ultimately a problem of the bootloader and where possible the
> bootloader should be fixed. However, fixing bootloaders sometimes isn't
> possible, or impractical, so the kernel has to be able to deal with
> hardware that's been badly programmed by the bootloader. Within reason,
> of course. Sometimes this can't be done in any other way than forcing a
> hard reset of the chip, but it should always be a last resort.
>
> > > In addition, .apply() cannot make any assumptions as to which bits are
> > > already set/cleared on the chip. Including preserved, invalid settings.
> > >
> > > This might get quite complex.
> > >
> > > However if we reset the chip in .probe() to a known state (a
> normalized state,
> > > in the mathematical sense), then both .get_state() and .apply() become
> > > much simpler. because they only need to deal with known, normalized
> states.
> >
> > Yes, I agree. This would however make it impossible to do a flicker-free
> > transition from bootloader to kernel, but that's not really a usecase I
> > have so I can live without it.
> >
> > Another point in favor of resetting is that the driver already does it.
> > Removing the reset of the OFF register may break some boards who rely on
> > that behaviour.
> > My version only extended the reset to include the ON register.
> >
> > >
> > > In short, it's a tradeoff between code complexity, and user
> friendliness/
> > > features.
> > >
> > > Sven
> >
> > Thierry, Uwe, what's your take on this?
> >
> > Thierry: Would you accept it if we continue to reset the registers in
> > .probe?
>
> Yes, I think it's fine to continue to reset the registers since that's
> basically what the driver already does. It'd be great if you could
> follow up with a patch that removes the reset and leaves the hardware in
> whatever state the bootloader has set up. Then we can take that patch
> for a ride and see if there are any complains about it breaking. If
> there are we can always try to fix them, but as a last resort we can
> also revert, which then may be something we have to live with. But I
> think we should at least try to make this consistent with how other
> drivers do this so that people don't stumble over this particular
> driver's


I guess we may miss (a PCB / silicon design flaw or warm boot case) when
boot loader left device completely untouched and device either in wrong
state because if failed reset (saw this on PCA9555 which has a
corresponding errata), or simply we have done a warm reset of the system.
So, we also have to understand how to properly exit.

Another point, CCF has a bit “is critical”, and u guess PWM may get the
same and make the all assumptions much easier.


>
> Thierry
>


-- 
With Best Regards,
Andy Shevchenko

[-- Attachment #2: Type: text/html, Size: 4821 bytes --]

  reply	other threads:[~2021-03-22  9:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20201216125320.5277-1-clemens.gruber@pqgruber.com>
     [not found] ` <20201216125320.5277-2-clemens.gruber@pqgruber.com>
2020-12-17  4:00   ` [PATCH v5 2/7] pwm: pca9685: Support hardware readout Sven Van Asbroeck
2020-12-17 17:43     ` Clemens Gruber
2020-12-17 17:52       ` Sven Van Asbroeck
2021-01-03 17:04         ` Clemens Gruber
2021-01-07 14:18           ` Sven Van Asbroeck
2021-01-11 20:43           ` Uwe Kleine-König
2021-03-22  8:34             ` Thierry Reding
2021-03-31 10:25               ` Uwe Kleine-König
2021-03-31 15:52                 ` Thierry Reding
2021-04-06  6:33                   ` Uwe Kleine-König
2021-04-06 13:47                     ` Thierry Reding
2021-04-06 20:44                       ` Uwe Kleine-König
2021-03-22  8:15           ` Thierry Reding
2021-01-11 20:35       ` Uwe Kleine-König
2021-01-14 17:16         ` Clemens Gruber
2021-01-14 18:05           ` Uwe Kleine-König
2021-03-22  8:53           ` Thierry Reding
2021-01-29 13:42         ` Sven Van Asbroeck
2021-01-29 16:31           ` Clemens Gruber
2021-01-29 18:05             ` Sven Van Asbroeck
2021-01-29 20:37               ` Clemens Gruber
2021-01-29 21:24                 ` Sven Van Asbroeck
2021-01-29 22:16                   ` Sven Van Asbroeck
2021-02-01 17:24                     ` Clemens Gruber
2021-03-01 21:52                       ` Uwe Kleine-König
2021-03-04 13:22                         ` Clemens Gruber
2021-02-14 14:46                 ` Clemens Gruber
2021-03-22  9:19                 ` Thierry Reding
2021-03-22  9:38                   ` Andy Shevchenko [this message]
2021-03-22 11:22                     ` Uwe Kleine-König
2021-03-22 11:40                       ` Andy Shevchenko
2021-03-22 11:48                         ` Uwe Kleine-König
2021-03-22 12:15                           ` Andy Shevchenko
2021-03-22 13:25                             ` Uwe Kleine-König
2021-03-27 16:05                   ` Clemens Gruber
2021-03-22  9:14               ` Thierry Reding
2021-03-22  8:47         ` Thierry Reding
2020-12-15 21:22 [PATCH v5 1/7] pwm: pca9685: Switch to atomic API Clemens Gruber
2020-12-15 21:22 ` [PATCH v5 2/7] pwm: pca9685: Support hardware readout Clemens Gruber

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='CAHp75Ve2FFEMsAv8S18bUDFsH2UkiQ5UvgcRtZ=j30syQtEirw@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=clemens.gruber@pqgruber.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thesven73@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).