All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH 2/5] pcm990 baseboard: add camera bus width switch setting
Date: Tue, 14 Apr 2009 11:20:03 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0904141115070.1587@axis700.grange> (raw)
In-Reply-To: <20090414091005.GA14383@pengutronix.de>

On Tue, 14 Apr 2009, Sascha Hauer wrote:

> On Tue, Apr 14, 2009 at 10:57:32AM +0200, Guennadi Liakhovetski wrote:
> > On Thu, 9 Apr 2009, Guennadi Liakhovetski wrote:

[snip]

> > > > +static unsigned long pcm990_camera_query_bus_param(struct soc_camera_link *link)
> > > > +{
> > > > +	int ret;
> > > > +
> > > > +	if (!gpio_bus_switch) {
> > > > +		ret = gpio_request(NR_BUILTIN_GPIO + 1, "camera");
> > > 
> > > There's no gpio_free() now... So, for example, you cannot unload the 
> > > extender driver any more, unloading i2c adapter driver (i2c-pxa) produces 
> > > ugly stuff like
> > > 
> > > pca953x 0-0041: gpiochip_remove() failed, -16
> > > 
> > > So, we either have to request and free the GPIO in each query / set, or we 
> > > need an explicit .free_bus() call in soc_camera_link. None of the two 
> > > really pleases me, but maybe the latter is slightly less ugly, what do you 
> > > think?
> > > 
> > > Thanks
> > > Guennadi
> > > 
> > > > +		if (!ret) {
> > > > +			gpio_bus_switch = NR_BUILTIN_GPIO + 1;
> > > > +			gpio_direction_output(gpio_bus_switch, 0);
> > > > +		} else
> > > > +			gpio_bus_switch = -EINVAL;
> > > >  	}
> > 
> > If you first do not load pca953x and try to start capture, thus calling 
> > pcm990_camera_query_bus_param(), gpio_request() will fail and you get 
> > gpio_bus_switch < 0. Then if you load pca953x it doesn't help any more - 
> > by testing for "if (!gpio_bus_switch)" you do not retry after the first 
> > error.
> 
> So how do we proceed? Add init/exit functions for the bus?

If you don't object, I'll just add a .free_bus method to soc_camera_link, 
and switch pcm990 to only use two values: a negative value for a 
non-allocated gpio - either before the first attempt or after an error, 
thus re-trying every time if gpio is negative, in case a driver has been 
loaded in the meantime.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer

  reply	other threads:[~2009-04-14  9:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-12 11:27 [PATCH 0/5] V2: soc-camera: setting the buswidth of camera sensors Sascha Hauer
2009-03-12 11:27 ` [PATCH 1/5] soc-camera: add board hook to specify the buswidth for " Sascha Hauer
2009-03-12 11:27   ` [PATCH 2/5] pcm990 baseboard: add camera bus width switch setting Sascha Hauer
2009-03-12 11:27     ` [PATCH 3/5] mt9m001: allow setting of bus width from board code Sascha Hauer
2009-03-12 11:27       ` [PATCH 4/5] mt9v022: " Sascha Hauer
2009-03-12 11:27         ` [PATCH 5/5] soc-camera: remove now unused gpio member of struct soc_camera_link Sascha Hauer
2009-03-12 13:12     ` [PATCH 2/5] pcm990 baseboard: add camera bus width switch setting Guennadi Liakhovetski
2009-03-12 14:18       ` Sascha Hauer
2009-03-12 19:11         ` Guennadi Liakhovetski
2009-03-12 19:17           ` Sascha Hauer
2009-04-09 21:44         ` Guennadi Liakhovetski
2009-04-14  8:57           ` Guennadi Liakhovetski
2009-04-14  9:10             ` Sascha Hauer
2009-04-14  9:20               ` Guennadi Liakhovetski [this message]
2009-04-14  9:38                 ` Sascha Hauer
2009-04-14  9:53                   ` Guennadi Liakhovetski
2009-04-14  9:59                     ` Sascha Hauer
2009-03-12 13:31 ` [PATCH 0/5] V2: soc-camera: setting the buswidth of camera sensors Guennadi Liakhovetski
2009-03-12 14:19   ` Sascha Hauer

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=Pine.LNX.4.64.0904141115070.1587@axis700.grange \
    --to=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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.