linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Doug Anderson <dianders@chromium.org>
Cc: Mark Brown <broonie@kernel.org>,
	Chunyan Zhang <zhang.chunyan@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	ckeepax@opensource.cirrus.com,
	LKML <linux-kernel@vger.kernel.org>,
	Sascha Hauer <kernel@pengutronix.de>
Subject: Re: [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage
Date: Mon, 7 Oct 2019 11:34:29 +0200	[thread overview]
Message-ID: <20191007093429.qekysnxufvkbirit@pengutronix.de> (raw)
In-Reply-To: <CAD=FV=XM0i=GsvttJjug6VPOJJGHRqFmsmCp-1XXNvmsYp9sJA@mail.gmail.com>

Hi Doug, Mark,

On 19-10-01 12:57, Doug Anderson wrote:
> Hi,
> 
> On Fri, Sep 27, 2019 at 1:47 AM Marco Felsch <m.felsch@pengutronix.de> wrote:
> > > > > > It should be possible to do a regulator_disable() though I'm not
> > > > > > sure anyone actually uses that.  The pattern for a regular
> > > > > > consumer should be the normal enable/disable pair to handle
> > > > > > shared usage, only an exclusive consumer should be able to use
> > > > > > just a straight disable.
> >
> > In my case it is a regulator-fixed which uses the enable/disable pair.
> > But as my descriptions says this will not work currently because boot-on
> > marked regulators can't be disabled right now (using the same logic as
> > always-on regulators).
> >
> > > > > Ah, I see, I wasn't aware of the "exclusive" special case!  Marco: is
> > > > > this working for you?  I wonder if we need to match
> > > > > "regulator->enable_count" to "rdev->use_count" at the end of
> > > > > _regulator_get() in the exclusive case...
> >
> > So my fix isn't correct to fix this in general?
> 
> I don't think your fix is correct.  It sounds as if the intention of
> "regulator-boot-on" is to have the OS turn the regulator on at bootup
> and it keep an implicit reference until someone explicitly tells the
> OS to drop the reference.
> 
> 
> > > > Yes, I think that case has been missed when adding the enable
> > > > counts - I've never actually had a system myself that made any
> > > > use of this stuff.  It probably needs an audit of the users to
> > > > make sure nobody's relying on the current behaviour though I
> > > > can't think how they would.
> > >
> > > Marco: I'm going to assume you'll tackle this since I don't actually
> > > have any use cases that need this.
> >
> > My use case is a simple regulator-fixed which is turned on by the
> > bootloader or to be more precise by the pmic-rom. To map that correctly
> > I marked this regulator as boot-on. Unfortunately as I pointed out above
> > this is handeld the same way as always-on.
> 
> It's a fixed regulator controlled by a GPIO?  Presumably the GPIO can
> be read.  That would mean it ideally shouldn't be using
> "regulator-boot-on" since this is _not_ a regulator whose software
> state can't be read.  Just remove the property.

Sorry that won't fix my problem. If I drop the regulator-boot-on state
the fixed-regulator will disable this regulator but disable/enable this
regulator is only valid during suspend/resume. I don't say that my fix
is correct but we should fix this.

Regards,
  Marco

> -Doug
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  parent reply	other threads:[~2019-10-07  9:34 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 15:40 [PATCH 0/3] Regulator core fixes Marco Felsch
2019-09-17 15:40 ` [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage Marco Felsch
2019-09-23 18:02   ` Doug Anderson
2019-09-23 18:14     ` Mark Brown
2019-09-23 18:36       ` Doug Anderson
2019-09-23 18:49         ` Mark Brown
2019-09-23 22:40           ` Doug Anderson
2019-09-24 18:27             ` Mark Brown
2019-09-26 19:44               ` Doug Anderson
2019-09-27  8:47                 ` Marco Felsch
2019-10-01 19:57                   ` Doug Anderson
2019-10-04  6:34                     ` Matti Vaittinen
2019-10-04 11:32                       ` Mark Brown
2019-10-04 12:03                         ` Vaittinen, Matti
2019-10-04 15:01                           ` Mark Brown
2019-10-07  9:34                     ` Marco Felsch [this message]
2019-10-07 18:29                       ` Mark Brown
2019-10-08  6:03                         ` Marco Felsch
2019-10-08 12:51                           ` Mark Brown
2019-10-08 14:56                             ` Marco Felsch
2019-10-08 15:42                               ` Mark Brown
2019-10-08 16:16                                 ` Marco Felsch
2019-10-08 16:23                                   ` Mark Brown
2019-10-08 20:16                                     ` Marco Felsch
2019-10-09  9:54                                       ` Mark Brown
2019-09-17 15:40 ` [PATCH 2/3] regulator: of: fix suspend-min/max-voltage parsing Marco Felsch
2019-09-17 16:02   ` Applied "regulator: of: fix suspend-min/max-voltage parsing" to the regulator tree Mark Brown
2019-09-17 15:40 ` [PATCH 3/3] regulator: core: make regulator_register() EPROBE_DEFER aware Marco Felsch
2019-09-17 16:02   ` Applied "regulator: core: make regulator_register() EPROBE_DEFER aware" to the regulator tree Mark Brown
2019-09-18  0:57   ` [PATCH 3/3] regulator: core: make regulator_register() EPROBE_DEFER aware Dmitry Torokhov
2019-09-18  8:18     ` Marco Felsch
2019-09-18 15:53       ` Dmitry Torokhov
2019-09-18 16:06         ` Marco Felsch
2019-09-18 16:08         ` Mark Brown

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=20191007093429.qekysnxufvkbirit@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=dianders@chromium.org \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhang.chunyan@linaro.org \
    /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).