All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@bootlin.com>
To: Daniel Mack <daniel@zonque.org>
Cc: linux-media@vger.kernel.org, slongerbeam@gmail.com, mchehab@kernel.org
Subject: Re: [PATCH 2/3] media: ov5640: add PIXEL_RATE and LINK_FREQ controls
Date: Fri, 20 Apr 2018 16:15:28 +0200	[thread overview]
Message-ID: <20180420141528.ethp34p6czomokpi@flea> (raw)
In-Reply-To: <20180420094419.11267-2-daniel@zonque.org>

[-- Attachment #1: Type: text/plain, Size: 2495 bytes --]

Hi,

On Fri, Apr 20, 2018 at 11:44:18AM +0200, Daniel Mack wrote:
> Add v4l2 controls to report the pixel and MIPI link rates of each mode.
> The camss camera subsystem needs them to set up the correct hardware
> clocks.
> 
> Tested on msm8016 based hardware.
> 
> Signed-off-by: Daniel Mack <daniel@zonque.org>
> ---
>  drivers/media/i2c/ov5640.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 77 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> index 96f1564abdf5..78669ed386cd 100644
> --- a/drivers/media/i2c/ov5640.c
> +++ b/drivers/media/i2c/ov5640.c
> @@ -91,6 +91,20 @@
>  #define OV5640_REG_SDE_CTRL5		0x5585
>  #define OV5640_REG_AVG_READOUT		0x56a1
>  
> +#define OV5640_LINK_FREQ_111	0
> +#define OV5640_LINK_FREQ_166	1
> +#define OV5640_LINK_FREQ_222	2
> +#define OV5640_LINK_FREQ_333	3
> +#define OV5640_LINK_FREQ_666	4
> +
> +static const s64 link_freq_menu_items[] = {
> +	111066666,
> +	166600000,
> +	222133333,
> +	332200000,
> +	666400000,
> +};
> +
>  enum ov5640_mode_id {
>  	OV5640_MODE_QCIF_176_144 = 0,
>  	OV5640_MODE_QVGA_320_240,
> @@ -167,12 +181,18 @@ struct ov5640_mode_info {
>  	enum ov5640_downsize_mode dn_mode;
>  	u32 width;
>  	u32 height;
> +	u32 pixel_rate;
> +	u32 link_freq_idx;
>  	const struct reg_value *reg_data;
>  	u32 reg_data_size;
>  };
>  
>  struct ov5640_ctrls {
>  	struct v4l2_ctrl_handler handler;
> +	struct {
> +		struct v4l2_ctrl *link_freq;
> +		struct v4l2_ctrl *pixel_rate;
> +	};
>  	struct {
>  		struct v4l2_ctrl *auto_exp;
>  		struct v4l2_ctrl *exposure;
> @@ -732,6 +752,8 @@ static const struct ov5640_mode_info ov5640_mode_init_data = {
>  	.dn_mode	= SUBSAMPLING,
>  	.width		= 640,
>  	.height		= 480,
> +	.pixel_rate	= 27766666,
> +	.link_freq_idx	= OV5640_LINK_FREQ_111,

I'm not sure where this is coming from, but on a parallel sensor I
have a quite different pixel rate.

I have a serie ongoing that tries to deal with this, hopefully in
order to get rid of all the clock setup done in the initialiasation
array.

See https://patchwork.linuxtv.org/patch/48710/ for the patch and
https://www.spinics.net/lists/linux-media/msg132201.html for a
discussion on what the clock tree might look like on a MIPI-CSI bus.

Feel free to step in the discussion.
Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-04-20 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20  9:44 [PATCH 1/3] media: ov5640: initialize mode data structs by name Daniel Mack
2018-04-20  9:44 ` [PATCH 2/3] media: ov5640: add PIXEL_RATE and LINK_FREQ controls Daniel Mack
2018-04-20 14:15   ` Maxime Ripard [this message]
2018-04-20 14:29     ` Daniel Mack
2018-04-20 19:00       ` Maxime Ripard
2018-04-24 10:22   ` Sakari Ailus
2018-04-24 12:03     ` Daniel Mack
2018-04-26  8:31       ` Sakari Ailus
2018-04-20  9:44 ` [PATCH 3/3] media: ov5640: add support for xclk frequency control Daniel Mack
2018-04-20 14:07   ` Maxime Ripard
2018-04-24 10:24   ` Sakari Ailus

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=20180420141528.ethp34p6czomokpi@flea \
    --to=maxime.ripard@bootlin.com \
    --cc=daniel@zonque.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=slongerbeam@gmail.com \
    /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.