All of lore.kernel.org
 help / color / mirror / Atom feed
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] ARM: i.MX27 pcm970: Add camera support
Date: Wed, 18 Aug 2010 21:33:52 +0100	[thread overview]
Message-ID: <20100818203352.GF15536@sirena.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.1008160018060.27810@axis700.grange>

On Wed, Aug 18, 2010 at 10:05:25PM +0200, Guennadi Liakhovetski wrote:

> 1. unbalanced regulator enable. IMHO, this is no exception to the general 
> enable / disable, alloc / free, lock / unlock etc. call balancing rule. If 
> your regulator has to stay enabled for the whole system run-time, you 
> don't have to (even try to) enable it multiple times. Please, either make 
> enabling / disabling symmetric, or leave only one enable in the 
> initialisation call.

If the regulator needs to be on all the time on a given board then
forcing this with always_on in the constraints is much more idiomatic
and straightforward.

> > +static int pcm970_camera_power_bus(struct device *dev, int toggle)
> > +{
> > +	struct regulator *regulator;
> > +
> > +	regulator = regulator_get(NULL, "imx_cam_vcc");
> > +	if (IS_ERR(regulator)) {
> > +		pr_err("unable to get regulator: %ld\n", PTR_ERR(regulator));
> > +		return -ENODEV;
> > +	} else {
> > +		if (!regulator_is_enabled(regulator) && toggle)
> > +			regulator_enable(regulator);
> > +	}
> > +	return 0;
> > +}

This is all very suspicious - your regulator_get() should be using the
struct device it was passed to look up the regulator by supply name
(probably "cam_vcc").  The regulator_is_enabled() call is going to break
if the supply is shared, too.

It all looks like something that I'd expect the camera driver to be
taking care of for itself, there's nothing board specific in here.

> > +	regulator = regulator_get(NULL, "imx_cam_vcc");
> > +	if (IS_ERR(regulator)) {
> > +		pr_err("unable to get regulator: %ld\n", PTR_ERR(regulator));
> > +		return -ENODEV;
> > +	} else if (!regulator_is_enabled(regulator)) {
> > +		regulator_enable(regulator);
> > +	}

Again, this looks like you need to add regulator support to the camera
driver.

  reply	other threads:[~2010-08-18 20:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03  9:20 [PATCH 0/2] Add camera support for i.MX27 Baseboards Michael Grzeschik
2010-08-03  9:20 ` [PATCH 1/2] ARM: i.MX27 pcm970: Add camera support Michael Grzeschik
2010-08-11  7:38   ` [PATCH v2] " Michael Grzeschik
2010-08-11 20:10     ` Guennadi Liakhovetski
2010-08-11 21:07       ` Michael Grzeschik
2010-08-12 20:27         ` Guennadi Liakhovetski
2010-08-15  8:55           ` Michael Grzeschik
2010-08-15  9:08           ` [PATCH v3] " Michael Grzeschik
2010-08-18 20:05             ` Guennadi Liakhovetski
2010-08-18 20:33               ` Mark Brown [this message]
2010-08-18 21:13                 ` Guennadi Liakhovetski
2010-08-18 21:46                   ` Mark Brown
2010-08-03  9:20 ` [PATCH 2/2] ARM: i.MX27 pca100: " Michael Grzeschik

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=20100818203352.GF15536@sirena.org.uk \
    --to=broonie@opensource.wolfsonmicro.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.