mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Jai Luthra <jai.luthra@ideasonboard.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 Alexander Shiyan <eagle.alexander923@gmail.com>,
	 linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 devicetree@vger.kernel.org,
	Dave Stevenson <dave.stevenson@raspberrypi.com>
Subject: [PATCH v6 08/18] media: sony-starvis2: Put module into standby after identify
Date: Thu, 22 Oct 2026 18:34:01 +0100	[thread overview]
Message-ID: <20261022-media-starvis2-v6-8-374343f55fd3@raspberrypi.com> (raw)
In-Reply-To: <20261022-media-starvis2-v6-0-374343f55fd3@raspberrypi.com>

The module has to be brought out of standby in order to read
some of the identification registers. Whilst it would be
powered down via pm_runtime, should that be disabled it would
be left in streaming mode.

Restore standby mode after identify.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/media/i2c/sony-starvis2.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 84f3978e1eda..95da8a9e671e 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -1162,7 +1162,8 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 	 * This sensor's ID registers become accessible 80ms after coming out
 	 * of STANDBY mode.
 	 */
-	cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT, 0, &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT,
+		  STARVIS2_MODE_STREAMING, &ret);
 	fsleep(STARVIS2_MODULE_ID_DELAY);
 
 	cci_read(starvis2->cci, variant->id_reg, &val, &ret);
@@ -1170,14 +1171,15 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 	if (ret) {
 		dev_err(&client->dev,
 			"I2C transaction failed ret = %d\n", ret);
-		return ret;
+		goto err_standby;
 	}
 
 	val &= variant->id_mask;
 	if (val != variant->id_value) {
 		dev_err(&client->dev, "Chip ID mismatch: %x!=%llx\n",
 			variant->id_value, val);
-		return -ENXIO;
+		ret = -ENXIO;
+		goto err_standby;
 	}
 
 	cci_read(starvis2->cci, STARVIS2_REG_MONOCHROME, &val, &ret);
@@ -1185,7 +1187,7 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 	if (ret) {
 		dev_err(&client->dev,
 			"I2C transaction failed ret = %d\n", ret);
-		return ret;
+		goto err_standby;
 	}
 
 	detected = val & STARVIS2_TYPE;
@@ -1207,7 +1209,10 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 	}
 	starvis2->variant = starvis2->info->variant;
 
-	return 0;
+err_standby:
+	cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT,
+		  STARVIS2_MODE_STANDBY, NULL);
+	return ret;
 }
 
 static const struct v4l2_subdev_video_ops starvis2_video_ops = {

-- 
2.34.1


  parent reply	other threads:[~2026-10-22 17:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 17:33 [PATCH v6 00/18] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
2026-10-22 17:33 ` [PATCH v6 01/18] media: imx678: Rework into generic Starvis 2 sensor driver Dave Stevenson
2026-10-22 17:33 ` [PATCH v6 02/18] media: sony-starvis2: Reorder link frequencies to remove lookup Dave Stevenson
2026-10-22 17:33 ` [PATCH v6 03/18] media: sony-starvis2: Always program the sensor in window mode Dave Stevenson
2026-10-22 17:33 ` [PATCH v6 04/18] media: sony-starvis2: Parameterise the configuration to allow for other models Dave Stevenson
2026-10-22 17:33 ` [PATCH v6 05/18] media: sony-starvis2: Rework 2 lane support for higher link freqs Dave Stevenson
2026-10-22 17:33 ` [PATCH v6 06/18] media: sony-starvis2: Allow runtime control of link frequency Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 07/18] media: sony-starvis2: Correct the exposure range Dave Stevenson
2026-10-22 17:34 ` Dave Stevenson [this message]
2026-10-22 17:34 ` [PATCH v6 09/18] media: sony-starvis2: Use pm_runtime_autosuspend Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 10/18] media: dt-bindings: sony,imx678: Add other Starvis 2 family members Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 11/18] media: sony-starvis2: Add support for IMX662 Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 12/18] media: sony-starvis2: Add support for IMX675 Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 13/18] media: sony-starvis2: Add support for IMX832 Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 14/18] media: sony-starvis2: Only update bits for window mode Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 15/18] media: sony-starvis2: Parameterise exposure min and step Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 16/18] media: sony-starvis2: Parameterise the mono ID register Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 17/18] media: sony-starvis2: Add support for IMX585 Dave Stevenson
2026-10-22 17:34 ` [PATCH v6 18/18] media: sony-starvis2: Add support for IMX676 Dave Stevenson

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=20261022-media-starvis2-v6-8-374343f55fd3@raspberrypi.com \
    --to=dave.stevenson@raspberrypi.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=eagle.alexander923@gmail.com \
    --cc=jai.luthra@ideasonboard.com \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@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

all inboxes | Powered by JetHome®