public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Mark Brown <broonie@kernel.org>
Cc: Wei Ni <wni@nvidia.com>,
	khali@linux-fr.org, swarren@wwwdotorg.org,
	lm-sensors@lm-sensors.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] hwmon: (lm90) Add power control
Date: Mon, 9 Sep 2013 09:17:35 -0700	[thread overview]
Message-ID: <20130909161735.GC18975@roeck-us.net> (raw)
In-Reply-To: <20130909160237.GR29403@sirena.org.uk>

On Mon, Sep 09, 2013 at 05:02:37PM +0100, Mark Brown wrote:
> On Mon, Sep 09, 2013 at 08:50:43AM -0700, Guenter Roeck wrote:
> > On Mon, Sep 09, 2013 at 02:50:22PM +0100, Mark Brown wrote:
> 
> > > And indeed it does this (well, it does whatever the driver says in terms
> > > of delay).  However it is possible that the lm90 needs this time for
> > > itself - if it's doing some sort of initialisation or callibration
> > > sequence then that'll happen after the supplies come up.  25ms did seem
> > > rather long, especially for such simple devices, but it's not beyond the
> > > bounds of possibility.
> 
> > Even then it would be unreasonable to enforce such a delay for every instance
> > of this driver, even if the regulator is a dummy one and/or has been enabled
> > already. Many if not almost all users of the driver work just fine as-is,
> > without additional enforced delay (and, for that matter, without regulator ;).
> 
> > If there is a delay, it would have to be optional: Only wait if the regulator
> > was really turned on by the call and not already active. I don't know if the
> > regulator subsystem has this capability; if not, maybe it should.
> 
> It does, though it gets complicated trying to use it for a case like
> this since you can't really tell if the regulator was powered on
> immediately before the device got probed by another device on the bus.
> 
Why not ? Just keep a timestamp.

> > On a higher level, I wonder if such functionality should be added in the i2c
> > subsystem and not in i2c client drivers. Has anyone thought about this ?
> 
> I'm not sure what the subsystem would do for such delays?  It's fairly
> common for things that need this to also want to do things like
> manipulate GPIOs as part of the power on sequence so the applicability
> is relatively limited, plus it's not even I2C specific, the same applies
> to other buses so it ought to be a driver core thing.
> 
Possibly. I just thought about i2c since it also takes care of basic
devicetree bindings. Something along the line of
	if devicetree bindings for this device declare one or more
	regulators, enable those regulators before calling the driver
	probe function.

That was not intended to solve the delay problem, though. The delay problem
seems to be more of a generic regulator problem and, as I suggested, should
be solved in the regulator subsystem.
	if the regulator is enabled and the device specifies a poweron delay,
	wait for the specified amount of time after (and only after) enabling
	the regulator.

> There was some work on a generic helper for power on sequences but it
> stalled since it wasn't accepted for the original purpose (LCD panel
> power ons IIRC).

Too bad. I think it could be kept quite simple, though, by handling it
through the regulator subsystem as suggested above. A generic binding
for a per-regulator and per-device poweron delay should solve that
and possibly even make it transparent to the actual driver code.

Guenter

  reply	other threads:[~2013-09-09 16:17 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-09 10:29 [PATCH v3 0/2] Add power control for lm90 Wei Ni
     [not found] ` <1378722552-10357-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-09 10:29   ` [PATCH v3 1/2] hwmon: (lm90) Add power control Wei Ni
     [not found]     ` <1378722552-10357-2-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-09 11:12       ` Mark Brown
     [not found]         ` <20130909111242.GW29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-09 11:34           ` Guenter Roeck
     [not found]             ` <522DB253.6000707-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-09 13:50               ` Mark Brown
2013-09-09 15:50                 ` Guenter Roeck
2013-09-09 16:02                   ` Mark Brown
2013-09-09 16:17                     ` Guenter Roeck [this message]
     [not found]                       ` <20130909161735.GC18975-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-09 20:39                         ` Mark Brown
     [not found]                           ` <20130909203910.GV29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-10  4:05                             ` Wei Ni
     [not found]                               ` <522E9A85.9050803-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-10  4:50                                 ` Guenter Roeck
     [not found]                                   ` <522EA51C.90706-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-10  5:39                                     ` Wei Ni
     [not found]                                       ` <522EB0AF.9030708-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-10  5:54                                         ` Guenter Roeck
     [not found]                                           ` <522EB41E.9030005-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-10  6:30                                             ` Wei Ni
2013-09-10 10:13                                         ` Mark Brown
2013-09-10 11:29                                           ` Wei Ni
     [not found]                                             ` <522F02A4.7060702-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-10 12:11                                               ` Mark Brown
     [not found]                                                 ` <20130910121157.GJ29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-11  9:40                                                   ` Wei Ni
     [not found]                   ` <20130909155043.GA18975-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-10  3:22                     ` Wei Ni
     [not found]                       ` <522E9059.3070305-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-10  3:36                         ` Guenter Roeck
     [not found]                           ` <522E93D6.2010304-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-10  3:40                             ` Stephen Warren
2013-09-10  3:53                               ` Guenter Roeck
     [not found]                                 ` <522E97CE.4070300-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-10  4:12                                   ` Wei Ni
2013-09-10  4:13                                   ` Stephen Warren
     [not found]                                     ` <522E9C84.9070405-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-10  4:44                                       ` Guenter Roeck
2013-09-10 10:09                                       ` Mark Brown
     [not found]                                         ` <20130910100939.GW29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-10 15:07                                           ` Stephen Warren
     [not found]                                             ` <522F35BF.6070909-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-10 17:04                                               ` Mark Brown
     [not found]                                                 ` <20130910170438.GS29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-10 17:44                                                   ` Stephen Warren
     [not found]                                                     ` <522F5A65.8040907-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-10 18:07                                                       ` Guenter Roeck
2013-09-10 18:18                                                       ` Mark Brown
     [not found]                                                         ` <20130910181837.GD29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-10 18:37                                                           ` Stephen Warren
2013-09-10 18:52                                                             ` Mark Brown
     [not found]                                                               ` <20130910185235.GF29403-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-09-11 11:35                                                                 ` Wei Ni
2013-09-10 17:05                       ` Mark Brown
2013-09-09 10:29   ` [PATCH v3 2/2] Documentation: dt: hwmon: add OF document for LM90 Wei Ni
     [not found]     ` <1378722552-10357-3-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-09 10:52       ` Guenter Roeck
     [not found]         ` <522DA86B.6000603-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-09 22:14           ` Stephen Warren
     [not found]             ` <522E4854.1050800-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-10  4:25               ` Wei Ni
2013-09-09 10:57       ` Ramkumar Ramachandra
     [not found]         ` <CALkWK0nqgF6yn4QRe2tTD-Qd+5GLtH-ifCesayk-+uxkWMx-5w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-10  4:35           ` Wei Ni
     [not found]             ` <522EA177.6050608-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-10  4:36               ` Wei Ni
2013-09-09 22:15       ` Stephen Warren
     [not found]         ` <522E489D.6080903-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-09-09 22:23           ` Guenter Roeck
     [not found]             ` <20130909222330.GA31708-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2013-09-10  4:25               ` Wei Ni

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=20130909161735.GC18975@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=broonie@kernel.org \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=swarren@wwwdotorg.org \
    --cc=wni@nvidia.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