From: Kieran Bingham <kieran.bingham@ideasonboard.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
Steve Longerbeam <slongerbeam@gmail.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 10/11] media: i2c: ov5640: Disable ISP for raw output
Date: Thu, 14 May 2026 09:50:04 +0100 [thread overview]
Message-ID: <177874860405.2082999.1496444239124631882@ping.linuxembedded.co.uk> (raw)
In-Reply-To: <agV9sFGnM6soxHub@zed>
Quoting Jacopo Mondi (2026-05-14 09:39:31)
> Hi Kieran
>
> On Fri, May 01, 2026 at 04:39:12PM +0100, Kieran Bingham wrote:
> > The OV5640 has ISP operations that can run even when outputting RAW
> > bayer data. These include the Lens Shading Correction, Gamma and Auto
> > white balance which need to be disabled when performing module
> > calibration using RAW data.
> >
> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> > ---
> > drivers/media/i2c/ov5640.c | 45 ++++++++++++++++++++++++++++++++++++++-------
> > 1 file changed, 38 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
> > index fd369a13463e..f63d81640f54 100644
> > --- a/drivers/media/i2c/ov5640.c
> > +++ b/drivers/media/i2c/ov5640.c
> > @@ -280,28 +280,28 @@ static const struct ov5640_pixfmt ov5640_dvp_formats[] = {
> > }, {
> > /* Raw, BGBG... / GRGR... */
> > .code = MEDIA_BUS_FMT_SBGGR8_1X8,
> > - .colorspace = V4L2_COLORSPACE_SRGB,
> > + .colorspace = V4L2_COLORSPACE_RAW,
> > .bpp = 8,
> > .ctrl00 = 0x00,
> > .mux = OV5640_FMT_MUX_RAW_DPC,
> > }, {
> > /* Raw bayer, GBGB... / RGRG... */
> > .code = MEDIA_BUS_FMT_SGBRG8_1X8,
> > - .colorspace = V4L2_COLORSPACE_SRGB,
> > + .colorspace = V4L2_COLORSPACE_RAW,
> > .bpp = 8,
> > .ctrl00 = 0x01,
> > .mux = OV5640_FMT_MUX_RAW_DPC,
> > }, {
> > /* Raw bayer, GRGR... / BGBG... */
> > .code = MEDIA_BUS_FMT_SGRBG8_1X8,
> > - .colorspace = V4L2_COLORSPACE_SRGB,
> > + .colorspace = V4L2_COLORSPACE_RAW,
> > .bpp = 8,
> > .ctrl00 = 0x02,
> > .mux = OV5640_FMT_MUX_RAW_DPC,
> > }, {
> > /* Raw bayer, RGRG... / GBGB... */
> > .code = MEDIA_BUS_FMT_SRGGB8_1X8,
> > - .colorspace = V4L2_COLORSPACE_SRGB,
> > + .colorspace = V4L2_COLORSPACE_RAW,
> > .bpp = 8,
> > .ctrl00 = 0x03,
> > .mux = OV5640_FMT_MUX_RAW_DPC,
> > @@ -348,7 +348,7 @@ static const struct ov5640_pixfmt ov5640_csi2_formats[] = {
> > }, {
> > /* Raw, BGBG... / GRGR... */
> > .code = MEDIA_BUS_FMT_SBGGR8_1X8,
> > - .colorspace = V4L2_COLORSPACE_SRGB,
> > + .colorspace = V4L2_COLORSPACE_RAW,
> > .bpp = 8,
> > .ctrl00 = 0x00,
> > .mux = OV5640_FMT_MUX_RAW_DPC,
> > @@ -473,6 +473,7 @@ struct ov5640_dev {
> >
> > struct v4l2_mbus_framefmt fmt;
> > bool pending_fmt_change;
> > + bool is_raw;
> >
> > const struct ov5640_mode_info *current_mode;
> > const struct ov5640_mode_info *last_mode;
> > @@ -618,8 +619,13 @@ static const struct reg_value ov5640_init_setting[] = {
> > {0x501f, 0x00, 0, 0}, {0x440e, 0x00, 0, 0}, {0x4837, 0x0a, 0, 0},
> >
> > /* ISP Control */
> > - {OV5640_REG_ISP_CTRL00, 0xa7, 0, 0},
> > - {OV5640_REG_ISP_CTRL01, 0xa3, 0, 0},
> > + {OV5640_REG_ISP_CTRL00, OV5640_ISP_00_LENC_ENABLE | OV5640_ISP_00_GMA_ENABLE |
> > + OV5640_ISP_00_BPC_ENABLE | OV5640_ISP_00_WPC_ENABLE |
> > + OV5640_ISP_00_CIP_ENABLE, 0, 0},
> > +
> > + /* OV5640_ISP_01_UVA_ENABLE is not enabled */
> > + {OV5640_REG_ISP_CTRL01, OV5640_ISP_01_SDE_ENABLE | OV5640_ISP_01_SCL_ENABLE |
> > + OV5640_ISP_01_CMX_ENABLE | OV5640_ISP_01_AWB_ENABLE, 0, 0},
>
> Should we avoid writing these registers at all in the init sequence ?
Oh probably. I haven't tested that yet, but indeed.
> >
> > /* AWB Control */
> > {OV5640_REG_AWB_CONTROL_00, 0xff, 0, 0}, /* AWB B Block */
> > @@ -3116,6 +3122,31 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor,
> > if (ret)
> > return ret;
> >
> > + /*
> > + * Disable all ISP image processing (Lens Shading, Gamma, AWB...) for
> > + * RAW modes to facilitate module tuning.
> > + */
> > + sensor->is_raw = pixfmt->colorspace == V4L2_COLORSPACE_RAW;
>
> Unless it is used later on, the 'is_raw' flag can be kept a local
> variable.
Haha yes, no idea why I put it in the main dev structure.
Will move. Thanks.
>
> > + if (sensor->is_raw) {
> > + ret = ov5640_write_reg(sensor, OV5640_REG_ISP_CTRL00, 0);
> > + if (ret)
> > + return ret;
> > + } else {
> > + ret = ov5640_write_reg(sensor, OV5640_REG_ISP_CTRL00,
> > + OV5640_ISP_00_LENC_ENABLE | OV5640_ISP_00_GMA_ENABLE |
> > + OV5640_ISP_00_BPC_ENABLE | OV5640_ISP_00_WPC_ENABLE |
> > + OV5640_ISP_00_CIP_ENABLE);
> > + if (ret)
> > + return ret;
> > +
> > + /* OV5640_ISP_01_UVA_ENABLE is not enabled */
> > + ret = ov5640_write_reg(sensor, OV5640_REG_ISP_CTRL01,
> > + OV5640_ISP_01_SDE_ENABLE | OV5640_ISP_01_SCL_ENABLE |
> > + OV5640_ISP_01_CMX_ENABLE | OV5640_ISP_01_AWB_ENABLE);
> > + if (ret)
> > + return ret;
> > + }
> > +
> > /*
> > * TIMING TC REG21:
> > * - [5]: JPEG enable
> >
> > --
> > 2.52.0
> >
> >
next prev parent reply other threads:[~2026-05-14 8:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 15:39 [PATCH 00/11] media: i2c: ov5640: Refactor ISP configuration Kieran Bingham
2026-05-01 15:39 ` [PATCH 01/11] media: i2c: ov5640: Set default WB gains Kieran Bingham
2026-05-14 7:44 ` Jacopo Mondi
2026-05-01 15:39 ` [PATCH 02/11] media: i2c: ov5640: Set exposure minimum and defaults Kieran Bingham
2026-05-14 7:58 ` Jacopo Mondi
2026-05-14 8:01 ` Jacopo Mondi
2026-05-01 15:39 ` [PATCH 03/11] media: i2c: ov5640: Fix minimum gain to 1.0x Kieran Bingham
2026-05-14 8:05 ` Jacopo Mondi
2026-05-01 15:39 ` [PATCH 04/11] media: i2c: ov5640: fix error path in ov5640_set_mode Kieran Bingham
2026-05-14 8:08 ` Jacopo Mondi
2026-05-01 15:39 ` [PATCH 05/11] media: i2c: ov5640: Remove unsupported bayer orders Kieran Bingham
2026-05-14 8:10 ` Jacopo Mondi
2026-05-14 8:43 ` Kieran Bingham
2026-05-14 9:22 ` Jacopo Mondi
2026-05-01 15:39 ` [PATCH 06/11] media: i2c: ov5640: split out the LSC registers Kieran Bingham
2026-05-14 8:23 ` Jacopo Mondi
2026-05-14 8:44 ` Kieran Bingham
2026-05-01 15:39 ` [PATCH 07/11] media: i2c: ov5640: Split out AWB registers Kieran Bingham
2026-05-01 15:39 ` [PATCH 08/11] media: i2c: ov5640: Document AWB control registers Kieran Bingham
2026-05-14 8:33 ` Jacopo Mondi
2026-05-14 8:34 ` Jacopo Mondi
2026-05-14 8:48 ` Kieran Bingham
2026-05-01 15:39 ` [PATCH 09/11] media: i2c: ov5640: Add ISP Control registers Kieran Bingham
2026-05-14 8:36 ` Jacopo Mondi
2026-05-01 15:39 ` [PATCH 10/11] media: i2c: ov5640: Disable ISP for raw output Kieran Bingham
2026-05-14 8:39 ` Jacopo Mondi
2026-05-14 8:50 ` Kieran Bingham [this message]
2026-05-01 15:39 ` [PATCH 11/11] media: i2c: ov5640: Split out format mux registers Kieran Bingham
2026-05-14 8:41 ` Jacopo Mondi
2026-05-14 8:51 ` Kieran Bingham
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=177874860405.2082999.1496444239124631882@ping.linuxembedded.co.uk \
--to=kieran.bingham@ideasonboard.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--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.