public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <tomasz.figa@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Doug Anderson <dianders@chromium.org>,
	Olof Johansson <olof@lixom.net>,
	Yuvaraj Kumar C D <yuvaraj.cd@gmail.com>,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] regulator: max77802: set opmode to normal if off is read from hw
Date: Wed, 27 Aug 2014 22:41:42 +0200	[thread overview]
Message-ID: <53FE4286.3050305@gmail.com> (raw)
In-Reply-To: <20140827202554.GW17528@sirena.org.uk>

On 27.08.2014 22:25, Mark Brown wrote:
> On Wed, Aug 27, 2014 at 09:58:55PM +0200, Tomasz Figa wrote:
>> On 27.08.2014 21:44, Mark Brown wrote:
> 
>>> The point is that if anything was setting the mode to something other
>>> than normal it was almost certainly a previously running copy of Linux
>>> and one would expect that if the mode does need to be changed the new
>>> copy will be doing that anyway.  It's rare enough to need to actively
>>> manage modes in the first place.
> 
>> From what I know based on my experience with Samsung boards we used, the
>> opmodes of regulators are preconfigured by board bootloader to certain
>> values based on power design of the board (i.e. there is no need to keep
>> a regulator in full power mode, if on given board only a little fraction
>> of it is needed).
> 
> Well, presumably the bootloader is going to run again even for a warm
> reboot?

This is strange, but apparently it's not the case for the hardware which
this patch is supposed to fix or at least this is how I understood it.

> 
>> Now Linux should not change this mode (excluding cases when the values
>> in the bootloader are wrong - they happen unfortunately), so I'm not
>> getting why you say that it is Linux which changes the mode to something
>> other than normal. Linux should only toggle between the value resulting
>> from power design and off.
> 
> It's not in general true that Linux should never change the mode (the
> main case for toggling modes is usually going between an idle/suspend
> state and active state)

I believe this is yet another reason why we should have a way to specify
opmodes in DT, now not only active but also suspend/idle opmodes.

However on many PMICs this is a bit more complicated. There are opmodes
such as

1) Regulator powered off.
2) Regulator powered off if certain pin is active, regulator powered
   on otherwise.
3) Regulator powered on.

some of them might also have more interesting combinations, e.g.

4) Regulator powered off if certain pin is active, regulator powered on
   in low power mode otherwise.
5) Regulator powered on in lower power mode if certain pin is active,
   regulator powered on in full power mode otherwise.

They all go to the same opmode field, as "off", "low power", "normal"
mentioned earlier in this thread.

> and for practical purposes bootloader and
> hardware defaults tend to be the same.

Not on the boards I worked with. At least when it's just about the
difference between normal and low power modes. I believe the hardware
will always default to normal just to be safe, so to optimize power on
the board, the bootloader will switch those which don't need full power
to low power mode.

I believe we shouldn't even rely on the bootloader here, as we all know
that often all you can expect from them is to load and jump to your
kernel and even some of them can't do this properly...

> You're talking about the case
> where the bootloader does set something but avoids doing so on warm
> reboots only here.

>From Javier's description I understood this is the case for the board
for which he develops.

> 
> Besides, even if we did have a way of specifying modes in DT (with all
> the problems that brings) we still have to pick a default if that's not
> used).

Sure we do and we can define the binding to default to something (e.g.
normal mode) if respective property is not present. Btw. the issue with
opmode also affects other PMIC chips such as Samsung S5M ones.

Best regards,
Tomasz

  reply	other threads:[~2014-08-27 20:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 11:37 [PATCH 1/1] regulator: max77802: set opmode to normal if off is read from hw Javier Martinez Canillas
2014-08-26 15:44 ` Doug Anderson
2014-08-27  6:47 ` Yuvaraj Kumar
2014-08-27 17:51 ` Mark Brown
2014-08-27 18:32 ` Tomasz Figa
2014-08-27 18:37   ` Mark Brown
2014-08-27 18:39     ` Tomasz Figa
2014-08-27 18:47       ` Mark Brown
2014-08-27 18:52         ` Tomasz Figa
2014-08-27 19:15           ` Mark Brown
2014-08-27 19:21             ` Tomasz Figa
2014-08-27 19:44               ` Mark Brown
2014-08-27 19:58                 ` Tomasz Figa
2014-08-27 20:25                   ` Mark Brown
2014-08-27 20:41                     ` Tomasz Figa [this message]
2014-08-27 21:03                       ` Tomasz Figa
2014-08-27 22:44                         ` Javier Martinez Canillas
2014-08-28  8:28                           ` Mark Brown
2014-08-28  9:59                             ` Javier Martinez Canillas
2014-08-28 10:01                               ` Mark Brown
2014-08-27 21:03                       ` 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=53FE4286.3050305@gmail.com \
    --to=tomasz.figa@gmail.com \
    --cc=broonie@kernel.org \
    --cc=dianders@chromium.org \
    --cc=javier.martinez@collabora.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=yuvaraj.cd@gmail.com \
    /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