public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <daniel@caiaq.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-kernel@vger.kernel.org, Liam Girdwood <lrg@slimlogic.co.uk>,
	Pierre Ossman <pierre@ossman.eu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Matt Fleming <matt@console-pimps.org>,
	Adrian Hunter <adrian.hunter@nokia.com>,
	David Brownell <dbrownell@users.sourceforge.net>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Linus Walleij <linus.walleij@stericsson.com>,
	Eric Miao <eric.y.miao@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Cliff Brake <cbrake@bec-systems.com>,
	Jarkko Lavinen <jarkko.lavinen@nokia.com>,
	linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mmc: move regulator handling to core
Date: Thu, 3 Dec 2009 14:14:23 +0100	[thread overview]
Message-ID: <20091203131423.GV14091@buzzloop.caiaq.de> (raw)
In-Reply-To: <20091203130627.GA31254@rakim.wolfsonmicro.main>

On Thu, Dec 03, 2009 at 01:06:27PM +0000, Mark Brown wrote:
> On Thu, Dec 03, 2009 at 01:46:30PM +0100, Daniel Mack wrote:
> > At the moment, regulator operations are done from individual mmc host
> > drivers. This is a problem because the regulators are not claimed
> > exclusively but the mmc core enables and disables them according to the
> 
> This is historical, they can all be converted to regulator_get_exclusive()
> so the move to the core (while good) isn't required for this reason.

Is it? What if you share one regulator for two slots? While this isn't a
problem I have met in real life, this should still be considered.

The problem I _did_ see, however, was a warning when the regulator was
marked as always_on in its constraints. What happens then is that
regulator_is_enabled() will always return 1, causing the pxamci code to

 - call regulator_disable() on power off, but
 - _not_ call regulator_enable() in the oposite case

and that brings the regulator's reference count out of sync.

Making those drivers claim their regulators exclusively _does_ solve the
first problem, but not the latter.

> >  	case MMC_POWER_OFF:
> > -		if(host->vcc &&
> > -		   regulator_is_enabled(host->vcc))
> > -			regulator_disable(host->vcc);
> > +		if(mmc->vcc && mmc->vcc_enabled) {
> > +			regulator_disable(mmc->vcc);
> > +			mmc->vcc_enabled = 0;
> > +		}
> 
> Can the MMC core actually tolerate the MMC power not getting killed when
> expected?  My understanding from previous discussion was that it wasn't
> able to do so.  If it is then conversion to using regulator_get_exclusive()
> isn't desirable, of course.

I would expect the power to be killed when the last user stops using it.
Which should result in the same effect if you only have one host, one
regulator, and one user.

Daniel


  reply	other threads:[~2009-12-03 13:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 12:46 [PATCH] mmc: move regulator handling to core Daniel Mack
2009-12-03 13:06 ` Mark Brown
2009-12-03 13:14   ` Daniel Mack [this message]
2009-12-03 13:22     ` Mark Brown
2009-12-03 13:32       ` Daniel Mack
2009-12-03 13:40         ` Mark Brown
2009-12-03 13:43           ` Daniel Mack
2009-12-03 14:58       ` Russell King - ARM Linux
2009-12-03 15:09         ` Mark Brown
2009-12-03 14:27 ` Adrian Hunter
2009-12-03 19:20   ` Daniel Mack
2009-12-03 20:12     ` Adrian Hunter
2009-12-04 11:58       ` Daniel Mack
2009-12-12  0:58         ` Daniel Mack
2009-12-14 17:43           ` Madhusudhan
2009-12-15  5:44         ` David Brownell
2010-08-27 19:03 ` Chris Ball
2010-08-28 14:48   ` Linus Walleij
2010-08-29 13:27     ` Mark Brown
2010-08-29 15:30       ` Linus Walleij
2010-08-31 11:07         ` Mark Brown
2010-08-31 12:15           ` Linus Walleij

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=20091203131423.GV14091@buzzloop.caiaq.de \
    --to=daniel@caiaq.de \
    --cc=adrian.hunter@nokia.com \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=cbrake@bec-systems.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=eric.y.miao@gmail.com \
    --cc=jarkko.lavinen@nokia.com \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=matt@console-pimps.org \
    --cc=pierre@ossman.eu \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=robert.jarzmik@free.fr \
    /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