All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: martin@neutronstar.dyndns.org
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v3] v4l: Add driver for Micron MT9M032 camera sensor
Date: Mon, 19 Dec 2011 23:43:32 +0200	[thread overview]
Message-ID: <20111219214332.GM3677@valkosipuli.localdomain> (raw)
In-Reply-To: <1324115451.942577.4988@localhost>

Hi Martin,

On Sat, Dec 17, 2011 at 10:50:51AM +0100, martin@neutronstar.dyndns.org wrote:
> On Thu, Dec 15, 2011 at 12:11:13AM +0200, Sakari Ailus wrote:
> > Hi Martin,
> > 
> > On Wed, Dec 14, 2011 at 07:58:45PM +0100, martin@neutronstar.dyndns.org wrote:
> > ...
> > > > > > > +static int mt9m032_setup_pll(struct mt9m032 *sensor)
> > > > > > > +{
> > > > > > > +	struct mt9m032_platform_data* pdata = sensor->pdata;
> > > > > > > +	u16 reg_pll1;
> > > > > > > +	unsigned int pre_div;
> > > > > > > +	int res, ret;
> > > > > > > +
> > > > > > > +	/* TODO: also support other pre-div values */
> > > > 
> > > > I might already have mentioned this, but wouldn't it be time to work a on real 
> > > > PLL setup code that compute the pre-divisor, multiplier and output divisor 
> > > > dynamically from the input and output clock frequencies ?
> > > 
> > > I'm not sure what the implications for quality and stability of such a
> > > generic setup would be. My gut feeling is most users go with known working
> > > hardcoded values.
> > 
> > You'd get a lot better control of the sensor as a bonus in doing so. Also,
> > you could program the sensor properly suitable for the host it is connected
> > to, achieving optimal maximum frame rates for it.
> > 
> > These values tend to be relatively board / bridge dependent. On one board
> > some frequencies might not be usable even if they do not exceed the maximum
> > for the bridge.
> 
> Yes, that's why i have exported almost all of the pll details i'm reasonanly sure
> that they are settable in the platform data. I think this gives maximum
> flexibility in the board configuration. Maybe something with less values to fiddle
> with in the normal case would be better. But not really by a large amount.

I originally thought it was part of the driver; that's how it is in most of
the drivers currently. But these values also depend on the use cases, how
you want to use the sensor essentially.

A concrete example is the OMAP 3 ISP. The CSI-2 receiver's speed is 200 Mp/s
while the rest of the ISP is only 100 Mp/s. Capturing a high-resolution
still photo is best done by reading the sensor's pixel array as fast as
possible --- 200 Mp/s.

Such images must be then processed through the ISP from memory to memory.

> static struct mt9m032_platform_data mt9m032_platform_data = {
> 	.ext_clock = 13500000,
> 	.pll_pre_div = 6,
> 	.pll_mul = 120,
> 	.pll_out_div = 5,
> 	.invert_pixclock = 1,
> };
> 
> I think what Laurent was talking about was moving to a setup where the
> board doesn't need to specify the exact details. i.e. have pll_pre_div,
> pll_mul and pll_out_div rolled into one. I'm not sure that's something
> that should be done.

Consider the above example. The answer is "yes". Still, the user should not
have to deal with the internal clock tree of the hardware, and I don't see a
reason why it would be needed.

> And this driver does feel like it had it's share of tracking in development
> interfaces.
> 
> > 
> > Please also see this:
> > 
> > <URL:http://www.mail-archive.com/linux-media@vger.kernel.org/msg39798.html>
> 
> Sounds sensible for the future. But let's not hold this driver until
> agreement is reached about the details?

I assume the spec is public for this sensor? Albeit specifying the PLL
configuration in the platform data is not ideal, it is still indefinitely
better than specifying it in the driver itself.

Calculating the PLL parameters based on higher level concept of link
frequency would still be preferred, I think. It can be done now, even if the
link frequency isn't currently selectable by the user.

Regards,

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi	jabber/XMPP/Gmail: sailus@retiisi.org.uk

  parent reply	other threads:[~2011-12-19 21:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14  1:20 [PATCH v3] v4l: Add driver for Micron MT9M032 camera sensor Martin Hostettler
2011-12-14  1:55 ` Marek Vasut
2011-12-14  7:14   ` martin
2011-12-14 13:49     ` Laurent Pinchart
2011-12-14 18:58       ` martin
2011-12-14 22:11         ` Sakari Ailus
2011-12-17  9:50           ` martin
2011-12-19 10:47             ` Laurent Pinchart
2011-12-19 21:43             ` Sakari Ailus [this message]
2011-12-19 10:43         ` Laurent Pinchart
2011-12-14 21:44   ` Guennadi Liakhovetski

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=20111219214332.GM3677@valkosipuli.localdomain \
    --to=sakari.ailus@iki.fi \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=marek.vasut@gmail.com \
    --cc=martin@neutronstar.dyndns.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.