public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@sirena.org.uk>
To: David Brownell <david-b@pacbell.net>
Cc: "Aggarwal, Anuj" <anuj.aggarwal@ti.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: Problems while designing TPS65023 regulator driver
Date: Sun, 8 Mar 2009 22:41:45 +0000	[thread overview]
Message-ID: <20090308224145.GD18035@sirena.org.uk> (raw)
In-Reply-To: <200903081354.36044.david-b@pacbell.net>

On Sun, Mar 08, 2009 at 12:54:35PM -0800, David Brownell wrote:

> but the bootloader turned the regulator on, then drivers
> can't disable the regulator (on penalty of a stackdump!)
> unless they issue a spurious/pointless/undesirable enable()
> beforehand ...

We can't easily have both reference counting and unbalanced disables,
sadly.

>  - Regulators not marked as "boot_on" or "always_on" won't
>    be active (and usecount will be 0) on return from setup.

This breaks the idea that we don't do anything unless explictly told to
do so.  I did actually still consider adding code to power off the
regulator but thought that there may also be situations where the state
really is unknown (eg, it depends on what the system booted from) and
it'd be useful to be able to punt to the consumers to figure it out.

I'm a bit ambivalent on this one, though - avoiding a sprawl of options
is certainly neater.  An enum for the initial power state has an appeal
here.

> -	/* are we enabled at boot time by firmware / bootloader */
> -	if (rdev->constraints->boot_on)
> -		rdev->use_count = 1;
> -

That's not there with the current regulator tree (this was the bug with
not being able to disable boot_on regulators, there's no way to drop
that use count later on).

Much of the rest of your patch will fail to apply due to similar
changes; the logic that's there now is roughly the same as what you have
here except we don't bother to check is_enabled() any more (no harm
adding that back, it'd be useful if enable() can't be called for an
already enabled regulator) and we don't disable the regulator.

> +		} else if (is_enabled < 0) {
> +			pr_warning("%s: hoping regulator '%s' is %sd...\n",
> +				       __func__, name, "enable");
> +		}

I'm really not loving this %s for the enabled - yes, it'll save a small
amount of memory but it hurts gepability.

  reply	other threads:[~2009-03-08 22:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26  9:11 Problems while designing TPS65023 regulator driver Aggarwal, Anuj
2009-02-26 14:04 ` Mark Brown
2009-03-05 12:03   ` Aggarwal, Anuj
2009-03-06 13:34     ` Mark Brown
2009-03-07  0:07       ` David Brownell
2009-03-07 16:22         ` Mark Brown
2009-03-08 20:54           ` David Brownell
2009-03-08 22:41             ` Mark Brown [this message]
2009-03-10  0:45               ` David Brownell
2009-03-10 23:33                 ` Mark Brown
2009-04-03  8:03   ` Aggarwal, Anuj
2009-04-03  8:53     ` Mark Brown
2009-04-04  0:05       ` Tony Lindgren
2009-04-23 13:30         ` Trilok Soni
2009-04-23 22:17           ` David Brownell
2009-04-24  6:01             ` Trilok Soni
2009-04-24  6:05               ` Aggarwal, Anuj
2009-04-24  6:32               ` David Brownell
2009-04-24  8:12                 ` Aggarwal, Anuj

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=20090308224145.GD18035@sirena.org.uk \
    --to=broonie@sirena.org.uk \
    --cc=anuj.aggarwal@ti.com \
    --cc=david-b@pacbell.net \
    --cc=linux-omap@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox