mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marco Ziliani <rylos78@gmail.com>
To: Daniel Scally <dan.scally@ideasonboard.com>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, Chris Simpson <chris@nilk.net>,
	 Tony Garcia <tony@loafecho.com>,
	Simon Kruse <simon0x+git@proton.me>,
	 "D. Manresa" <dmanresa@gmail.com>,
	linux-kernel@vger.kernel.org,  Marco Ziliani <rylos78@gmail.com>
Subject: [PATCH v2 1/3] media: i2c: ov5693: Program the mode registers on stream start
Date: Thu, 29 Oct 2026 10:27:52 +0100	[thread overview]
Message-ID: <20261029-ov5693-fixes-v2-1-2526d7b13030@gmail.com> (raw)
In-Reply-To: <20261029-ov5693-fixes-v2-0-2526d7b13030@gmail.com>

ov5693_mode_configure() is only called from the runtime PM resume path,
through ov5693_sensor_init(). If the sensor stays powered between two
streams with different modes, the settings for the second mode are never
written to the hardware.

Move the call from ov5693_sensor_init() to ov5693_s_stream(), before the
controls are applied, so that the mode is written on every stream start.

Fixes: 89aef879cb53 ("media: i2c: Add support for ov5693 sensor")
Link: https://github.com/linux-surface/kernel/pull/181
Signed-off-by: Marco Ziliani <rylos78@gmail.com>
---
 drivers/media/i2c/ov5693.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ov5693.c b/drivers/media/i2c/ov5693.c
index 56599f9ca..d09095c3e 100644
--- a/drivers/media/i2c/ov5693.c
+++ b/drivers/media/i2c/ov5693.c
@@ -663,11 +663,6 @@ static int ov5693_sensor_init(struct ov5693_device *ov5693)
 		return dev_err_probe(ov5693->dev, ret,
 				     "global settings error\n");
 
-	ret = ov5693_mode_configure(ov5693);
-	if (ret)
-		return dev_err_probe(ov5693->dev, ret,
-				     "mode configure error\n");
-
 	ret = ov5693_enable_streaming(ov5693, false);
 	if (ret)
 		dev_err(ov5693->dev, "stop streaming error\n");
@@ -1000,6 +995,19 @@ static int ov5693_s_stream(struct v4l2_subdev *sd, int enable)
 			return ret;
 
 		mutex_lock(&ov5693->lock);
+
+		/*
+		 * Program the mode on every stream start, so that a format
+		 * change also reaches a sensor that stayed powered since the
+		 * previous stream, and before the controls so that the mode
+		 * registers don't clobber them.
+		 */
+		ret = ov5693_mode_configure(ov5693);
+		if (ret) {
+			mutex_unlock(&ov5693->lock);
+			goto err_power_down;
+		}
+
 		ret = __v4l2_ctrl_handler_setup(&ov5693->ctrls.handler);
 		if (ret) {
 			mutex_unlock(&ov5693->lock);

-- 
2.56.0


  reply	other threads:[~2026-10-29  9:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  9:27 [PATCH v2 0/3] media: i2c: ov5693: Fix mode changes, flips and autosuspend Marco Ziliani
2026-10-29  9:27 ` Marco Ziliani [this message]
2026-10-29  9:27 ` [PATCH v2 2/3] media: i2c: ov5693: Keep the Bayer order when flipping at full resolution Marco Ziliani
2026-10-29  9:27 ` [PATCH v2 3/3] media: i2c: ov5693: Use autosuspend when stopping the stream Marco Ziliani

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=20261029-ov5693-fixes-v2-1-2526d7b13030@gmail.com \
    --to=rylos78@gmail.com \
    --cc=chris@nilk.net \
    --cc=dan.scally@ideasonboard.com \
    --cc=dmanresa@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=simon0x+git@proton.me \
    --cc=tony@loafecho.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

all inboxes | Powered by JetHome®