linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: daniel@caiaq.de (Daniel Mack)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 13/17] ARM: pxa/raumfeld: add Marvell Libertas via SDIO
Date: Wed, 25 Nov 2009 14:04:35 +0100	[thread overview]
Message-ID: <20091125130435.GD14091@buzzloop.caiaq.de> (raw)
In-Reply-To: <20091125114946.GB3175@sirena.org.uk>

On Wed, Nov 25, 2009 at 11:49:47AM +0000, Mark Brown wrote:
> On Wed, Nov 25, 2009 at 11:42:27AM +0100, Daniel Mack wrote:
> 
> > +#include <linux/regulator/consumer.h>
> 
> The regulator consumer stuff here feels like it'd be better put into the
> driver itself since it doesn't seem to be specific to the machine -
> other machines could use the same glue with different machine setup.

AH, the pxamci driver already does that. So I'll just name the supply
'vmmc' and that's it. Will test that soon.

> > +static void raumfeld_mci_setpower(struct device *dev, unsigned int on)
> > +{
> > +	int ret = 0;
> > +	struct regulator *regulator = regulator_get(dev, "vcc_wifi");
> 
> Don't do this, take one reference to the regulaor at startup and then
> use that throughout the lifetime of the sysetm.  If you don't do that
> then the API may decide that the regulator is idle and disable it for
> you.
> 
> I suspect that supply name might want to be just plain "vcc" unless the
> chip really does have a single supply labelled as vcc_wifi - the name
> should ideally match that used in the datasheet.
> 
> > +
> > +	/* bring up V6 for SDIO/WLAN */
> > +	if (IS_ERR(regulator)) {
> > +		printk(KERN_ERR "%s(): unable to get regulator. err = %ld\n",
> > +			__func__, PTR_ERR(regulator));
> > +		return;
> > +	}
> > +
> > +	if (on && !regulator_is_enabled(regulator)) {
> > +		ret = regulator_enable(regulator);
> 
> Nack, if you're doing regulator_get() you should never need to check
> regulator_is_enabled() since you can't know if something else is
> incrementing or decrementing the reference count independantly of you.
> Either use regulator_get_exclusive() (at which point you own the
> regulator) or keep track of the on/off switch yourself.

The issue I was facing here was that the mmc power enable callback was
called more than once with the same value for 'on', so the calls were
not balanced and the regulator driver bailed.

Anyway, that will all go away when letting the driver do the regultar
calls. Thanks for explaining that.

Daniel

  reply	other threads:[~2009-11-25 13:04 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 10:42 ARM: pxa: add support for Raumfeld audio devices Daniel Mack
2009-11-25 10:42 ` [PATCH 01/17] ARM: pxa/raumfeld: add basic structure for devices Daniel Mack
2009-11-25 15:26   ` Mike Rapoport
2009-11-25 15:44     ` Daniel Mack
2009-11-25 16:51     ` Marek Vasut
2009-11-25 17:06       ` Russell King - ARM Linux
2009-11-25 10:42 ` [PATCH 02/17] ARM: pxa/raumfeld: add GPIO definitions Daniel Mack
2009-11-25 10:42 ` [PATCH 03/17] ARM: pxa/raumfeld: add SMSC9220 ethernet support Daniel Mack
2009-11-25 15:26   ` Mike Rapoport
2009-11-25 15:49     ` Daniel Mack
2009-11-25 16:56       ` Russell King - ARM Linux
2009-11-26 17:55         ` Daniel Mack
2009-11-25 10:42 ` [PATCH 04/17] ARM: pxa/raumfeld: add OHCI function Daniel Mack
2009-11-25 10:42 ` [PATCH 05/17] ARM: pxa/raumfeld: add rotary encoder support Daniel Mack
2009-11-25 15:26   ` Mike Rapoport
2009-11-25 15:50     ` Daniel Mack
2009-11-25 16:59     ` Russell King - ARM Linux
2009-11-25 10:42 ` [PATCH 06/17] ARM: pxa/raumfeld: add GPIO buttons Daniel Mack
2009-11-25 10:42 ` [PATCH 07/17] ARM: pxa/raumfeld: add GPIO connected LEDs Daniel Mack
2009-11-25 10:42 ` [PATCH 08/17] ARM: pxa/raumfeld: add one-wire function Daniel Mack
2009-11-25 17:02   ` Russell King - ARM Linux
2009-11-25 10:42 ` [PATCH 09/17] ARM: pxa/raumfeld: add NAND partitions Daniel Mack
2009-11-25 15:26   ` Mike Rapoport
2009-11-25 10:42 ` [PATCH 10/17] ARM: pxa/raumfeld: add framebuffer and backlight devices Daniel Mack
2009-11-25 10:42 ` [PATCH 11/17] ARM: pxa/raumfeld: add SPI controlled devices Daniel Mack
2009-11-25 10:42 ` [PATCH 12/17] ARM: pxa/raumfeld: add audio related functions Daniel Mack
2009-11-25 11:41   ` Mark Brown
2009-11-25 12:28     ` Daniel Mack
2009-11-25 13:07       ` Mark Brown
2009-11-25 13:53         ` Daniel Mack
2009-11-25 14:00           ` Mark Brown
2009-11-25 17:07   ` Russell King - ARM Linux
2009-11-25 10:42 ` [PATCH 13/17] ARM: pxa/raumfeld: add Marvell Libertas via SDIO Daniel Mack
2009-11-25 11:49   ` Mark Brown
2009-11-25 13:04     ` Daniel Mack [this message]
2009-11-25 13:36       ` Mark Brown
2009-11-25 10:42 ` [PATCH 14/17] ARM: pxa/raumfeld: add power supply framework Daniel Mack
2009-11-25 10:42 ` [PATCH 15/17] ARM: pxa/raumfeld: add support for I2C controlled devices Daniel Mack
2009-11-25 10:42 ` [PATCH 16/17] ALSA: ARM: add Raumfeld audio support Daniel Mack
2009-11-25 11:02   ` Mark Brown
2009-11-25 12:24     ` Daniel Mack
2009-11-25 13:29       ` Mark Brown
2009-11-26 17:51         ` Daniel Mack
2009-11-25 10:42 ` [PATCH 17/17] ARM: pxa/raumfeld: Add defconfig Daniel Mack
2009-11-25 11:27 ` ARM: pxa: add support for Raumfeld audio devices Mike Rapoport
2009-11-25 12:14   ` Daniel Mack

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=20091125130435.GD14091@buzzloop.caiaq.de \
    --to=daniel@caiaq.de \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).