All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Mark Brown <broonie@kernel.org>
Cc: David Collins <collinsd@codeaurora.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-msm@vger.kernel.org,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	devicetree@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Rajendra Nayak <rnayak@codeaurora.org>,
	Stephen Boyd <sboyd@kernel.org>
Subject: Re: [PATCH v3 1/2] regulator: dt-bindings: add QCOM RPMh regulator bindings
Date: Tue, 29 May 2018 22:30:33 -0700	[thread overview]
Message-ID: <CAD=FV=W4aDxWbcaJ9GZ1KkvyiTPAPR-oUoTFzJfS+LftU5ZP=Q@mail.gmail.com> (raw)
In-Reply-To: <20180523155617.GN4828@sirena.org.uk>

Hi,

On Wed, May 23, 2018 at 8:56 AM, Mark Brown <broonie@kernel.org> wrote:
> On Wed, May 23, 2018 at 08:50:22AM -0700, Doug Anderson wrote:
>> On Wed, May 23, 2018 at 8:40 AM, Mark Brown <broonie@kernel.org> wrote:
>
>> > It's got to be valid to think about the voltage of a disabled regulator
>> > since drivers want to be able make sure that the regulator gets enabled
>> > with a sensible config.  With most hardware this is really easy since
>> > you can just look at the status reported by the hardware but the RPM
>> > makes this hard since there's so much write only stuff in there.
>
>> I should be more clear.  Certainly it should be valid to set the
>> voltage before enabling it so, as you said, the regulator turns on at
>> the right voltage.  I'm saying that it's weird (to me) to expect that
>> setting the voltage for a regulator that a client thinks is disabled
>> will affect any real voltages in the system until the regulator is
>> enabled.  In RPMh apparently setting a voltage of a regulator you
>> think is disabled can affect the regulator output if another client
>> (unbeknownst to you) happens to have it enabled.
>
> Yes, that's definitely not what's expected but it's unfortunately what
> the firmware chose to implement so we may well be stuck with it
> unfortunately.

We're not really stuck with it if we do what I was suggesting.  I was
suggesting that every time we disable the regulator in Linux we have
Linux vote for the lowest voltage it's comfortable with.  Linux keeps
track of the true voltage that the driver wants and will always change
its vote back to that before enabling.  Thus (assuming Linux is OK
with 1.2 V - 1.4 V for a rail):

Modem: want 1.3 V and enabled.
=> Modem votes for 1.3 V
=> Modem votes for enabled.
=> At least one vote for enabled? Yes
=> Highest voltage vote: 1.3V
=> True output: 1.3V

Linux: want 1.4 V and enabled.
=> Linux votes for 1.4 V
=> Linux votes for enabled
=> At least one vote for enabled? Yes
=> Highest voltage vote: 1.4V
=> True output: 1.4V

Linux: want disabled
=> Linux votes for disabled
=> Linux votes for 1.2 V (keeps 1.4 V in local var)
=> At least one vote for enabled? Yes
=> Highest voltage vote: 1.3V
=> True output: 1.3V

Linux: want enabled
=> Linux votes for 1.4 V (from local var)
=> Linux votes for enabled
=> At least one vote for enabled? Yes
=> Highest voltage vote: 1.4V
=> True output: 1.4V


...but I'll leave it to you if you think this is a big deal.  If
you're happy with how David's driver works without my suggestion then
I won't push it.

-Doug

WARNING: multiple messages have this Message-ID (diff)
From: dianders@chromium.org (Doug Anderson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] regulator: dt-bindings: add QCOM RPMh regulator bindings
Date: Tue, 29 May 2018 22:30:33 -0700	[thread overview]
Message-ID: <CAD=FV=W4aDxWbcaJ9GZ1KkvyiTPAPR-oUoTFzJfS+LftU5ZP=Q@mail.gmail.com> (raw)
In-Reply-To: <20180523155617.GN4828@sirena.org.uk>

Hi,

On Wed, May 23, 2018 at 8:56 AM, Mark Brown <broonie@kernel.org> wrote:
> On Wed, May 23, 2018 at 08:50:22AM -0700, Doug Anderson wrote:
>> On Wed, May 23, 2018 at 8:40 AM, Mark Brown <broonie@kernel.org> wrote:
>
>> > It's got to be valid to think about the voltage of a disabled regulator
>> > since drivers want to be able make sure that the regulator gets enabled
>> > with a sensible config.  With most hardware this is really easy since
>> > you can just look at the status reported by the hardware but the RPM
>> > makes this hard since there's so much write only stuff in there.
>
>> I should be more clear.  Certainly it should be valid to set the
>> voltage before enabling it so, as you said, the regulator turns on at
>> the right voltage.  I'm saying that it's weird (to me) to expect that
>> setting the voltage for a regulator that a client thinks is disabled
>> will affect any real voltages in the system until the regulator is
>> enabled.  In RPMh apparently setting a voltage of a regulator you
>> think is disabled can affect the regulator output if another client
>> (unbeknownst to you) happens to have it enabled.
>
> Yes, that's definitely not what's expected but it's unfortunately what
> the firmware chose to implement so we may well be stuck with it
> unfortunately.

We're not really stuck with it if we do what I was suggesting.  I was
suggesting that every time we disable the regulator in Linux we have
Linux vote for the lowest voltage it's comfortable with.  Linux keeps
track of the true voltage that the driver wants and will always change
its vote back to that before enabling.  Thus (assuming Linux is OK
with 1.2 V - 1.4 V for a rail):

Modem: want 1.3 V and enabled.
=> Modem votes for 1.3 V
=> Modem votes for enabled.
=> At least one vote for enabled? Yes
=> Highest voltage vote: 1.3V
=> True output: 1.3V

Linux: want 1.4 V and enabled.
=> Linux votes for 1.4 V
=> Linux votes for enabled
=> At least one vote for enabled? Yes
=> Highest voltage vote: 1.4V
=> True output: 1.4V

Linux: want disabled
=> Linux votes for disabled
=> Linux votes for 1.2 V (keeps 1.4 V in local var)
=> At least one vote for enabled? Yes
=> Highest voltage vote: 1.3V
=> True output: 1.3V

Linux: want enabled
=> Linux votes for 1.4 V (from local var)
=> Linux votes for enabled
=> At least one vote for enabled? Yes
=> Highest voltage vote: 1.4V
=> True output: 1.4V


...but I'll leave it to you if you think this is a big deal.  If
you're happy with how David's driver works without my suggestion then
I won't push it.

-Doug

  reply	other threads:[~2018-05-30  5:30 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-12  2:28 [PATCH v3 0/2] regulator: add QCOM RPMh regulator driver David Collins
2018-05-12  2:28 ` David Collins
2018-05-12  2:28 ` David Collins
2018-05-12  2:28 ` [PATCH v3 1/2] regulator: dt-bindings: add QCOM RPMh regulator bindings David Collins
2018-05-12  2:28   ` David Collins
2018-05-17 21:22   ` Doug Anderson
2018-05-17 21:22     ` Doug Anderson
2018-05-18  0:16     ` David Collins
2018-05-18  0:16       ` David Collins
2018-05-18  1:01       ` Doug Anderson
2018-05-18  1:01         ` Doug Anderson
2018-05-19  0:46         ` David Collins
2018-05-19  0:46           ` David Collins
2018-05-21 18:01           ` Doug Anderson
2018-05-21 18:01             ` Doug Anderson
2018-05-22  0:00             ` David Collins
2018-05-22  0:00               ` David Collins
2018-05-22 16:43               ` Doug Anderson
2018-05-22 16:43                 ` Doug Anderson
2018-05-22 16:43                 ` Doug Anderson
2018-05-22 16:55                 ` Mark Brown
2018-05-22 16:55                   ` Mark Brown
2018-05-22 22:46                 ` David Collins
2018-05-22 22:46                   ` David Collins
2018-05-23  0:08                   ` Doug Anderson
2018-05-23  0:08                     ` Doug Anderson
2018-05-23  1:19                     ` David Collins
2018-05-23  1:19                       ` David Collins
2018-05-23  5:10                       ` Doug Anderson
2018-05-23  5:10                         ` Doug Anderson
2018-05-23  8:29                     ` Mark Brown
2018-05-23  8:29                       ` Mark Brown
2018-05-23 15:23                       ` Doug Anderson
2018-05-23 15:23                         ` Doug Anderson
2018-05-23 15:40                         ` Mark Brown
2018-05-23 15:40                           ` Mark Brown
2018-05-23 15:50                           ` Doug Anderson
2018-05-23 15:50                             ` Doug Anderson
2018-05-23 15:56                             ` Mark Brown
2018-05-23 15:56                               ` Mark Brown
2018-05-30  5:30                               ` Doug Anderson [this message]
2018-05-30  5:30                                 ` Doug Anderson
2018-05-30  9:37                                 ` Mark Brown
2018-05-30  9:37                                   ` Mark Brown
2018-05-30 14:46                                   ` Doug Anderson
2018-05-30 14:46                                     ` Doug Anderson
2018-05-30 15:02                                     ` Mark Brown
2018-05-30 15:02                                       ` Mark Brown
2018-05-30 15:34                                       ` Doug Anderson
2018-05-30 15:34                                         ` Doug Anderson
2018-05-30 15:48                                         ` Mark Brown
2018-05-30 15:48                                           ` Mark Brown
2018-05-30 16:06                                           ` Doug Anderson
2018-05-30 16:06                                             ` Doug Anderson
2018-05-30 16:07                                             ` Mark Brown
2018-05-30 16:07                                               ` Mark Brown
2018-05-30 16:09                                               ` Doug Anderson
2018-05-30 16:09                                                 ` Doug Anderson
2018-05-30 16:13                                                 ` Mark Brown
2018-05-30 16:13                                                   ` Mark Brown
2018-05-30 16:31                                                   ` Doug Anderson
2018-05-30 16:31                                                     ` Doug Anderson
2018-05-30 16:36                                                     ` Mark Brown
2018-05-30 16:36                                                       ` Mark Brown
2018-05-30 16:41                                                       ` Doug Anderson
2018-05-30 16:41                                                         ` Doug Anderson
2018-05-30 16:41                                                         ` Doug Anderson
2018-05-30 16:59                                                         ` Mark Brown
2018-05-30 16:59                                                           ` Mark Brown
2018-05-18 22:24       ` Rob Herring
2018-05-18 22:24         ` Rob Herring
2018-05-12  2:28 ` [PATCH v3 2/2] regulator: add QCOM RPMh regulator driver David Collins
2018-05-12  2:28   ` David Collins
2018-05-17 21:23   ` Doug Anderson
2018-05-17 21:23     ` Doug Anderson
2018-05-18  0:16     ` David Collins
2018-05-18  0:16       ` David Collins

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='CAD=FV=W4aDxWbcaJ9GZ1KkvyiTPAPR-oUoTFzJfS+LftU5ZP=Q@mail.gmail.com' \
    --to=dianders@chromium.org \
    --cc=broonie@kernel.org \
    --cc=collinsd@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rnayak@codeaurora.org \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.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 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.