Linux Media Controller development
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo@jmondi.org>
To: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: paul.j.murphy@intel.com, daniele.alessandrelli@intel.com,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 02/16] media: i2c: ov9282: Split registers into common and mode specific
Date: Thu, 6 Oct 2022 11:15:02 +0200	[thread overview]
Message-ID: <20221006091502.nmapvfotolb5imto@uno.localdomain> (raw)
In-Reply-To: <20221005152809.3785786-3-dave.stevenson@raspberrypi.com>

Hi Dave,

On Wed, Oct 05, 2022 at 04:27:55PM +0100, Dave Stevenson wrote:
> Currently only one mode is supported, so all registers were
> dropped in one list.
> In preparation for adding more modes, split out the common registers
> from those which configure the mode.
>
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

I don't have the datasheet but I can confirm all registeres removed
from the common part are now part of the mode

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

> ---
>  drivers/media/i2c/ov9282.c | 77 +++++++++++++++++++++++---------------
>  1 file changed, 47 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
> index 2c13bcd59c2a..9842080cf66f 100644
> --- a/drivers/media/i2c/ov9282.c
> +++ b/drivers/media/i2c/ov9282.c
> @@ -157,8 +157,8 @@ static const s64 link_freq[] = {
>  	OV9282_LINK_FREQ,
>  };
>
> -/* Sensor mode registers */
> -static const struct ov9282_reg mode_1280x720_regs[] = {
> +/* Common registers */
> +static const struct ov9282_reg common_regs[] = {
>  	{0x0302, 0x32},
>  	{0x030d, 0x50},
>  	{0x030e, 0x02},
> @@ -189,13 +189,49 @@ static const struct ov9282_reg mode_1280x720_regs[] = {
>  	{0x372d, 0x22},
>  	{0x3731, 0x80},
>  	{0x3732, 0x30},
> -	{0x3778, 0x00},
>  	{0x377d, 0x22},
>  	{0x3788, 0x02},
>  	{0x3789, 0xa4},
>  	{0x378a, 0x00},
>  	{0x378b, 0x4a},
>  	{0x3799, 0x20},
> +	{0x3881, 0x42},
> +	{0x38a8, 0x02},
> +	{0x38a9, 0x80},
> +	{0x38b1, 0x00},
> +	{0x38c4, 0x00},
> +	{0x38c5, 0xc0},
> +	{0x38c6, 0x04},
> +	{0x38c7, 0x80},
> +	{0x3920, 0xff},
> +	{0x4010, 0x40},
> +	{0x4043, 0x40},
> +	{0x4307, 0x30},
> +	{0x4317, 0x00},
> +	{0x4501, 0x00},
> +	{0x450a, 0x08},
> +	{0x4601, 0x04},
> +	{0x470f, 0x00},
> +	{0x4f07, 0x00},
> +	{0x4800, 0x20},
> +	{0x5000, 0x9f},
> +	{0x5001, 0x00},
> +	{0x5e00, 0x00},
> +	{0x5d00, 0x07},
> +	{0x5d01, 0x00},
> +	{0x0101, 0x01},
> +	{0x1000, 0x03},
> +	{0x5a08, 0x84},
> +};
> +
> +struct ov9282_reg_list common_regs_list = {
> +	.num_of_regs = ARRAY_SIZE(common_regs),
> +	.regs = common_regs,
> +};
> +
> +/* Sensor mode registers */
> +static const struct ov9282_reg mode_1280x720_regs[] = {
> +	{0x3778, 0x00},
>  	{0x3800, 0x00},
>  	{0x3801, 0x00},
>  	{0x3802, 0x00},
> @@ -218,40 +254,13 @@ static const struct ov9282_reg mode_1280x720_regs[] = {
>  	{0x3815, 0x11},
>  	{0x3820, 0x3c},
>  	{0x3821, 0x84},
> -	{0x3881, 0x42},
> -	{0x38a8, 0x02},
> -	{0x38a9, 0x80},
> -	{0x38b1, 0x00},
> -	{0x38c4, 0x00},
> -	{0x38c5, 0xc0},
> -	{0x38c6, 0x04},
> -	{0x38c7, 0x80},
> -	{0x3920, 0xff},
>  	{0x4003, 0x40},
>  	{0x4008, 0x02},
>  	{0x4009, 0x05},
>  	{0x400c, 0x00},
>  	{0x400d, 0x03},
> -	{0x4010, 0x40},
> -	{0x4043, 0x40},
> -	{0x4307, 0x30},
> -	{0x4317, 0x00},
> -	{0x4501, 0x00},
>  	{0x4507, 0x00},
>  	{0x4509, 0x80},
> -	{0x450a, 0x08},
> -	{0x4601, 0x04},
> -	{0x470f, 0x00},
> -	{0x4f07, 0x00},
> -	{0x4800, 0x20},
> -	{0x5000, 0x9f},
> -	{0x5001, 0x00},
> -	{0x5e00, 0x00},
> -	{0x5d00, 0x07},
> -	{0x5d01, 0x00},
> -	{0x0101, 0x01},
> -	{0x1000, 0x03},
> -	{0x5a08, 0x84},
>  };
>
>  /* Supported sensor mode configurations */
> @@ -663,6 +672,14 @@ static int ov9282_start_streaming(struct ov9282 *ov9282)
>  	const struct ov9282_reg_list *reg_list;
>  	int ret;
>
> +	/* Write common registers */
> +	ret = ov9282_write_regs(ov9282, common_regs_list.regs,
> +				common_regs_list.num_of_regs);
> +	if (ret) {
> +		dev_err(ov9282->dev, "fail to write common registers");
> +		return ret;
> +	}
> +
>  	/* Write sensor mode registers */
>  	reg_list = &ov9282->cur_mode->reg_list;
>  	ret = ov9282_write_regs(ov9282, reg_list->regs, reg_list->num_of_regs);
> --
> 2.34.1
>

  reply	other threads:[~2022-10-06  9:15 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 15:27 [PATCH 00/16] Updates to ov9282 sensor driver Dave Stevenson
2022-10-05 15:27 ` [PATCH 01/16] media: i2c: ov9282: Remove duplication of registers Dave Stevenson
2022-10-06  9:14   ` Jacopo Mondi
2022-10-05 15:27 ` [PATCH 02/16] media: i2c: ov9282: Split registers into common and mode specific Dave Stevenson
2022-10-06  9:15   ` Jacopo Mondi [this message]
2022-10-05 15:27 ` [PATCH 03/16] media: i2c: ov9282: Remove format code from the mode Dave Stevenson
2022-10-06  9:15   ` Jacopo Mondi
2022-10-05 15:27 ` [PATCH 04/16] media: i2c: ov9282: Remove pixel rate from mode definition Dave Stevenson
2022-10-06  9:17   ` Jacopo Mondi
2022-10-06 11:51     ` Dave Stevenson
2022-10-05 15:27 ` [PATCH 05/16] media: i2c: ov9281: Support more than 1 mode Dave Stevenson
2022-10-06  9:18   ` Jacopo Mondi
2022-10-26  7:22   ` Sakari Ailus
2022-10-05 15:27 ` [PATCH 06/16] media: i2c: ov9282: Correct HTS register for configured pixel rate Dave Stevenson
2022-10-06  9:23   ` Jacopo Mondi
2022-10-06 13:01     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 07/16] media: i2c: ov9282: Reduce vblank_min values based on testing Dave Stevenson
2022-10-06 11:56   ` Jacopo Mondi
2022-10-06 13:02     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 08/16] media: i2c: ov9282: Add selection for CSI2 clock mode Dave Stevenson
2022-10-06  9:24   ` Jacopo Mondi
2022-10-26  7:21   ` Sakari Ailus
2022-10-28 12:57     ` Dave Stevenson
2022-10-28 14:30       ` Sakari Ailus
2022-10-28 15:03         ` Dave Stevenson
2022-10-31 13:06           ` Sakari Ailus
2022-10-05 15:28 ` [PATCH 09/16] media: i2c: ov9282: Add the properties from fwnode Dave Stevenson
2022-10-06 11:57   ` Jacopo Mondi
2022-10-05 15:28 ` [PATCH 10/16] media: i2c: ov9282: Action CID_VBLANK when set Dave Stevenson
2022-10-06  9:29   ` Jacopo Mondi
2022-10-06 13:21     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 11/16] media: i2c: ov9282: Add HFLIP and VFLIP support Dave Stevenson
2022-10-06  9:38   ` Jacopo Mondi
2022-10-06 14:21     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 12/16] media: i2c: ov9282: Make V4L2_CID_HBLANK r/w Dave Stevenson
2022-10-06  9:41   ` Jacopo Mondi
2022-10-06 11:33     ` Dave Stevenson
2022-10-06 11:53       ` Jacopo Mondi
2022-10-05 15:28 ` [PATCH 13/16] media: i2c: ov9282: Add selection API calls for cropping info Dave Stevenson
2022-10-06  9:43   ` Jacopo Mondi
2022-10-06 11:39     ` Dave Stevenson
2022-10-06 11:54       ` Jacopo Mondi
2022-10-05 15:28 ` [PATCH 14/16] media: i2c: ov9282: Add support for 1280x800 and 640x400 modes Dave Stevenson
2022-10-06  9:48   ` Jacopo Mondi
2022-10-06 11:46     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 15/16] media: i2c: ov9282: Add support for 8bit readout Dave Stevenson
2022-10-06  9:57   ` Jacopo Mondi
2022-10-06 12:20     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 16/16] media: i2c: ov9282: Support event handlers Dave Stevenson
2022-10-06  9:59   ` Jacopo Mondi
2022-10-07 10:22     ` Dave Stevenson
2022-10-07 12:57       ` Jacopo Mondi

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=20221006091502.nmapvfotolb5imto@uno.localdomain \
    --to=jacopo@jmondi.org \
    --cc=daniele.alessandrelli@intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=linux-media@vger.kernel.org \
    --cc=paul.j.murphy@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox