linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Allen Ballway <ballway@chromium.org>
To: Hans de Goede <hansg@kernel.org>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Allen Ballway <ballway@chromium.org>
Subject: [PATCH] media: ov8865: move mode_configure out of state_configure
Date: Tue, 22 Jul 2025 13:35:43 -0700	[thread overview]
Message-ID: <20250722-mode_configure-v1-1-5ea35052a01f@chromium.org> (raw)

ov8865_mode_configure() only needs to be called on sensor init, but it can
be called multiple times from ov8865_state_configure(). Move
ov8865_mode_configure() to ov8865_sensor_init().

Signed-off-by: Allen Ballway <ballway@chromium.org>
---
 drivers/media/i2c/ov8865.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
index 95ffe7536aa6aba814f4e5c3d12e7279470b2f07..1d1a1f261bf4ab5c09848402dc057e2f572504e7 100644
--- a/drivers/media/i2c/ov8865.c
+++ b/drivers/media/i2c/ov8865.c
@@ -2304,14 +2304,6 @@ static int ov8865_state_configure(struct ov8865_sensor *sensor,
 	if (sensor->state.streaming)
 		return -EBUSY;
 
-	/* State will be configured at first power on otherwise. */
-	if (pm_runtime_enabled(sensor->dev) &&
-	    !pm_runtime_suspended(sensor->dev)) {
-		ret = ov8865_mode_configure(sensor, mode, mbus_code);
-		if (ret)
-			return ret;
-	}
-
 	ret = ov8865_state_mipi_configure(sensor, mode, mbus_code);
 	if (ret)
 		return ret;
@@ -2384,6 +2376,13 @@ static int ov8865_sensor_init(struct ov8865_sensor *sensor)
 	}
 
 	/* Configure current mode. */
+	ret = ov8865_mode_configure(sensor, sensor->state.mode,
+				     sensor->state.mbus_code);
+	if (ret) {
+		dev_err(sensor->dev, "failed to configure mode\n");
+		return ret;
+	}
+
 	ret = ov8865_state_configure(sensor, sensor->state.mode,
 				     sensor->state.mbus_code);
 	if (ret) {

---
base-commit: 6832a9317eee280117cd695fa885b2b7a7a38daf
change-id: 20250722-mode_configure-80105fbd835d

Best regards,
-- 
Allen Ballway <ballway@chromium.org>


             reply	other threads:[~2025-07-22 20:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22 20:35 Allen Ballway [this message]
2025-07-23 15:47 ` [PATCH] media: ov8865: move mode_configure out of state_configure Laurent Pinchart
2025-07-23 16:40   ` Allen Ballway
2025-07-23 17:02     ` Laurent Pinchart
2025-08-25  7:54       ` Sakari Ailus
2025-08-25 15:08         ` Allen Ballway
2025-08-25 20:13           ` 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=20250722-mode_configure-v1-1-5ea35052a01f@chromium.org \
    --to=ballway@chromium.org \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.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;
as well as URLs for NNTP newsgroup(s).