All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver.
@ 2026-10-13 15:16 Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 01/13] media: imx678: Rework into generic Starvis 2 sensor driver Dave Stevenson
                   ` (12 more replies)
  0 siblings, 13 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:16 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

The IMX678 (8MPix) driver has already been accepted into the
kernel.

Whilst preparing a patchset for IMX662 (1080p), I observed such
commonality between the two that it seemed sensible to attempt
a common driver rather than submitting a separate IMX662 series
again.

On checking my box of sensors, I found I had an IMX675 (5MPix) as
well, so that has been incorporated. Subsequently I was able to
add IMX585 (8MPix) and IMX832 (1080p).

The Sony datasheets are rather lacking on the limits for HMAX.
They list HMAX (and VMAX) values for nice round framerates at
a number of the supported link frequencies.
These limits have been adopted for IMX662 and IMX832, but for
IMX675 and IMX585 they have been determined empirically by
observing values of HMAX that start to introduce image issues.

Now cleaned up over the RFC V1.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
Changes in v2:
- Switched from an RFC to a patch set.
- Add the dtbinding changes.
- Added IMX832 and IMX585. Tested and fully working on all 5 modules.
- Updated 2 lane handling so that the higher link frequencies achieve
  the maximum frame rates.
- Adds a patch that corrects the minimum exposure time.
- Allow userspace selection of all link frequencies specified via DT
  (makes testing all the link frequency options far easier).
- Link to v1: https://lore.kernel.org/r/20260805-media-starvis2-v1-0-91e8e4eae44f@raspberrypi.com

---
Dave Stevenson (13):
      media: imx678: Rework into generic Starvis 2 sensor driver.
      media: sony-starvis2: Reorder link frequencies to remove lookup
      media: sony-starvis2: Always program the sensor in window mode
      media: sony-starvis2: Parameterise the configuration to allow for other models
      media: sony-starvis2: Rework 2 lane support for higher link freqs
      media: sony-starvis2: Allow runtime control of link frequency
      media: sony-starvis2: Correct the minimum exposure
      media: dt-bindings: sony,imx678: Add other Starvis 2 family members
      media: sony-starvis2: Add support for IMX662
      media: sony-starvis2: Add support for IMX675
      media: sony-starvis2: Add support for IMX832
      media: sony-starvis2: Only update bits for window mode
      media: sony-starvis2: Add support for IMX585

 .../devicetree/bindings/media/i2c/sony,imx678.yaml |   38 +-
 MAINTAINERS                                        |   14 +-
 drivers/media/i2c/Kconfig                          |   20 +-
 drivers/media/i2c/Makefile                         |    1 +
 drivers/media/i2c/imx678.c                         | 1447 ------------
 drivers/media/i2c/sony-starvis2.c                  | 2314 ++++++++++++++++++++
 6 files changed, 2368 insertions(+), 1466 deletions(-)
---
base-commit: d7e7bca7169873b46e857c025c10f3336c1258d8
change-id: 20260804-media-starvis2-65a5bc405b74

Best regards,
-- 
Dave Stevenson <dave.stevenson@raspberrypi.com>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 01/13] media: imx678: Rework into generic Starvis 2 sensor driver.
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:32   ` sashiko-bot
  2026-10-13 15:17 ` [PATCH v2 02/13] media: sony-starvis2: Reorder link frequencies to remove lookup Dave Stevenson
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

The register layout and programming model for multiple of the
Sony Starvis2 sensors is identical, so prepare for supporting
those by renaming all common parts of the driver to a starvis2_
prefix, and renaming the driver.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 MAINTAINERS                                     |  14 +-
 drivers/media/i2c/Kconfig                       |  20 +-
 drivers/media/i2c/Makefile                      |   1 +
 drivers/media/i2c/{imx678.c => sony-starvis2.c} | 759 ++++++++++++------------
 4 files changed, 408 insertions(+), 386 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 760791e3635f..bba095bc1a63 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -25640,13 +25640,6 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/media/i2c/sony,imx576.yaml
 F:	drivers/media/i2c/imx576.c
 
-SONY IMX678 SENSOR DRIVER
-M:	Jai Luthra <jai.luthra@ideasonboard.com>
-L:	linux-media@vger.kernel.org
-S:	Maintained
-F:	Documentation/devicetree/bindings/media/i2c/sony,imx678.yaml
-F:	drivers/media/i2c/imx678.c
-
 SONY MEMORYSTICK SUBSYSTEM
 M:	Maxim Levitsky <maximlevitsky@gmail.com>
 M:	Alex Dubov <oakad@yahoo.com>
@@ -25657,6 +25650,13 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git
 F:	drivers/memstick/
 F:	include/linux/memstick.h
 
+SONY STARVIS 2 SENSOR DRIVER
+M:	Jai Luthra <jai.luthra@ideasonboard.com>
+L:	linux-media@vger.kernel.org
+S:	Maintained
+F:	Documentation/devicetree/bindings/media/i2c/sony,imx678.yaml
+F:	drivers/media/i2c/sony-starvis2.c
+
 SONY VAIO CONTROL DEVICE DRIVER
 M:	Mattia Dongili <malattia@linux.it>
 L:	platform-driver-x86@vger.kernel.org
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 7de2d095c969..1cf26b300bda 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -323,14 +323,11 @@ config VIDEO_IMX576
 
 config VIDEO_IMX678
 	tristate "Sony IMX678 sensor support"
-	depends on GPIOLIB
-	select V4L2_CCI_I2C
+	select VIDEO_SONY_STARVIS2
 	help
 	  This is a Video4Linux2 sensor driver for the Sony
-	  IMX678 camera.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called imx678.
+	  IMX678 camera. This sensor is now supported by the common
+	  Sony Starvis 2 sensor driver.
 
 config VIDEO_MAX9271_LIB
 	tristate
@@ -879,6 +876,17 @@ config VIDEO_S5KJN5
 	  To compile this driver as a module, choose M here: the
 	  module will be called s5kjn5.
 
+config VIDEO_SONY_STARVIS2
+	tristate "Sony Starvis 2 sensor support"
+	depends on GPIOLIB
+	select V4L2_CCI_I2C
+	help
+	  This is a Video4Linux2 sensor driver for the Sony Starvis
+	  2 image sensors.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called sony-starvis2.
+
 config VIDEO_T4KA3
 	tristate "Toshiba T4KA3 sensor support"
 	depends on ACPI || COMPILE_TEST
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 59e31af457cd..a604771f0599 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -146,6 +146,7 @@ obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o
 obj-$(CONFIG_VIDEO_SAA717X) += saa717x.o
 obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o
 obj-$(CONFIG_VIDEO_SONY_BTF_MPX) += sony-btf-mpx.o
+obj-$(CONFIG_VIDEO_SONY_STARVIS2) += sony-starvis2.o
 obj-$(CONFIG_VIDEO_ST_MIPID02) += st-mipid02.o
 obj-$(CONFIG_VIDEO_T4KA3) += t4ka3.o
 obj-$(CONFIG_VIDEO_TC358743) += tc358743.o
diff --git a/drivers/media/i2c/imx678.c b/drivers/media/i2c/sony-starvis2.c
similarity index 57%
rename from drivers/media/i2c/imx678.c
rename to drivers/media/i2c/sony-starvis2.c
index 8413fd44d657..84e77aba92fd 100644
--- a/drivers/media/i2c/imx678.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -1,8 +1,13 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * V4L2 driver for Sony IMX678
+ * V4L2 driver for Sony Starvis 2 sensors
  *
- * Diagonal 8.86 mm (Type 1/1.8) CMOS image sensor with 8.40 M effective pixels.
+ * Many of the Sony Starvis 2 sensors share a common register layout, so
+ * many can be supported by a common driver.
+ *
+ * Currently supported are:
+ * IMX678: Diagonal 8.86 mm (Type 1/1.8) CMOS image sensor with 8.40 M effective
+ *         pixels.
  *
  * Copyright (C) 2026 Ideas On Board Oy.
  *
@@ -26,25 +31,25 @@
 #include <media/v4l2-subdev.h>
 
 /* Standby or streaming mode */
-#define IMX678_REG_MODE_SELECT          CCI_REG8(0x3000)
-#define IMX678_MODE_STANDBY             0x01
-#define IMX678_MODE_STREAMING           0x00
-#define IMX678_STREAM_DELAY_US          25000
-#define IMX678_STREAM_DELAY_RANGE_US    1000
+#define STARVIS2_REG_MODE_SELECT          CCI_REG8(0x3000)
+#define STARVIS2_MODE_STANDBY             0x01
+#define STARVIS2_MODE_STREAMING           0x00
+#define STARVIS2_STREAM_DELAY_US          25000
+#define STARVIS2_STREAM_DELAY_RANGE_US    1000
 
 /* XVS/XHS sync control */
-#define IMX678_REG_XMSTA                CCI_REG8(0x3002)
-#define IMX678_REG_XXS_DRV              CCI_REG8(0x30a6)
-#define IMX678_REG_XXS_OUTSEL           CCI_REG8(0x30a4)
+#define STARVIS2_REG_XMSTA                CCI_REG8(0x3002)
+#define STARVIS2_REG_XXS_DRV              CCI_REG8(0x30a6)
+#define STARVIS2_REG_XXS_OUTSEL           CCI_REG8(0x30a4)
 
 /* Clk selection */
-#define IMX678_REG_INCK_SEL             CCI_REG8(0x3014)
+#define STARVIS2_REG_INCK_SEL             CCI_REG8(0x3014)
 
 /* Link Speed */
-#define IMX678_REG_DATARATE_SEL         CCI_REG8(0x3015)
+#define STARVIS2_REG_DATARATE_SEL         CCI_REG8(0x3015)
 
 /* Lane Count */
-#define IMX678_REG_LANEMODE             CCI_REG8(0x3040)
+#define STARVIS2_REG_LANEMODE             CCI_REG8(0x3040)
 
 /*
  * The internal readout clock runs at 74.25 MHz. In one cycle the AD reads 8
@@ -54,22 +59,22 @@
 #define IMX678_PIX_PER_CLK		8
 
 /* VMAX - Frame Length in Lines */
-#define IMX678_REG_VMAX                 CCI_REG24_LE(0x3028)
-#define IMX678_VMAX_MAX                 0xfffff
+#define STARVIS2_REG_VMAX                 CCI_REG24_LE(0x3028)
+#define STARVIS2_VMAX_MAX                 0xfffff
 #define IMX678_VMAX_DEFAULT             2250
 
 /* HMAX - Line Length in Cycles (8 Pixels) */
-#define IMX678_REG_HMAX                 CCI_REG16_LE(0x302c)
-#define IMX678_HMAX_MAX                 0xffff
+#define STARVIS2_REG_HMAX                 CCI_REG16_LE(0x302c)
+#define STARVIS2_HMAX_MAX                 0xffff
 
 /* SHR internal */
-#define IMX678_REG_SHR                  CCI_REG24_LE(0x3050)
-#define IMX678_SHR_MIN                  8
+#define STARVIS2_REG_SHR                  CCI_REG24_LE(0x3050)
+#define STARVIS2_SHR_MIN                  8
 
 /* Exposure control */
-#define IMX678_EXPOSURE_MIN             2
-#define IMX678_EXPOSURE_STEP            1
-#define IMX678_EXPOSURE_DEFAULT         1000
+#define STARVIS2_EXPOSURE_MIN             2
+#define STARVIS2_EXPOSURE_STEP            1
+#define STARVIS2_EXPOSURE_DEFAULT         1000
 
 /*
  * Analogue gain control
@@ -77,63 +82,63 @@
  * Values from 101 to 240 are valid but correspond to additional digital gain
  * (0.3dB - 42dB) so don't expose it to userspace
  */
-#define IMX678_REG_GAIN			CCI_REG16_LE(0x3070)
-#define IMX678_ANA_GAIN_MIN_NORMAL      0
-#define IMX678_ANA_GAIN_MAX_NORMAL      100
-#define IMX678_ANA_GAIN_STEP            1
-#define IMX678_ANA_GAIN_DEFAULT         0
+#define STARVIS2_REG_GAIN			CCI_REG16_LE(0x3070)
+#define STARVIS2_ANA_GAIN_MIN_NORMAL      0
+#define STARVIS2_ANA_GAIN_MAX_NORMAL      100
+#define STARVIS2_ANA_GAIN_STEP            1
+#define STARVIS2_ANA_GAIN_DEFAULT         0
 
 /* Crop */
-#define IMX678_REG_WINMODE		CCI_REG8(0x3018)
-#define IMX678_REG_PIX_HST		CCI_REG16_LE(0x303c)
-#define IMX678_REG_PIX_HWIDTH		CCI_REG16_LE(0x303e)
-#define IMX678_REG_PIX_VST		CCI_REG16_LE(0x3044)
-#define IMX678_REG_PIX_VWIDTH		CCI_REG16_LE(0x3046)
+#define STARVIS2_REG_WINMODE		CCI_REG8(0x3018)
+#define STARVIS2_REG_PIX_HST		CCI_REG16_LE(0x303c)
+#define STARVIS2_REG_PIX_HWIDTH		CCI_REG16_LE(0x303e)
+#define STARVIS2_REG_PIX_VST		CCI_REG16_LE(0x3044)
+#define STARVIS2_REG_PIX_VWIDTH		CCI_REG16_LE(0x3046)
 
 /* Flip */
-#define IMX678_REG_WINMODEH             CCI_REG8(0x3020)
-#define IMX678_REG_WINMODEV             CCI_REG8(0x3021)
+#define STARVIS2_REG_WINMODEH             CCI_REG8(0x3020)
+#define STARVIS2_REG_WINMODEV             CCI_REG8(0x3021)
 
 /* Sensor Identification */
-#define IMX678_REG_MONOCHROME		CCI_REG8(0x4d18)
-#define IMX678_TYPE			BIT(0)
+#define STARVIS2_REG_MONOCHROME		CCI_REG8(0x4d18)
+#define STARVIS2_TYPE			BIT(0)
 #define IMX678_REG_MODULE_ID		CCI_REG16_LE(0x4d1c)
 #define IMX678_ID			0x02a6
-#define IMX678_MODULE_ID_DELAY		80000
+#define STARVIS2_MODULE_ID_DELAY	80000
 
 /* Common configuration registers */
-#define IMX678_REG_WDMODE               CCI_REG8(0x301a)
-#define IMX678_REG_ADDMODE              CCI_REG8(0x301b)
-#define IMX678_REG_THIN_V_EN            CCI_REG8(0x301c)
-#define IMX678_REG_VCMODE               CCI_REG8(0x301e)
-#define IMX678_REG_ADBIT                CCI_REG8(0x3022)
-#define IMX678_REG_MDBIT                CCI_REG8(0x3023)
-#define IMX678_REG_GAIN_PGC_FIDMD       CCI_REG8(0x3400)
+#define STARVIS2_REG_WDMODE               CCI_REG8(0x301a)
+#define STARVIS2_REG_ADDMODE              CCI_REG8(0x301b)
+#define STARVIS2_REG_THIN_V_EN            CCI_REG8(0x301c)
+#define STARVIS2_REG_VCMODE               CCI_REG8(0x301e)
+#define STARVIS2_REG_ADBIT                CCI_REG8(0x3022)
+#define STARVIS2_REG_MDBIT                CCI_REG8(0x3023)
+#define STARVIS2_REG_GAIN_PGC_FIDMD       CCI_REG8(0x3400)
 
 /* Test pattern generator */
-#define IMX678_REG_TPG_EN_DUOUT		CCI_REG8(0x30e0)
-#define IMX678_REG_TPG_PATSEL_DUOUT	CCI_REG8(0x30e2)
-#define IMX678_TPG_ALL_000		0
-#define IMX678_TPG_ALL_FFF		1
-#define IMX678_TPG_ALL_555		2
-#define IMX678_TPG_ALL_AAA		3
-#define IMX678_TPG_TOG_555_AAA		4
-#define IMX678_TPG_TOG_AAA_555		5
-#define IMX678_TPG_TOG_000_555		6
-#define IMX678_TPG_TOG_555_000		7
-#define IMX678_TPG_TOG_000_FFF		8
-#define IMX678_TPG_TOG_FFF_000		9
-#define IMX678_TPG_H_COLOR_BARS		10
-#define IMX678_TPG_V_COLOR_BARS		11
-#define IMX678_REG_TPG_COLORWIDTH	CCI_REG8(0x30e4)
-#define IMX678_TPG_COLORWIDTH_80PIX	0
-#define IMX678_TPG_COLORWIDTH_160PIX	1
-#define IMX678_TPG_COLORWIDTH_320PIX	2
-#define IMX678_TPG_COLORWIDTH_640PIX	3
-
-#define IMX678_REG_INTERFACE_SEL	CCI_REG8(0x4e3c)
-#define IMX678_INTERFACE_2L_4L		0x07
-#define IMX678_INTERFACE_8L_2x4L	0x7f
+#define STARVIS2_REG_TPG_EN_DUOUT		CCI_REG8(0x30e0)
+#define STARVIS2_REG_TPG_PATSEL_DUOUT	CCI_REG8(0x30e2)
+#define STARVIS2_TPG_ALL_000		0
+#define STARVIS2_TPG_ALL_FFF		1
+#define STARVIS2_TPG_ALL_555		2
+#define STARVIS2_TPG_ALL_AAA		3
+#define STARVIS2_TPG_TOG_555_AAA	4
+#define STARVIS2_TPG_TOG_AAA_555	5
+#define STARVIS2_TPG_TOG_000_555	6
+#define STARVIS2_TPG_TOG_555_000	7
+#define STARVIS2_TPG_TOG_000_FFF	8
+#define STARVIS2_TPG_TOG_FFF_000	9
+#define STARVIS2_TPG_H_COLOR_BARS	10
+#define STARVIS2_TPG_V_COLOR_BARS	11
+#define STARVIS2_REG_TPG_COLORWIDTH	CCI_REG8(0x30e4)
+#define STARVIS2_TPG_COLORWIDTH_80PIX	0
+#define STARVIS2_TPG_COLORWIDTH_160PIX	1
+#define STARVIS2_TPG_COLORWIDTH_320PIX	2
+#define STARVIS2_TPG_COLORWIDTH_640PIX	3
+
+#define STARVIS2_REG_INTERFACE_SEL	CCI_REG8(0x4e3c)
+#define STARVIS2_INTERFACE_2L_4L	0x07
+#define STARVIS2_INTERFACE_8L_2x4L	0x7f
 
 /* Minimum output resolution */
 #define IMX678_PIXEL_ARRAY_MIN_WIDTH	1040
@@ -146,7 +151,7 @@
 #define IMX678_CROP_VST_ALIGN		4
 
 /* Subdev pads */
-#define IMX678_SOURCE_PAD		0
+#define STARVIS2_SOURCE_PAD		0
 
 /* IMX678 native and active pixel array size. */
 static const struct v4l2_rect imx678_native_area = {
@@ -163,73 +168,73 @@ static const struct v4l2_rect imx678_active_area = {
 	.height = 2180,
 };
 
-enum imx678_type {
-	IMX678_COLOR = 0,
-	IMX678_MONOCHROME = 1,
+enum starvis2_type {
+	STARVIS2_COLOR = 0,
+	STARVIS2_MONOCHROME = 1,
 };
 
-struct imx678_model_info {
-	enum imx678_type type;
+struct starvis2_model_info {
+	enum starvis2_type type;
 	const u32 *codes;
 	unsigned int num_codes;
 };
 
-enum imx678_lanemode {
-	IMX678_LANEMODE_2L = 1,
-	IMX678_LANEMODE_4L = 3,
+enum starvis2_lanemode {
+	STARVIS2_LANEMODE_2L = 1,
+	STARVIS2_LANEMODE_4L = 3,
 };
 
 /* Link frequency setup (DDR: lane rate = 2 x link freq) */
 enum {
-	IMX678_LINK_FREQ_297MHZ,
-	IMX678_LINK_FREQ_360MHZ,
-	IMX678_LINK_FREQ_445MHZ,
-	IMX678_LINK_FREQ_594MHZ,
-	IMX678_LINK_FREQ_720MHZ,
-	IMX678_LINK_FREQ_891MHZ,
-	IMX678_LINK_FREQ_1039MHZ,
-	IMX678_LINK_FREQ_1188MHZ,
+	STARVIS2_LINK_FREQ_297MHZ,
+	STARVIS2_LINK_FREQ_360MHZ,
+	STARVIS2_LINK_FREQ_445MHZ,
+	STARVIS2_LINK_FREQ_594MHZ,
+	STARVIS2_LINK_FREQ_720MHZ,
+	STARVIS2_LINK_FREQ_891MHZ,
+	STARVIS2_LINK_FREQ_1039MHZ,
+	STARVIS2_LINK_FREQ_1188MHZ,
 };
 
 static const u8 link_freqs_reg_value[] = {
-	[IMX678_LINK_FREQ_297MHZ]  = 0x07,
-	[IMX678_LINK_FREQ_360MHZ]  = 0x06,
-	[IMX678_LINK_FREQ_445MHZ]  = 0x05,
-	[IMX678_LINK_FREQ_594MHZ]  = 0x04,
-	[IMX678_LINK_FREQ_720MHZ]  = 0x03,
-	[IMX678_LINK_FREQ_891MHZ]  = 0x02,
-	[IMX678_LINK_FREQ_1039MHZ] = 0x01,
-	[IMX678_LINK_FREQ_1188MHZ] = 0x00,
+	[STARVIS2_LINK_FREQ_297MHZ]  = 0x07,
+	[STARVIS2_LINK_FREQ_360MHZ]  = 0x06,
+	[STARVIS2_LINK_FREQ_445MHZ]  = 0x05,
+	[STARVIS2_LINK_FREQ_594MHZ]  = 0x04,
+	[STARVIS2_LINK_FREQ_720MHZ]  = 0x03,
+	[STARVIS2_LINK_FREQ_891MHZ]  = 0x02,
+	[STARVIS2_LINK_FREQ_1039MHZ] = 0x01,
+	[STARVIS2_LINK_FREQ_1188MHZ] = 0x00,
 };
 
 static const u64 link_freqs[] = {
-	[IMX678_LINK_FREQ_297MHZ]  = 297000000,
-	[IMX678_LINK_FREQ_360MHZ]  = 360000000,
-	[IMX678_LINK_FREQ_445MHZ]  = 445500000,
-	[IMX678_LINK_FREQ_594MHZ]  = 594000000,
-	[IMX678_LINK_FREQ_720MHZ]  = 720000000,
-	[IMX678_LINK_FREQ_891MHZ]  = 891000000,
-	[IMX678_LINK_FREQ_1039MHZ] = 1039500000,
-	[IMX678_LINK_FREQ_1188MHZ] = 1188000000,
+	[STARVIS2_LINK_FREQ_297MHZ]  = 297000000,
+	[STARVIS2_LINK_FREQ_360MHZ]  = 360000000,
+	[STARVIS2_LINK_FREQ_445MHZ]  = 445500000,
+	[STARVIS2_LINK_FREQ_594MHZ]  = 594000000,
+	[STARVIS2_LINK_FREQ_720MHZ]  = 720000000,
+	[STARVIS2_LINK_FREQ_891MHZ]  = 891000000,
+	[STARVIS2_LINK_FREQ_1039MHZ] = 1039500000,
+	[STARVIS2_LINK_FREQ_1188MHZ] = 1188000000,
 };
 
 static const u16 min_hmax_4lane[] = {
-	[IMX678_LINK_FREQ_297MHZ] = 1584,
-	[IMX678_LINK_FREQ_360MHZ] = 1320,
-	[IMX678_LINK_FREQ_445MHZ] = 1100,
-	[IMX678_LINK_FREQ_594MHZ] =  792,
-	[IMX678_LINK_FREQ_720MHZ] =  660,
-	[IMX678_LINK_FREQ_891MHZ] =  550,
-	[IMX678_LINK_FREQ_1039MHZ] = 550,
-	[IMX678_LINK_FREQ_1188MHZ] = 550,
+	[STARVIS2_LINK_FREQ_297MHZ] = 1584,
+	[STARVIS2_LINK_FREQ_360MHZ] = 1320,
+	[STARVIS2_LINK_FREQ_445MHZ] = 1100,
+	[STARVIS2_LINK_FREQ_594MHZ] =  792,
+	[STARVIS2_LINK_FREQ_720MHZ] =  660,
+	[STARVIS2_LINK_FREQ_891MHZ] =  550,
+	[STARVIS2_LINK_FREQ_1039MHZ] = 550,
+	[STARVIS2_LINK_FREQ_1188MHZ] = 550,
 };
 
-struct imx678_inck_cfg {
+struct starvis2_inck_cfg {
 	u32 xclk_hz;   /* platform clock rate  */
 	u8  inck_sel;  /* value for reg        */
 };
 
-static const struct imx678_inck_cfg imx678_inck_table[] = {
+static const struct starvis2_inck_cfg starvis2_inck_table[] = {
 	{ 74250000, 0x00 },
 	{ 37125000, 0x01 },
 	{ 72000000, 0x02 },
@@ -240,7 +245,7 @@ static const struct imx678_inck_cfg imx678_inck_table[] = {
 	{ 13500000, 0x07 },
 };
 
-static const char * const imx678_tpg_menu[] = {
+static const char * const starvis2_tpg_menu[] = {
 	"Disabled",
 	"All 000h",
 	"All FFFh",
@@ -256,28 +261,28 @@ static const char * const imx678_tpg_menu[] = {
 	"Vertical color bars",
 };
 
-static const int imx678_tpg_val[] = {
-	IMX678_TPG_ALL_000,
-	IMX678_TPG_ALL_000,
-	IMX678_TPG_ALL_FFF,
-	IMX678_TPG_ALL_555,
-	IMX678_TPG_ALL_AAA,
-	IMX678_TPG_TOG_555_AAA,
-	IMX678_TPG_TOG_AAA_555,
-	IMX678_TPG_TOG_000_555,
-	IMX678_TPG_TOG_555_000,
-	IMX678_TPG_TOG_000_FFF,
-	IMX678_TPG_TOG_FFF_000,
-	IMX678_TPG_H_COLOR_BARS,
-	IMX678_TPG_V_COLOR_BARS,
+static const int starvis2_tpg_val[] = {
+	STARVIS2_TPG_ALL_000,
+	STARVIS2_TPG_ALL_000,
+	STARVIS2_TPG_ALL_FFF,
+	STARVIS2_TPG_ALL_555,
+	STARVIS2_TPG_ALL_AAA,
+	STARVIS2_TPG_TOG_555_AAA,
+	STARVIS2_TPG_TOG_AAA_555,
+	STARVIS2_TPG_TOG_000_555,
+	STARVIS2_TPG_TOG_555_000,
+	STARVIS2_TPG_TOG_000_FFF,
+	STARVIS2_TPG_TOG_FFF_000,
+	STARVIS2_TPG_H_COLOR_BARS,
+	STARVIS2_TPG_V_COLOR_BARS,
 };
 
 /* Common configuration */
 static const struct cci_reg_sequence common_regs[] = {
-	{ IMX678_REG_THIN_V_EN, 0x00 },
-	{ IMX678_REG_VCMODE, 0x01 },
+	{ STARVIS2_REG_THIN_V_EN, 0x00 },
+	{ STARVIS2_REG_VCMODE, 0x01 },
 	{ CCI_REG8(0x306b), 0x00 },
-	{ IMX678_REG_GAIN_PGC_FIDMD, 0x01 },
+	{ STARVIS2_REG_GAIN_PGC_FIDMD, 0x01 },
 	{ CCI_REG8(0x3460), 0x22 },
 	{ CCI_REG8(0x355a), 0x64 },
 	{ CCI_REG8(0x3a02), 0x7a },
@@ -643,9 +648,9 @@ static const struct cci_reg_sequence common_regs[] = {
 	{ CCI_REG8(0x47c1), 0x01 },
 	{ CCI_REG8(0x47c2), 0x3e },
 	{ CCI_REG8(0x47c3), 0x01 },
-	{ IMX678_REG_WDMODE, 0x00 },
-	{ IMX678_REG_MDBIT, 0x01 },
-	{ IMX678_REG_XXS_DRV, 0x00 },
+	{ STARVIS2_REG_WDMODE, 0x00 },
+	{ STARVIS2_REG_MDBIT, 0x01 },
+	{ STARVIS2_REG_XXS_DRV, 0x00 },
 };
 
 static const u32 codes_bayer[] = {
@@ -656,30 +661,30 @@ static const u32 codes_monochrome[] = {
 	MEDIA_BUS_FMT_Y12_1X12,
 };
 
-static const struct imx678_model_info imx678_aaqr_info = {
-	.type = IMX678_COLOR,
+static const struct starvis2_model_info imx678_aaqr_info = {
+	.type = STARVIS2_COLOR,
 	.codes = codes_bayer,
 	.num_codes = ARRAY_SIZE(codes_bayer),
 };
 
-static const struct imx678_model_info imx678_aamr_info = {
-	.type = IMX678_MONOCHROME,
+static const struct starvis2_model_info imx678_aamr_info = {
+	.type = STARVIS2_MONOCHROME,
 	.codes = codes_monochrome,
 	.num_codes = ARRAY_SIZE(codes_monochrome),
 };
 
-static const char * const imx678_supply_name[] = {
+static const char * const starvis2_supply_name[] = {
 	"avdd",  /* Analog (3.3V) supply */
 	"dvdd",  /* Digital Core (1.1V) supply */
 	"ovdd",  /* IF (1.8V) supply */
 };
 
-struct imx678 {
+struct starvis2 {
 	struct v4l2_subdev sd;
 	struct media_pad pad;
 	struct regmap *cci;
 
-	const struct imx678_model_info *info;
+	const struct starvis2_model_info *info;
 
 	struct clk *xclk;
 	u32 xclk_freq;
@@ -688,11 +693,11 @@ struct imx678 {
 	u8 inck_sel_val;
 
 	/* Link configurations */
-	enum imx678_lanemode lane_mode;
+	enum starvis2_lanemode lane_mode;
 	unsigned long link_freq_bitmap;
 
 	struct gpio_desc *reset_gpio;
-	struct regulator_bulk_data supplies[ARRAY_SIZE(imx678_supply_name)];
+	struct regulator_bulk_data supplies[ARRAY_SIZE(starvis2_supply_name)];
 
 	struct v4l2_ctrl_handler ctrl_handler;
 
@@ -705,49 +710,49 @@ struct imx678 {
 	u32 vmax;
 };
 
-static inline struct imx678 *to_imx678(struct v4l2_subdev *_sd)
+static inline struct starvis2 *to_starvis2(struct v4l2_subdev *_sd)
 {
-	return container_of_const(_sd, struct imx678, sd);
+	return container_of_const(_sd, struct starvis2, sd);
 }
 
-static u32 imx678_default_mbus_code(struct imx678 *imx678)
+static u32 starvis2_default_mbus_code(struct starvis2 *starvis2)
 {
-	return imx678->info->codes[0];
+	return starvis2->info->codes[0];
 }
 
-static bool imx678_mbus_code_supported(struct imx678 *imx678, u32 code)
+static bool starvis2_mbus_code_supported(struct starvis2 *starvis2, u32 code)
 {
-	for (unsigned int i = 0; i < imx678->info->num_codes; i++) {
-		if (imx678->info->codes[i] == code)
+	for (unsigned int i = 0; i < starvis2->info->num_codes; i++) {
+		if (starvis2->info->codes[i] == code)
 			return true;
 	}
 
 	return false;
 }
 
-static int imx678_set_ctrl(struct v4l2_ctrl *ctrl)
+static int starvis2_set_ctrl(struct v4l2_ctrl *ctrl)
 {
-	struct imx678 *imx678 = container_of_const(ctrl->handler, struct
-						   imx678, ctrl_handler);
-	struct i2c_client *client = v4l2_get_subdevdata(&imx678->sd);
+	struct starvis2 *starvis2 = container_of_const(ctrl->handler, struct
+						       starvis2, ctrl_handler);
+	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
 	const struct v4l2_mbus_framefmt *format;
 	struct v4l2_subdev_state *state;
 	int ret = 0;
 
-	state = v4l2_subdev_get_locked_active_state(&imx678->sd);
-	format = v4l2_subdev_state_get_format(state, IMX678_SOURCE_PAD);
+	state = v4l2_subdev_get_locked_active_state(&starvis2->sd);
+	format = v4l2_subdev_state_get_format(state, STARVIS2_SOURCE_PAD);
 
 	if (ctrl->id == V4L2_CID_VBLANK) {
-		u32 current_exposure = imx678->exposure->cur.val;
+		u32 current_exposure = starvis2->exposure->cur.val;
 
-		imx678->vmax = format->height + ctrl->val;
+		starvis2->vmax = format->height + ctrl->val;
 
 		current_exposure = clamp_t(u32, current_exposure,
-					   IMX678_EXPOSURE_MIN,
-					   imx678->vmax - IMX678_SHR_MIN);
-		ret = __v4l2_ctrl_modify_range(imx678->exposure,
-					       IMX678_EXPOSURE_MIN,
-					       imx678->vmax - IMX678_SHR_MIN,
+					   STARVIS2_EXPOSURE_MIN,
+					   starvis2->vmax - STARVIS2_SHR_MIN);
+		ret = __v4l2_ctrl_modify_range(starvis2->exposure,
+					       STARVIS2_EXPOSURE_MIN,
+					       starvis2->vmax - STARVIS2_SHR_MIN,
 					       1, current_exposure);
 		if (ret)
 			return ret;
@@ -762,38 +767,41 @@ static int imx678_set_ctrl(struct v4l2_ctrl *ctrl)
 
 	switch (ctrl->id) {
 	case V4L2_CID_VBLANK:
-		cci_write(imx678->cci, IMX678_REG_VMAX, imx678->vmax, &ret);
+		cci_write(starvis2->cci, STARVIS2_REG_VMAX, starvis2->vmax,
+			  &ret);
 		fallthrough; /* SHR = VMAX - exposure, so update it */
 	case V4L2_CID_EXPOSURE: {
-		u32 shr = imx678->vmax - imx678->exposure->val;
+		u32 shr = starvis2->vmax - starvis2->exposure->val;
 
-		cci_write(imx678->cci, IMX678_REG_SHR, shr, &ret);
+		cci_write(starvis2->cci, STARVIS2_REG_SHR, shr, &ret);
 		break;
 	}
 	case V4L2_CID_ANALOGUE_GAIN:
-		cci_write(imx678->cci, IMX678_REG_GAIN, ctrl->val, &ret);
+		cci_write(starvis2->cci, STARVIS2_REG_GAIN, ctrl->val, &ret);
 		break;
 	case V4L2_CID_HBLANK: {
 		u32 hmax = (format->width + ctrl->val) / IMX678_PIX_PER_CLK;
 
-		cci_write(imx678->cci, IMX678_REG_HMAX, hmax, &ret);
+		cci_write(starvis2->cci, STARVIS2_REG_HMAX, hmax, &ret);
 		break;
 	}
 	case V4L2_CID_TEST_PATTERN: {
-		cci_write(imx678->cci, IMX678_REG_TPG_COLORWIDTH,
-			  IMX678_TPG_COLORWIDTH_160PIX, &ret);
-		cci_write(imx678->cci, IMX678_REG_TPG_PATSEL_DUOUT,
-			  imx678_tpg_val[ctrl->val], &ret);
-		cci_write(imx678->cci, IMX678_REG_TPG_EN_DUOUT,
+		cci_write(starvis2->cci, STARVIS2_REG_TPG_COLORWIDTH,
+			  STARVIS2_TPG_COLORWIDTH_160PIX, &ret);
+		cci_write(starvis2->cci, STARVIS2_REG_TPG_PATSEL_DUOUT,
+			  starvis2_tpg_val[ctrl->val], &ret);
+		cci_write(starvis2->cci, STARVIS2_REG_TPG_EN_DUOUT,
 			  (ctrl->val) ? 1 : 0,
 			  &ret);
 		break;
 	}
 	case V4L2_CID_HFLIP:
-		cci_write(imx678->cci, IMX678_REG_WINMODEH, ctrl->val, &ret);
+		cci_write(starvis2->cci, STARVIS2_REG_WINMODEH, ctrl->val,
+			  &ret);
 		break;
 	case V4L2_CID_VFLIP:
-		cci_write(imx678->cci, IMX678_REG_WINMODEV, ctrl->val, &ret);
+		cci_write(starvis2->cci, STARVIS2_REG_WINMODEV, ctrl->val,
+			  &ret);
 		break;
 	default:
 		dev_warn(&client->dev,
@@ -807,35 +815,35 @@ static int imx678_set_ctrl(struct v4l2_ctrl *ctrl)
 	return ret;
 }
 
-static const struct v4l2_ctrl_ops imx678_ctrl_ops = {
-	.s_ctrl = imx678_set_ctrl,
+static const struct v4l2_ctrl_ops starvis2_ctrl_ops = {
+	.s_ctrl = starvis2_set_ctrl,
 };
 
-static int imx678_enum_mbus_code(struct v4l2_subdev *sd,
-				 struct v4l2_subdev_state *sd_state,
-				 struct v4l2_subdev_mbus_code_enum *code)
+static int starvis2_enum_mbus_code(struct v4l2_subdev *sd,
+				   struct v4l2_subdev_state *sd_state,
+				   struct v4l2_subdev_mbus_code_enum *code)
 {
-	struct imx678 *imx678 = to_imx678(sd);
+	struct starvis2 *starvis2 = to_starvis2(sd);
 
-	if (code->index >= imx678->info->num_codes)
+	if (code->index >= starvis2->info->num_codes)
 		return -EINVAL;
 
-	code->code = imx678->info->codes[code->index];
+	code->code = starvis2->info->codes[code->index];
 
 	return 0;
 }
 
-static int imx678_enum_frame_size(struct v4l2_subdev *sd,
-				  struct v4l2_subdev_state *sd_state,
-				  struct v4l2_subdev_frame_size_enum *fse)
+static int starvis2_enum_frame_size(struct v4l2_subdev *sd,
+				    struct v4l2_subdev_state *sd_state,
+				    struct v4l2_subdev_frame_size_enum *fse)
 {
-	struct imx678 *imx678 = to_imx678(sd);
+	struct starvis2 *starvis2 = to_starvis2(sd);
 	const struct v4l2_rect *crop;
 
 	if (fse->index)
 		return -EINVAL;
 
-	if (!imx678_mbus_code_supported(imx678, fse->code))
+	if (!starvis2_mbus_code_supported(starvis2, fse->code))
 		return -EINVAL;
 
 	crop = v4l2_subdev_state_get_crop(sd_state, fse->pad);
@@ -848,10 +856,10 @@ static int imx678_enum_frame_size(struct v4l2_subdev *sd,
 	return 0;
 }
 
-static int imx678_get_selection(struct v4l2_subdev *sd,
-				const struct v4l2_subdev_client_info *ci,
-				struct v4l2_subdev_state *sd_state,
-				struct v4l2_subdev_selection *sel)
+static int starvis2_get_selection(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
+				  struct v4l2_subdev_state *sd_state,
+				  struct v4l2_subdev_selection *sel)
 {
 	switch (sel->target) {
 	case V4L2_SEL_TGT_CROP:
@@ -871,18 +879,18 @@ static int imx678_get_selection(struct v4l2_subdev *sd,
 	return -EINVAL;
 }
 
-static int imx678_init_state(struct v4l2_subdev *sd,
-			     struct v4l2_subdev_state *state)
+static int starvis2_init_state(struct v4l2_subdev *sd,
+			       struct v4l2_subdev_state *state)
 {
-	struct imx678 *imx678 = to_imx678(sd);
+	struct starvis2 *starvis2 = to_starvis2(sd);
 	struct v4l2_mbus_framefmt *format;
 	struct v4l2_rect *crop;
 
-	crop = v4l2_subdev_state_get_crop(state, IMX678_SOURCE_PAD);
+	crop = v4l2_subdev_state_get_crop(state, STARVIS2_SOURCE_PAD);
 	*crop = imx678_active_area;
 
-	format = v4l2_subdev_state_get_format(state, IMX678_SOURCE_PAD);
-	format->code = imx678_default_mbus_code(imx678);
+	format = v4l2_subdev_state_get_format(state, STARVIS2_SOURCE_PAD);
+	format->code = starvis2_default_mbus_code(starvis2);
 	format->width = imx678_active_area.width;
 	format->height = imx678_active_area.height;
 	format->field = V4L2_FIELD_NONE;
@@ -894,50 +902,53 @@ static int imx678_init_state(struct v4l2_subdev *sd,
 	return 0;
 }
 
-static int imx678_write_common(struct imx678 *imx678)
+static int starvis2_write_common(struct starvis2 *starvis2)
 {
 	int ret = 0;
 
-	cci_multi_reg_write(imx678->cci, common_regs, ARRAY_SIZE(common_regs),
+	cci_multi_reg_write(starvis2->cci, common_regs, ARRAY_SIZE(common_regs),
 			    &ret);
 
-	cci_write(imx678->cci, IMX678_REG_INCK_SEL, imx678->inck_sel_val, &ret);
-	cci_write(imx678->cci, IMX678_REG_DATARATE_SEL,
-		  link_freqs_reg_value[__ffs(imx678->link_freq_bitmap)], &ret);
-	cci_write(imx678->cci, IMX678_REG_LANEMODE, imx678->lane_mode, &ret);
-
-	cci_write(imx678->cci, IMX678_REG_INTERFACE_SEL, IMX678_INTERFACE_2L_4L,
+	cci_write(starvis2->cci, STARVIS2_REG_INCK_SEL, starvis2->inck_sel_val,
+		  &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_DATARATE_SEL,
+		  link_freqs_reg_value[__ffs(starvis2->link_freq_bitmap)],
+		  &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_LANEMODE, starvis2->lane_mode,
 		  &ret);
 
+	cci_write(starvis2->cci, STARVIS2_REG_INTERFACE_SEL,
+		  STARVIS2_INTERFACE_2L_4L, &ret);
+
 	return ret;
 }
 
-static int imx678_program_window(struct imx678 *imx678,
-				 const struct v4l2_rect *crop)
+static int starvis2_program_window(struct starvis2 *starvis2,
+				   const struct v4l2_rect *crop)
 {
 	int ret = 0;
 
-	cci_write(imx678->cci, IMX678_REG_ADDMODE, 0x00, &ret);
-	cci_write(imx678->cci, IMX678_REG_WINMODE,
+	cci_write(starvis2->cci, STARVIS2_REG_ADDMODE, 0x00, &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_WINMODE,
 		  v4l2_rect_equal(crop, &imx678_active_area) ? 0x00 : 0x04,
 		  &ret);
-	cci_write(imx678->cci, IMX678_REG_PIX_HST,
+	cci_write(starvis2->cci, STARVIS2_REG_PIX_HST,
 		  crop->left - imx678_active_area.left, &ret);
-	cci_write(imx678->cci, IMX678_REG_PIX_HWIDTH, crop->width, &ret);
-	cci_write(imx678->cci, IMX678_REG_PIX_VST,
+	cci_write(starvis2->cci, STARVIS2_REG_PIX_HWIDTH, crop->width, &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_PIX_VST,
 		  crop->top - imx678_active_area.top, &ret);
-	cci_write(imx678->cci, IMX678_REG_PIX_VWIDTH, crop->height, &ret);
-	cci_write(imx678->cci, IMX678_REG_ADBIT, 0x01, &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_PIX_VWIDTH, crop->height, &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_ADBIT, 0x01, &ret);
 
 	return ret;
 }
 
-static int imx678_enable_streams(struct v4l2_subdev *sd,
-				 struct v4l2_subdev_state *state, u32 pad,
-				 u64 mask)
+static int starvis2_enable_streams(struct v4l2_subdev *sd,
+				   struct v4l2_subdev_state *state, u32 pad,
+				   u64 mask)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
-	struct imx678 *imx678 = to_imx678(sd);
+	struct starvis2 *starvis2 = to_starvis2(sd);
 	const struct v4l2_rect *crop;
 	int ret;
 
@@ -946,24 +957,24 @@ static int imx678_enable_streams(struct v4l2_subdev *sd,
 		return ret;
 
 	crop = v4l2_subdev_state_get_crop(state, pad);
-	ret = imx678_program_window(imx678, crop);
+	ret = starvis2_program_window(starvis2, crop);
 	if (ret) {
 		dev_err(&client->dev, "%s failed to set mode\n", __func__);
 		goto err_rpm_put;
 	}
 
-	ret = __v4l2_ctrl_handler_setup(imx678->sd.ctrl_handler);
+	ret = __v4l2_ctrl_handler_setup(starvis2->sd.ctrl_handler);
 	if (ret) {
 		dev_err(&client->dev, "%s failed to apply user values\n",
 			__func__);
 		goto err_rpm_put;
 	}
 
-	cci_write(imx678->cci, IMX678_REG_MODE_SELECT, IMX678_MODE_STREAMING,
-		  &ret);
-	usleep_range(IMX678_STREAM_DELAY_US, IMX678_STREAM_DELAY_US +
-		     IMX678_STREAM_DELAY_RANGE_US);
-	cci_write(imx678->cci, IMX678_REG_XMSTA, 0x00, &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT,
+		  STARVIS2_MODE_STREAMING, &ret);
+	usleep_range(STARVIS2_STREAM_DELAY_US, STARVIS2_STREAM_DELAY_US +
+		     STARVIS2_STREAM_DELAY_RANGE_US);
+	cci_write(starvis2->cci, STARVIS2_REG_XMSTA, 0x00, &ret);
 
 	if (ret) {
 		dev_err(&client->dev, "%s failed to start streaming\n",
@@ -979,19 +990,19 @@ static int imx678_enable_streams(struct v4l2_subdev *sd,
 	return ret;
 }
 
-static int imx678_disable_streams(struct v4l2_subdev *sd,
-				  struct v4l2_subdev_state *state,
-				  u32 pad, u64 mask)
+static int starvis2_disable_streams(struct v4l2_subdev *sd,
+				    struct v4l2_subdev_state *state,
+				    u32 pad, u64 mask)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
-	struct imx678 *imx678 = to_imx678(sd);
+	struct starvis2 *starvis2 = to_starvis2(sd);
 	int ret = 0;
 
 	/* Master mode disable */
-	cci_write(imx678->cci, IMX678_REG_XMSTA, 0x01, &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_XMSTA, 0x01, &ret);
 	/* Standby */
-	cci_write(imx678->cci, IMX678_REG_MODE_SELECT, IMX678_MODE_STANDBY,
-		  &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT,
+		  STARVIS2_MODE_STANDBY, &ret);
 	if (ret)
 		dev_err(&client->dev, "%s failed to stop stream\n", __func__);
 
@@ -1000,15 +1011,15 @@ static int imx678_disable_streams(struct v4l2_subdev *sd,
 	return ret;
 }
 
-static int imx678_power_on(struct device *dev)
+static int starvis2_power_on(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
-	struct imx678 *imx678 = to_imx678(sd);
+	struct starvis2 *starvis2 = to_starvis2(sd);
 	int ret;
 
-	ret = regulator_bulk_enable(ARRAY_SIZE(imx678_supply_name),
-				    imx678->supplies);
+	ret = regulator_bulk_enable(ARRAY_SIZE(starvis2_supply_name),
+				    starvis2->supplies);
 	if (ret) {
 		dev_err(&client->dev, "%s: failed to enable regulators\n",
 			__func__);
@@ -1017,11 +1028,11 @@ static int imx678_power_on(struct device *dev)
 
 	fsleep(1); /* Tlow > 500ns */
 
-	gpiod_set_value_cansleep(imx678->reset_gpio, 0);
+	gpiod_set_value_cansleep(starvis2->reset_gpio, 0);
 
 	fsleep(1); /* T3 > 1us */
 
-	ret = clk_prepare_enable(imx678->xclk);
+	ret = clk_prepare_enable(starvis2->xclk);
 	if (ret) {
 		dev_err(&client->dev, "%s: failed to enable clock\n",
 			__func__);
@@ -1030,7 +1041,7 @@ static int imx678_power_on(struct device *dev)
 
 	fsleep(20); /* T4 > 20us */
 
-	ret = imx678_write_common(imx678);
+	ret = starvis2_write_common(starvis2);
 	if (ret) {
 		dev_err(&client->dev, "%s failed to write registers\n",
 			__func__);
@@ -1040,35 +1051,35 @@ static int imx678_power_on(struct device *dev)
 	return 0;
 
 clk_off:
-	clk_disable_unprepare(imx678->xclk);
+	clk_disable_unprepare(starvis2->xclk);
 
 reg_off:
-	gpiod_set_value_cansleep(imx678->reset_gpio, 1);
-	regulator_bulk_disable(ARRAY_SIZE(imx678_supply_name),
-			       imx678->supplies);
+	gpiod_set_value_cansleep(starvis2->reset_gpio, 1);
+	regulator_bulk_disable(ARRAY_SIZE(starvis2_supply_name),
+			       starvis2->supplies);
 
 	return ret;
 }
 
-static int imx678_power_off(struct device *dev)
+static int starvis2_power_off(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
-	struct imx678 *imx678 = to_imx678(sd);
+	struct starvis2 *starvis2 = to_starvis2(sd);
 
-	clk_disable_unprepare(imx678->xclk);
-	gpiod_set_value_cansleep(imx678->reset_gpio, 1);
-	regulator_bulk_disable(ARRAY_SIZE(imx678_supply_name),
-			       imx678->supplies);
+	clk_disable_unprepare(starvis2->xclk);
+	gpiod_set_value_cansleep(starvis2->reset_gpio, 1);
+	regulator_bulk_disable(ARRAY_SIZE(starvis2_supply_name),
+			       starvis2->supplies);
 
 	return 0;
 }
 
-static int imx678_identify_model(struct imx678 *imx678)
+static int starvis2_identify_model(struct starvis2 *starvis2)
 {
-	struct i2c_client *client = v4l2_get_subdevdata(&imx678->sd);
-	const struct imx678_model_info *info;
-	enum imx678_type detected;
+	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
+	const struct starvis2_model_info *info;
+	enum starvis2_type detected;
 	int ret = 0;
 	u64 val = 0;
 
@@ -1078,10 +1089,10 @@ static int imx678_identify_model(struct imx678 *imx678)
 	 * This sensor's ID registers become accessible 80ms after coming out
 	 * of STANDBY mode.
 	 */
-	cci_write(imx678->cci, IMX678_REG_MODE_SELECT, 0, &ret);
-	fsleep(IMX678_MODULE_ID_DELAY);
+	cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT, 0, &ret);
+	fsleep(STARVIS2_MODULE_ID_DELAY);
 
-	cci_read(imx678->cci, IMX678_REG_MODULE_ID, &val, &ret);
+	cci_read(starvis2->cci, IMX678_REG_MODULE_ID, &val, &ret);
 
 	if (ret) {
 		dev_err(&client->dev,
@@ -1095,7 +1106,7 @@ static int imx678_identify_model(struct imx678 *imx678)
 		return -ENXIO;
 	}
 
-	cci_read(imx678->cci, IMX678_REG_MONOCHROME, &val, &ret);
+	cci_read(starvis2->cci, STARVIS2_REG_MONOCHROME, &val, &ret);
 
 	if (ret) {
 		dev_err(&client->dev,
@@ -1103,55 +1114,57 @@ static int imx678_identify_model(struct imx678 *imx678)
 		return ret;
 	}
 
-	detected = val & IMX678_TYPE;
+	detected = val & STARVIS2_TYPE;
 
 	/* Prefer to use sensor type specified in device tree */
 	if (info) {
-		imx678->info = info;
+		starvis2->info = info;
 		if (detected != info->type)
 			dev_err(&client->dev,
 				"detected %s sensor, DT specifies %s; using DT value\n",
-				detected == IMX678_COLOR ? "color" : "mono",
-				info->type == IMX678_COLOR ? "color" : "mono");
+				detected == STARVIS2_COLOR ? "color" : "mono",
+				info->type == STARVIS2_COLOR ? "color" : "mono");
 	} else {
-		imx678->info = detected == IMX678_MONOCHROME ?
+		starvis2->info = detected == STARVIS2_MONOCHROME ?
 			       &imx678_aamr_info : &imx678_aaqr_info;
 		dev_info(&client->dev,
 			 "sensor type missing in DT; detected %s sensor\n",
-			 detected == IMX678_MONOCHROME ? "mono" : "color");
+			 detected == STARVIS2_MONOCHROME ? "mono" : "color");
 	}
 
 	return 0;
 }
 
-static const struct v4l2_subdev_video_ops imx678_video_ops = {
+static const struct v4l2_subdev_video_ops starvis2_video_ops = {
 	.s_stream = v4l2_subdev_s_stream_helper,
 };
 
-static const struct v4l2_subdev_pad_ops imx678_pad_ops = {
-	.enum_mbus_code = imx678_enum_mbus_code,
+static const struct v4l2_subdev_pad_ops starvis2_pad_ops = {
+	.enum_mbus_code = starvis2_enum_mbus_code,
 	.get_fmt = v4l2_subdev_get_fmt,
-	.get_selection = imx678_get_selection,
-	.enum_frame_size = imx678_enum_frame_size,
-	.enable_streams = imx678_enable_streams,
-	.disable_streams = imx678_disable_streams,
+	.get_selection = starvis2_get_selection,
+	.enum_frame_size = starvis2_enum_frame_size,
+	.enable_streams = starvis2_enable_streams,
+	.disable_streams = starvis2_disable_streams,
 };
 
-static const struct v4l2_subdev_ops imx678_subdev_ops = {
-	.video = &imx678_video_ops,
-	.pad = &imx678_pad_ops,
+static const struct v4l2_subdev_ops starvis2_subdev_ops = {
+	.video = &starvis2_video_ops,
+	.pad = &starvis2_pad_ops,
 };
 
-static const struct v4l2_subdev_internal_ops imx678_internal_ops = {
-	.init_state = imx678_init_state,
+static const struct v4l2_subdev_internal_ops starvis2_internal_ops = {
+	.init_state = starvis2_init_state,
 };
 
-static int imx678_init_controls(struct imx678 *imx678)
+static int starvis2_init_controls(struct starvis2 *starvis2)
 {
 	struct v4l2_ctrl_handler *ctrl_hdlr;
-	const u32 hmax_4lane = min_hmax_4lane[__ffs(imx678->link_freq_bitmap)];
-	const u32 lane_scale = imx678->lane_mode == IMX678_LANEMODE_2L ? 2 : 1;
-	struct i2c_client *client = v4l2_get_subdevdata(&imx678->sd);
+	const u32 hmax_4lane =
+			min_hmax_4lane[__ffs(starvis2->link_freq_bitmap)];
+	const u32 lane_scale =
+			starvis2->lane_mode == STARVIS2_LANEMODE_2L ? 2 : 1;
+	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
 	struct v4l2_fwnode_device_properties props;
 	struct v4l2_ctrl *link_freq;
 	s32 hblank, max_hblank, vblank, max_vblank;
@@ -1162,66 +1175,66 @@ static int imx678_init_controls(struct imx678 *imx678)
 	if (ret < 0)
 		return ret;
 
-	ctrl_hdlr = &imx678->ctrl_handler;
+	ctrl_hdlr = &starvis2->ctrl_handler;
 	ret = v4l2_ctrl_handler_init(ctrl_hdlr, 11);
 	if (ret)
 		return ret;
 
-	imx678->vmax = IMX678_VMAX_DEFAULT;
+	starvis2->vmax = IMX678_VMAX_DEFAULT;
 	hmax = hmax_4lane * lane_scale;
 
 	/* PIXEL_RATE is fixed and read-only */
-	v4l2_ctrl_new_std(ctrl_hdlr, &imx678_ctrl_ops, V4L2_CID_PIXEL_RATE,
+	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,
 			  IMX678_PIXEL_RATE, IMX678_PIXEL_RATE, 1,
 			  IMX678_PIXEL_RATE);
 
 	/* LINK_FREQ is also read only */
-	link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &imx678_ctrl_ops,
+	link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
 					   V4L2_CID_LINK_FREQ,
 					   ARRAY_SIZE(link_freqs) - 1,
-					   __ffs(imx678->link_freq_bitmap),
+					   __ffs(starvis2->link_freq_bitmap),
 					   link_freqs);
 
 	if (link_freq)
 		link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
 
-	vblank = imx678->vmax - imx678_active_area.height;
-	max_vblank = IMX678_VMAX_MAX - imx678_active_area.height;
-	imx678->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx678_ctrl_ops,
-					   V4L2_CID_VBLANK, vblank, max_vblank,
-					   2, vblank);
+	vblank = starvis2->vmax - imx678_active_area.height;
+	max_vblank = STARVIS2_VMAX_MAX - imx678_active_area.height;
+	starvis2->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
+					     V4L2_CID_VBLANK, vblank, max_vblank,
+					     2, vblank);
 
 	hblank = hmax * IMX678_PIX_PER_CLK - imx678_active_area.width;
-	max_hblank = IMX678_HMAX_MAX * IMX678_PIX_PER_CLK -
+	max_hblank = STARVIS2_HMAX_MAX * IMX678_PIX_PER_CLK -
 		     imx678_active_area.width;
-	imx678->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx678_ctrl_ops,
-					   V4L2_CID_HBLANK, hblank, max_hblank,
-					   IMX678_PIX_PER_CLK, hblank);
-
-	imx678->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &imx678_ctrl_ops,
-					     V4L2_CID_EXPOSURE,
-					     IMX678_EXPOSURE_MIN,
-					     IMX678_VMAX_DEFAULT -
-					     IMX678_SHR_MIN,
-					     IMX678_EXPOSURE_STEP,
-					     IMX678_EXPOSURE_DEFAULT);
-
-	v4l2_ctrl_new_std(ctrl_hdlr, &imx678_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
-			  IMX678_ANA_GAIN_MIN_NORMAL,
-			  IMX678_ANA_GAIN_MAX_NORMAL, IMX678_ANA_GAIN_STEP,
-			  IMX678_ANA_GAIN_DEFAULT);
-
-	v4l2_ctrl_new_std(ctrl_hdlr, &imx678_ctrl_ops, V4L2_CID_HFLIP,
+	starvis2->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
+					     V4L2_CID_HBLANK, hblank, max_hblank,
+					     IMX678_PIX_PER_CLK, hblank);
+
+	starvis2->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
+					       V4L2_CID_EXPOSURE,
+					       STARVIS2_EXPOSURE_MIN,
+					       IMX678_VMAX_DEFAULT -
+					       STARVIS2_SHR_MIN,
+					       STARVIS2_EXPOSURE_STEP,
+					       STARVIS2_EXPOSURE_DEFAULT);
+
+	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
+			  STARVIS2_ANA_GAIN_MIN_NORMAL,
+			  STARVIS2_ANA_GAIN_MAX_NORMAL, STARVIS2_ANA_GAIN_STEP,
+			  STARVIS2_ANA_GAIN_DEFAULT);
+
+	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_HFLIP,
 			  0, 1, 1, 0);
-	v4l2_ctrl_new_std(ctrl_hdlr, &imx678_ctrl_ops, V4L2_CID_VFLIP,
+	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_VFLIP,
 			  0, 1, 1, 0);
 
-	v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &imx678_ctrl_ops,
+	v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &starvis2_ctrl_ops,
 				     V4L2_CID_TEST_PATTERN,
-				     ARRAY_SIZE(imx678_tpg_menu) - 1, 0, 0,
-				     imx678_tpg_menu);
+				     ARRAY_SIZE(starvis2_tpg_menu) - 1, 0, 0,
+				     starvis2_tpg_menu);
 
-	v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx678_ctrl_ops, &props);
+	v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &starvis2_ctrl_ops, &props);
 
 	if (ctrl_hdlr->error) {
 		ret = ctrl_hdlr->error;
@@ -1231,12 +1244,12 @@ static int imx678_init_controls(struct imx678 *imx678)
 		return ret;
 	}
 
-	imx678->sd.ctrl_handler = ctrl_hdlr;
+	starvis2->sd.ctrl_handler = ctrl_hdlr;
 
 	return 0;
 }
 
-static int imx678_check_hwcfg(struct device *dev, struct imx678 *imx678)
+static int starvis2_check_hwcfg(struct device *dev, struct starvis2 *starvis2)
 {
 	struct fwnode_handle *endpoint;
 	struct v4l2_fwnode_endpoint ep_cfg = {
@@ -1257,10 +1270,10 @@ static int imx678_check_hwcfg(struct device *dev, struct imx678 *imx678)
 
 	switch (ep_cfg.bus.mipi_csi2.num_data_lanes) {
 	case 2:
-		imx678->lane_mode = IMX678_LANEMODE_2L;
+		starvis2->lane_mode = STARVIS2_LANEMODE_2L;
 		break;
 	case 4:
-		imx678->lane_mode = IMX678_LANEMODE_4L;
+		starvis2->lane_mode = STARVIS2_LANEMODE_4L;
 		break;
 	default:
 		dev_err(dev,
@@ -1271,7 +1284,7 @@ static int imx678_check_hwcfg(struct device *dev, struct imx678 *imx678)
 	ret = v4l2_link_freq_to_bitmap(dev, ep_cfg.link_frequencies,
 				       ep_cfg.nr_of_link_frequencies,
 				       link_freqs, ARRAY_SIZE(link_freqs),
-				       &imx678->link_freq_bitmap);
+				       &starvis2->link_freq_bitmap);
 
 error_out:
 	v4l2_fwnode_endpoint_free(&ep_cfg);
@@ -1280,95 +1293,95 @@ static int imx678_check_hwcfg(struct device *dev, struct imx678 *imx678)
 	return ret;
 }
 
-static int imx678_probe(struct i2c_client *client)
+static int starvis2_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
-	struct imx678 *imx678;
+	struct starvis2 *starvis2;
 	int ret, i;
 
-	imx678 = devm_kzalloc(&client->dev, sizeof(*imx678), GFP_KERNEL);
-	if (!imx678)
+	starvis2 = devm_kzalloc(&client->dev, sizeof(*starvis2), GFP_KERNEL);
+	if (!starvis2)
 		return -ENOMEM;
 
-	v4l2_i2c_subdev_init(&imx678->sd, client, &imx678_subdev_ops);
+	v4l2_i2c_subdev_init(&starvis2->sd, client, &starvis2_subdev_ops);
 
-	imx678->cci = devm_cci_regmap_init_i2c(client, 16);
-	if (IS_ERR(imx678->cci))
-		return dev_err_probe(dev, PTR_ERR(imx678->cci),
+	starvis2->cci = devm_cci_regmap_init_i2c(client, 16);
+	if (IS_ERR(starvis2->cci))
+		return dev_err_probe(dev, PTR_ERR(starvis2->cci),
 				     "failed to init CCI\n");
 
-	if (imx678_check_hwcfg(dev, imx678))
+	if (starvis2_check_hwcfg(dev, starvis2))
 		return -EINVAL;
 
-	imx678->xclk = devm_v4l2_sensor_clk_get(dev, NULL);
-	if (IS_ERR(imx678->xclk))
-		return dev_err_probe(dev, PTR_ERR(imx678->xclk),
+	starvis2->xclk = devm_v4l2_sensor_clk_get(dev, NULL);
+	if (IS_ERR(starvis2->xclk))
+		return dev_err_probe(dev, PTR_ERR(starvis2->xclk),
 				     "failed to get xclk\n");
 
-	imx678->xclk_freq = clk_get_rate(imx678->xclk);
+	starvis2->xclk_freq = clk_get_rate(starvis2->xclk);
 
-	for (i = 0; i < ARRAY_SIZE(imx678_inck_table); ++i) {
-		if (imx678_inck_table[i].xclk_hz == imx678->xclk_freq) {
-			imx678->inck_sel_val = imx678_inck_table[i].inck_sel;
+	for (i = 0; i < ARRAY_SIZE(starvis2_inck_table); ++i) {
+		if (starvis2_inck_table[i].xclk_hz == starvis2->xclk_freq) {
+			starvis2->inck_sel_val = starvis2_inck_table[i].inck_sel;
 			break;
 		}
 	}
 
-	if (i == ARRAY_SIZE(imx678_inck_table))
+	if (i == ARRAY_SIZE(starvis2_inck_table))
 		return dev_err_probe(dev, -EINVAL,
 				     "unsupported XCLK rate %u Hz\n",
-				     imx678->xclk_freq);
+				     starvis2->xclk_freq);
 
-	for (i = 0; i < ARRAY_SIZE(imx678_supply_name); i++)
-		imx678->supplies[i].supply = imx678_supply_name[i];
+	for (i = 0; i < ARRAY_SIZE(starvis2_supply_name); i++)
+		starvis2->supplies[i].supply = starvis2_supply_name[i];
 
 	ret = devm_regulator_bulk_get(&client->dev,
-				      ARRAY_SIZE(imx678_supply_name),
-				      imx678->supplies);
+				      ARRAY_SIZE(starvis2_supply_name),
+				      starvis2->supplies);
 	if (ret)
 		return dev_err_probe(dev, ret, "failed to get regulators\n");
 
-	imx678->reset_gpio = devm_gpiod_get_optional(dev, "reset",
-						     GPIOD_OUT_HIGH);
-	if (IS_ERR(imx678->reset_gpio))
-		return dev_err_probe(dev, PTR_ERR(imx678->reset_gpio),
+	starvis2->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+						       GPIOD_OUT_HIGH);
+	if (IS_ERR(starvis2->reset_gpio))
+		return dev_err_probe(dev, PTR_ERR(starvis2->reset_gpio),
 				     "failed to get reset GPIO\n");
 
-	ret = imx678_power_on(dev);
+	ret = starvis2_power_on(dev);
 	if (ret)
 		return ret;
 
-	ret = imx678_identify_model(imx678);
+	ret = starvis2_identify_model(starvis2);
 	if (ret)
 		goto error_power_off;
 
 	pm_runtime_set_active(dev);
 	pm_runtime_enable(dev);
 
-	ret = imx678_init_controls(imx678);
+	ret = starvis2_init_controls(starvis2);
 	if (ret)
 		goto error_pm_runtime;
 
-	imx678->sd.internal_ops = &imx678_internal_ops;
-	imx678->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-	imx678->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
+	starvis2->sd.internal_ops = &starvis2_internal_ops;
+	starvis2->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	starvis2->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 
-	imx678->pad.flags = MEDIA_PAD_FL_SOURCE;
+	starvis2->pad.flags = MEDIA_PAD_FL_SOURCE;
 
-	ret = media_entity_pads_init(&imx678->sd.entity, 1, &imx678->pad);
+	ret = media_entity_pads_init(&starvis2->sd.entity, 1, &starvis2->pad);
 	if (ret) {
 		dev_err_probe(dev, ret, "failed to init entity pads\n");
 		goto error_handler_free;
 	}
 
-	imx678->sd.state_lock = imx678->ctrl_handler.lock;
-	ret = v4l2_subdev_init_finalize(&imx678->sd);
+	starvis2->sd.state_lock = starvis2->ctrl_handler.lock;
+	ret = v4l2_subdev_init_finalize(&starvis2->sd);
 	if (ret < 0) {
 		dev_err_probe(dev, ret, "subdev init error\n");
 		goto error_media_entity;
 	}
 
-	ret = v4l2_async_register_subdev_sensor(&imx678->sd);
+	ret = v4l2_async_register_subdev_sensor(&starvis2->sd);
 	if (ret < 0) {
 		dev_err_probe(dev, ret,
 			      "failed to register sensor sub-device\n");
@@ -1380,45 +1393,45 @@ static int imx678_probe(struct i2c_client *client)
 	return 0;
 
 error_subdev_cleanup:
-	v4l2_subdev_cleanup(&imx678->sd);
+	v4l2_subdev_cleanup(&starvis2->sd);
 
 error_media_entity:
-	media_entity_cleanup(&imx678->sd.entity);
+	media_entity_cleanup(&starvis2->sd.entity);
 
 error_handler_free:
-	v4l2_ctrl_handler_free(imx678->sd.ctrl_handler);
+	v4l2_ctrl_handler_free(starvis2->sd.ctrl_handler);
 
 error_pm_runtime:
 	pm_runtime_disable(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
 
 error_power_off:
-	imx678_power_off(&client->dev);
+	starvis2_power_off(&client->dev);
 
 	return ret;
 }
 
-static void imx678_remove(struct i2c_client *client)
+static void starvis2_remove(struct i2c_client *client)
 {
 	struct v4l2_subdev *sd = i2c_get_clientdata(client);
-	struct imx678 *imx678 = to_imx678(sd);
+	struct starvis2 *starvis2 = to_starvis2(sd);
 
 	v4l2_async_unregister_subdev(sd);
 	v4l2_subdev_cleanup(sd);
 	media_entity_cleanup(&sd->entity);
-	v4l2_ctrl_handler_free(imx678->sd.ctrl_handler);
+	v4l2_ctrl_handler_free(starvis2->sd.ctrl_handler);
 
 	pm_runtime_disable(&client->dev);
 	if (!pm_runtime_status_suspended(&client->dev))
-		imx678_power_off(&client->dev);
+		starvis2_power_off(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
 }
 
-static const struct dev_pm_ops imx678_pm_ops = {
-	SET_RUNTIME_PM_OPS(imx678_power_off, imx678_power_on, NULL)
+static const struct dev_pm_ops starvis2_pm_ops = {
+	SET_RUNTIME_PM_OPS(starvis2_power_off, starvis2_power_on, NULL)
 };
 
-static const struct of_device_id imx678_of_match[] = {
+static const struct of_device_id starvis2_of_match[] = {
 	{ .compatible = "sony,imx678-aamr", .data = &imx678_aamr_info },
 	{ .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info },
 	/* for non-conforming DTs that rely on runtime check */
@@ -1426,22 +1439,22 @@ static const struct of_device_id imx678_of_match[] = {
 	{ /* sentinel */ }
 };
 
-MODULE_DEVICE_TABLE(of, imx678_of_match);
+MODULE_DEVICE_TABLE(of, starvis2_of_match);
 
-static struct i2c_driver imx678_i2c_driver = {
+static struct i2c_driver starvis2_i2c_driver = {
 	.driver = {
-		.name = "imx678",
-		.of_match_table = imx678_of_match,
-		.pm = pm_ptr(&imx678_pm_ops),
+		.name = "starvis2",
+		.of_match_table = starvis2_of_match,
+		.pm = pm_ptr(&starvis2_pm_ops),
 	},
-	.probe = imx678_probe,
-	.remove = imx678_remove,
+	.probe = starvis2_probe,
+	.remove = starvis2_remove,
 };
 
-module_i2c_driver(imx678_i2c_driver);
+module_i2c_driver(starvis2_i2c_driver);
 
 MODULE_AUTHOR("Will Whang <will@willwhang.com>");
 MODULE_AUTHOR("Tetsuya NOMURA <tetsuya.nomura@soho-enterprise.com>");
 MODULE_AUTHOR("Jai Luthra <jai.luthra@ideasonboard.com>");
-MODULE_DESCRIPTION("Sony imx678 sensor driver");
+MODULE_DESCRIPTION("Sony Starvis 2 sensor driver");
 MODULE_LICENSE("GPL");

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 02/13] media: sony-starvis2: Reorder link frequencies to remove lookup
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 01/13] media: imx678: Rework into generic Starvis 2 sensor driver Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 03/13] media: sony-starvis2: Always program the sensor in window mode Dave Stevenson
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

link_freqs_reg_value is table that just reverses the order of the
link frequency enum.

Reverse the order of the link frequencies so that the table is
redundant, and remove it.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 84e77aba92fd..c7fbc5c132f4 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -186,25 +186,14 @@ enum starvis2_lanemode {
 
 /* Link frequency setup (DDR: lane rate = 2 x link freq) */
 enum {
-	STARVIS2_LINK_FREQ_297MHZ,
-	STARVIS2_LINK_FREQ_360MHZ,
-	STARVIS2_LINK_FREQ_445MHZ,
-	STARVIS2_LINK_FREQ_594MHZ,
-	STARVIS2_LINK_FREQ_720MHZ,
-	STARVIS2_LINK_FREQ_891MHZ,
-	STARVIS2_LINK_FREQ_1039MHZ,
-	STARVIS2_LINK_FREQ_1188MHZ,
-};
-
-static const u8 link_freqs_reg_value[] = {
-	[STARVIS2_LINK_FREQ_297MHZ]  = 0x07,
-	[STARVIS2_LINK_FREQ_360MHZ]  = 0x06,
-	[STARVIS2_LINK_FREQ_445MHZ]  = 0x05,
-	[STARVIS2_LINK_FREQ_594MHZ]  = 0x04,
-	[STARVIS2_LINK_FREQ_720MHZ]  = 0x03,
-	[STARVIS2_LINK_FREQ_891MHZ]  = 0x02,
-	[STARVIS2_LINK_FREQ_1039MHZ] = 0x01,
-	[STARVIS2_LINK_FREQ_1188MHZ] = 0x00,
+	STARVIS2_LINK_FREQ_1188MHZ = 0x00,
+	STARVIS2_LINK_FREQ_1039MHZ = 0x01,
+	STARVIS2_LINK_FREQ_891MHZ = 0x02,
+	STARVIS2_LINK_FREQ_720MHZ = 0x03,
+	STARVIS2_LINK_FREQ_594MHZ = 0x04,
+	STARVIS2_LINK_FREQ_445MHZ = 0x05,
+	STARVIS2_LINK_FREQ_360MHZ = 0x06,
+	STARVIS2_LINK_FREQ_297MHZ = 0x07,
 };
 
 static const u64 link_freqs[] = {
@@ -912,7 +901,7 @@ static int starvis2_write_common(struct starvis2 *starvis2)
 	cci_write(starvis2->cci, STARVIS2_REG_INCK_SEL, starvis2->inck_sel_val,
 		  &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_DATARATE_SEL,
-		  link_freqs_reg_value[__ffs(starvis2->link_freq_bitmap)],
+		  __fls(starvis2->link_freq_bitmap),
 		  &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_LANEMODE, starvis2->lane_mode,
 		  &ret);
@@ -1161,7 +1150,7 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
 {
 	struct v4l2_ctrl_handler *ctrl_hdlr;
 	const u32 hmax_4lane =
-			min_hmax_4lane[__ffs(starvis2->link_freq_bitmap)];
+			min_hmax_4lane[__fls(starvis2->link_freq_bitmap)];
 	const u32 lane_scale =
 			starvis2->lane_mode == STARVIS2_LANEMODE_2L ? 2 : 1;
 	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 03/13] media: sony-starvis2: Always program the sensor in window mode
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 01/13] media: imx678: Rework into generic Starvis 2 sensor driver Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 02/13] media: sony-starvis2: Reorder link frequencies to remove lookup Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 04/13] media: sony-starvis2: Parameterise the configuration to allow for other models Dave Stevenson
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

If the requested region matched the defined active area then
the driver switched to all-pixel mode. This left the possibility
that the active area was incorrect and not reading out the area
expected.

Switch to always requesting window mode to avoid this potential
mismatch.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index c7fbc5c132f4..20f3489b58d3 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -918,9 +918,7 @@ static int starvis2_program_window(struct starvis2 *starvis2,
 	int ret = 0;
 
 	cci_write(starvis2->cci, STARVIS2_REG_ADDMODE, 0x00, &ret);
-	cci_write(starvis2->cci, STARVIS2_REG_WINMODE,
-		  v4l2_rect_equal(crop, &imx678_active_area) ? 0x00 : 0x04,
-		  &ret);
+	cci_write(starvis2->cci, STARVIS2_REG_WINMODE, 0x04, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_PIX_HST,
 		  crop->left - imx678_active_area.left, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_PIX_HWIDTH, crop->width, &ret);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 04/13] media: sony-starvis2: Parameterise the configuration to allow for other models
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (2 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 03/13] media: sony-starvis2: Always program the sensor in window mode Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:35   ` sashiko-bot
  2026-10-13 15:17 ` [PATCH v2 05/13] media: sony-starvis2: Rework 2 lane support for higher link freqs Dave Stevenson
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

Several of the Sony Starvis 2 sensors are identical in the
majority of their programming, but differ largely only in the
size of pixel array and some timing parameters.

Parameterise those parameters in preparation for supporting other
variants.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 20f3489b58d3..f62a957ff1a8 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -51,17 +51,9 @@
 /* Lane Count */
 #define STARVIS2_REG_LANEMODE             CCI_REG8(0x3040)
 
-/*
- * The internal readout clock runs at 74.25 MHz. In one cycle the AD reads 8
- * pixels, thus giving us a rate of 74.25 * 8 = 594 MPix/s
- */
-#define IMX678_PIXEL_RATE		594000000
-#define IMX678_PIX_PER_CLK		8
-
 /* VMAX - Frame Length in Lines */
 #define STARVIS2_REG_VMAX                 CCI_REG24_LE(0x3028)
 #define STARVIS2_VMAX_MAX                 0xfffff
-#define IMX678_VMAX_DEFAULT             2250
 
 /* HMAX - Line Length in Cycles (8 Pixels) */
 #define STARVIS2_REG_HMAX                 CCI_REG16_LE(0x302c)
@@ -102,8 +94,6 @@
 /* Sensor Identification */
 #define STARVIS2_REG_MONOCHROME		CCI_REG8(0x4d18)
 #define STARVIS2_TYPE			BIT(0)
-#define IMX678_REG_MODULE_ID		CCI_REG16_LE(0x4d1c)
-#define IMX678_ID			0x02a6
 #define STARVIS2_MODULE_ID_DELAY	80000
 
 /* Common configuration registers */
@@ -153,32 +143,11 @@
 /* Subdev pads */
 #define STARVIS2_SOURCE_PAD		0
 
-/* IMX678 native and active pixel array size. */
-static const struct v4l2_rect imx678_native_area = {
-	.top = 0,
-	.left = 0,
-	.width = 3857,
-	.height = 2201,
-};
-
-static const struct v4l2_rect imx678_active_area = {
-	.top = 20,
-	.left = 0,
-	.width = 3856,
-	.height = 2180,
-};
-
 enum starvis2_type {
 	STARVIS2_COLOR = 0,
 	STARVIS2_MONOCHROME = 1,
 };
 
-struct starvis2_model_info {
-	enum starvis2_type type;
-	const u32 *codes;
-	unsigned int num_codes;
-};
-
 enum starvis2_lanemode {
 	STARVIS2_LANEMODE_2L = 1,
 	STARVIS2_LANEMODE_4L = 3,
@@ -207,7 +176,7 @@ static const u64 link_freqs[] = {
 	[STARVIS2_LINK_FREQ_1188MHZ] = 1188000000,
 };
 
-static const u16 min_hmax_4lane[] = {
+static const u16 imx678_min_hmax_4lane[] = {
 	[STARVIS2_LINK_FREQ_297MHZ] = 1584,
 	[STARVIS2_LINK_FREQ_360MHZ] = 1320,
 	[STARVIS2_LINK_FREQ_445MHZ] = 1100,
@@ -267,7 +236,7 @@ static const int starvis2_tpg_val[] = {
 };
 
 /* Common configuration */
-static const struct cci_reg_sequence common_regs[] = {
+static const struct cci_reg_sequence imx678_common_regs[] = {
 	{ STARVIS2_REG_THIN_V_EN, 0x00 },
 	{ STARVIS2_REG_VCMODE, 0x01 },
 	{ CCI_REG8(0x306b), 0x00 },
@@ -650,16 +619,74 @@ static const u32 codes_monochrome[] = {
 	MEDIA_BUS_FMT_Y12_1X12,
 };
 
+struct starvis2_variant {
+	const char *name;
+	u32 id_reg;
+	u32 id_mask;
+	u32 id_value;
+	struct v4l2_rect native_area;
+	struct v4l2_rect active_area;
+	u64 pixel_rate;
+	unsigned int pix_per_clk;
+	const struct cci_reg_sequence *common_regs;
+	unsigned int num_common_regs;
+	unsigned int vmax_default;
+	const u16 *hmax_min;
+};
+
+const struct starvis2_variant imx678_variant_def = {
+	.name = "imx678",
+	.id_reg = CCI_REG16_LE(0x4d1c),
+	.id_mask = 0x3ff,
+	.id_value = 0x2a6,
+	.native_area = {
+		.top = 0,
+		.left = 0,
+		.width = 3857,
+		.height = 2201,
+	},
+	.active_area = {
+		.top = 20,
+		.left = 0,
+		.width = 3856,
+		.height = 2180,
+	},
+	.pixel_rate = 594000000,
+	.pix_per_clk = 8,
+	.common_regs = imx678_common_regs,
+	.num_common_regs = ARRAY_SIZE(imx678_common_regs),
+	.vmax_default = 2250,
+	.hmax_min = imx678_min_hmax_4lane,
+};
+
+struct starvis2_model_info {
+	enum starvis2_type type;
+	const u32 *codes;
+	unsigned int num_codes;
+	const struct starvis2_variant *variant;
+
+	const struct starvis2_model_info *auto_detect_colour;
+	const struct starvis2_model_info *auto_detect_mono;
+};
+
 static const struct starvis2_model_info imx678_aaqr_info = {
 	.type = STARVIS2_COLOR,
 	.codes = codes_bayer,
 	.num_codes = ARRAY_SIZE(codes_bayer),
+	.variant = &imx678_variant_def,
 };
 
 static const struct starvis2_model_info imx678_aamr_info = {
 	.type = STARVIS2_MONOCHROME,
 	.codes = codes_monochrome,
 	.num_codes = ARRAY_SIZE(codes_monochrome),
+	.variant = &imx678_variant_def,
+};
+
+static const struct starvis2_model_info imx678_autodetect_info = {
+	.variant = &imx678_variant_def,
+	.auto_detect_colour = &imx678_aaqr_info,
+	.auto_detect_mono = &imx678_aamr_info,
 };
 
 static const char * const starvis2_supply_name[] = {
@@ -674,6 +701,7 @@ struct starvis2 {
 	struct regmap *cci;
 
 	const struct starvis2_model_info *info;
+	const struct starvis2_variant *variant;
 
 	struct clk *xclk;
 	u32 xclk_freq;
@@ -769,7 +797,8 @@ static int starvis2_set_ctrl(struct v4l2_ctrl *ctrl)
 		cci_write(starvis2->cci, STARVIS2_REG_GAIN, ctrl->val, &ret);
 		break;
 	case V4L2_CID_HBLANK: {
-		u32 hmax = (format->width + ctrl->val) / IMX678_PIX_PER_CLK;
+		u32 hmax = (format->width + ctrl->val) /
+						starvis2->variant->pix_per_clk;
 
 		cci_write(starvis2->cci, STARVIS2_REG_HMAX, hmax, &ret);
 		break;
@@ -850,18 +879,20 @@ static int starvis2_get_selection(struct v4l2_subdev *sd,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_selection *sel)
 {
+	struct starvis2 *starvis2 = to_starvis2(sd);
+
 	switch (sel->target) {
 	case V4L2_SEL_TGT_CROP:
 		sel->r = *v4l2_subdev_state_get_crop(sd_state, sel->pad);
 		return 0;
 
 	case V4L2_SEL_TGT_NATIVE_SIZE:
-		sel->r = imx678_native_area;
+		sel->r = starvis2->variant->native_area;
 		return 0;
 
 	case V4L2_SEL_TGT_CROP_DEFAULT:
 	case V4L2_SEL_TGT_CROP_BOUNDS:
-		sel->r = imx678_active_area;
+		sel->r = starvis2->variant->active_area;
 		return 0;
 	}
 
@@ -876,12 +907,12 @@ static int starvis2_init_state(struct v4l2_subdev *sd,
 	struct v4l2_rect *crop;
 
 	crop = v4l2_subdev_state_get_crop(state, STARVIS2_SOURCE_PAD);
-	*crop = imx678_active_area;
+	*crop = starvis2->variant->active_area;
 
 	format = v4l2_subdev_state_get_format(state, STARVIS2_SOURCE_PAD);
 	format->code = starvis2_default_mbus_code(starvis2);
-	format->width = imx678_active_area.width;
-	format->height = imx678_active_area.height;
+	format->width = starvis2->variant->active_area.width;
+	format->height = starvis2->variant->active_area.height;
 	format->field = V4L2_FIELD_NONE;
 	format->colorspace = V4L2_COLORSPACE_RAW;
 	format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
@@ -895,8 +926,12 @@ static int starvis2_write_common(struct starvis2 *starvis2)
 {
 	int ret = 0;
 
-	cci_multi_reg_write(starvis2->cci, common_regs, ARRAY_SIZE(common_regs),
-			    &ret);
+	if (!starvis2->variant)
+		/* Powered on during probe to do detection. Variant unknown. */
+		return 0;
+
+	cci_multi_reg_write(starvis2->cci, starvis2->variant->common_regs,
+			    starvis2->variant->num_common_regs, &ret);
 
 	cci_write(starvis2->cci, STARVIS2_REG_INCK_SEL, starvis2->inck_sel_val,
 		  &ret);
@@ -920,10 +955,10 @@ static int starvis2_program_window(struct starvis2 *starvis2,
 	cci_write(starvis2->cci, STARVIS2_REG_ADDMODE, 0x00, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_WINMODE, 0x04, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_PIX_HST,
-		  crop->left - imx678_active_area.left, &ret);
+		  crop->left - starvis2->variant->active_area.left, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_PIX_HWIDTH, crop->width, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_PIX_VST,
-		  crop->top - imx678_active_area.top, &ret);
+		  crop->top - starvis2->variant->active_area.top, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_PIX_VWIDTH, crop->height, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_ADBIT, 0x01, &ret);
 
@@ -1066,11 +1101,16 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
 	const struct starvis2_model_info *info;
+	const struct starvis2_variant *variant;
 	enum starvis2_type detected;
 	int ret = 0;
 	u64 val = 0;
 
 	info = device_get_match_data(&client->dev);
+	if (!info)
+		return -EINVAL;
+
+	variant = info->variant;
 
 	/*
 	 * This sensor's ID registers become accessible 80ms after coming out
@@ -1079,7 +1119,7 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 	cci_write(starvis2->cci, STARVIS2_REG_MODE_SELECT, 0, &ret);
 	fsleep(STARVIS2_MODULE_ID_DELAY);
 
-	cci_read(starvis2->cci, IMX678_REG_MODULE_ID, &val, &ret);
+	cci_read(starvis2->cci, variant->id_reg, &val, &ret);
 
 	if (ret) {
 		dev_err(&client->dev,
@@ -1087,9 +1127,10 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 		return ret;
 	}
 
-	if (val != IMX678_ID) {
-		dev_err(&client->dev,
-			"Chip ID mismatch: %x!=%llx\n", IMX678_ID, val);
+	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;
 	}
 
@@ -1104,7 +1145,7 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 	detected = val & STARVIS2_TYPE;
 
 	/* Prefer to use sensor type specified in device tree */
-	if (info) {
+	if (info->codes) {
 		starvis2->info = info;
 		if (detected != info->type)
 			dev_err(&client->dev,
@@ -1113,11 +1154,12 @@ static int starvis2_identify_model(struct starvis2 *starvis2)
 				info->type == STARVIS2_COLOR ? "color" : "mono");
 	} else {
 		starvis2->info = detected == STARVIS2_MONOCHROME ?
-			       &imx678_aamr_info : &imx678_aaqr_info;
+			    info->auto_detect_mono : info->auto_detect_colour;
 		dev_info(&client->dev,
 			 "sensor type missing in DT; detected %s sensor\n",
 			 detected == STARVIS2_MONOCHROME ? "mono" : "color");
 	}
+	starvis2->variant = starvis2->info->variant;
 
 	return 0;
 }
@@ -1148,7 +1190,7 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
 {
 	struct v4l2_ctrl_handler *ctrl_hdlr;
 	const u32 hmax_4lane =
-			min_hmax_4lane[__fls(starvis2->link_freq_bitmap)];
+		starvis2->variant->hmax_min[__fls(starvis2->link_freq_bitmap)];
 	const u32 lane_scale =
 			starvis2->lane_mode == STARVIS2_LANEMODE_2L ? 2 : 1;
 	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
@@ -1167,13 +1209,14 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
 	if (ret)
 		return ret;
 
-	starvis2->vmax = IMX678_VMAX_DEFAULT;
+	starvis2->vmax = starvis2->variant->vmax_default;
 	hmax = hmax_4lane * lane_scale;
 
 	/* PIXEL_RATE is fixed and read-only */
 	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,
-			  IMX678_PIXEL_RATE, IMX678_PIXEL_RATE, 1,
-			  IMX678_PIXEL_RATE);
+			  starvis2->variant->pixel_rate,
+			  starvis2->variant->pixel_rate, 1,
+			  starvis2->variant->pixel_rate);
 
 	/* LINK_FREQ is also read only */
 	link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
@@ -1185,23 +1228,25 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
 	if (link_freq)
 		link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
 
-	vblank = starvis2->vmax - imx678_active_area.height;
-	max_vblank = STARVIS2_VMAX_MAX - imx678_active_area.height;
+	vblank = starvis2->vmax - starvis2->variant->active_area.height;
+	max_vblank = STARVIS2_VMAX_MAX - starvis2->variant->active_area.height;
 	starvis2->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
 					     V4L2_CID_VBLANK, vblank, max_vblank,
 					     2, vblank);
 
-	hblank = hmax * IMX678_PIX_PER_CLK - imx678_active_area.width;
-	max_hblank = STARVIS2_HMAX_MAX * IMX678_PIX_PER_CLK -
-		     imx678_active_area.width;
+	hblank = hmax * starvis2->variant->pix_per_clk -
+					starvis2->variant->active_area.width;
+	max_hblank = STARVIS2_HMAX_MAX * starvis2->variant->pix_per_clk -
+		     starvis2->variant->active_area.width;
 	starvis2->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
 					     V4L2_CID_HBLANK, hblank, max_hblank,
-					     IMX678_PIX_PER_CLK, hblank);
+					     starvis2->variant->pix_per_clk,
+					     hblank);
 
 	starvis2->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops,
 					       V4L2_CID_EXPOSURE,
 					       STARVIS2_EXPOSURE_MIN,
-					       IMX678_VMAX_DEFAULT -
+					       starvis2->variant->vmax_default -
 					       STARVIS2_SHR_MIN,
 					       STARVIS2_EXPOSURE_STEP,
 					       STARVIS2_EXPOSURE_DEFAULT);
@@ -1342,6 +1387,9 @@ static int starvis2_probe(struct i2c_client *client)
 	if (ret)
 		goto error_power_off;
 
+	v4l2_i2c_subdev_set_name(&starvis2->sd, client, starvis2->variant->name,
+				 NULL);
+
 	pm_runtime_set_active(dev);
 	pm_runtime_enable(dev);
 
@@ -1422,7 +1470,7 @@ static const struct of_device_id starvis2_of_match[] = {
 	{ .compatible = "sony,imx678-aamr", .data = &imx678_aamr_info },
 	{ .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info },
 	/* for non-conforming DTs that rely on runtime check */
-	{ .compatible = "sony,imx678" },
+	{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
 	{ /* sentinel */ }
 };
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 05/13] media: sony-starvis2: Rework 2 lane support for higher link freqs
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (3 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 04/13] media: sony-starvis2: Parameterise the configuration to allow for other models Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 06/13] media: sony-starvis2: Allow runtime control of link frequency Dave Stevenson
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

With some Starvis 2 sensors, the link frequency on 2 lanes is sufficient
to achieve a lower line time than the 4 lane value divided by 2, as
the 4 lane value hits the minimum that the pixel array can handle.
That can't easily be handled with the way the values are currently stored.

Storing the 2 lane hmax alongside the pixel array's minimum allows the
4 lane support to divide the value by 2, and then clip to the pixel
array value as a minimum.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index f62a957ff1a8..66c77c5957e3 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -176,15 +176,15 @@ static const u64 link_freqs[] = {
 	[STARVIS2_LINK_FREQ_1188MHZ] = 1188000000,
 };
 
-static const u16 imx678_min_hmax_4lane[] = {
-	[STARVIS2_LINK_FREQ_297MHZ] = 1584,
-	[STARVIS2_LINK_FREQ_360MHZ] = 1320,
-	[STARVIS2_LINK_FREQ_445MHZ] = 1100,
-	[STARVIS2_LINK_FREQ_594MHZ] =  792,
-	[STARVIS2_LINK_FREQ_720MHZ] =  660,
-	[STARVIS2_LINK_FREQ_891MHZ] =  550,
-	[STARVIS2_LINK_FREQ_1039MHZ] = 550,
-	[STARVIS2_LINK_FREQ_1188MHZ] = 550,
+static const u16 imx678_min_hmax_2lane[] = {
+	[STARVIS2_LINK_FREQ_297MHZ]  = 3168,
+	[STARVIS2_LINK_FREQ_360MHZ]  = 2640,
+	[STARVIS2_LINK_FREQ_445MHZ]  = 2200,
+	[STARVIS2_LINK_FREQ_594MHZ]  = 1584,
+	[STARVIS2_LINK_FREQ_720MHZ]  = 1320,
+	[STARVIS2_LINK_FREQ_891MHZ]  = 1100,
+	[STARVIS2_LINK_FREQ_1039MHZ] = 1100,
+	[STARVIS2_LINK_FREQ_1188MHZ] = 1100,
 };
 
 struct starvis2_inck_cfg {
@@ -631,7 +631,8 @@ struct starvis2_variant {
 	const struct cci_reg_sequence *common_regs;
 	unsigned int num_common_regs;
 	unsigned int vmax_default;
-	const u16 *hmax_min;
+	const u16 *hmax_min_link_freq;
+	u16 hmax_min_pixel_array;
 };
 
 const struct starvis2_variant imx678_variant_def = {
@@ -656,7 +657,8 @@ const struct starvis2_variant imx678_variant_def = {
 	.common_regs = imx678_common_regs,
 	.num_common_regs = ARRAY_SIZE(imx678_common_regs),
 	.vmax_default = 2250,
-	.hmax_min = imx678_min_hmax_4lane,
+	.hmax_min_link_freq = imx678_min_hmax_2lane,
+	.hmax_min_pixel_array = 550,
 };
 
 struct starvis2_model_info {
@@ -1189,11 +1191,8 @@ static const struct v4l2_subdev_internal_ops starvis2_internal_ops = {
 static int starvis2_init_controls(struct starvis2 *starvis2)
 {
 	struct v4l2_ctrl_handler *ctrl_hdlr;
-	const u32 hmax_4lane =
-		starvis2->variant->hmax_min[__fls(starvis2->link_freq_bitmap)];
-	const u32 lane_scale =
-			starvis2->lane_mode == STARVIS2_LANEMODE_2L ? 2 : 1;
 	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
+	const struct starvis2_variant *variant = starvis2->variant;
 	struct v4l2_fwnode_device_properties props;
 	struct v4l2_ctrl *link_freq;
 	s32 hblank, max_hblank, vblank, max_vblank;
@@ -1210,7 +1209,10 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
 		return ret;
 
 	starvis2->vmax = starvis2->variant->vmax_default;
-	hmax = hmax_4lane * lane_scale;
+
+	hmax = variant->hmax_min_link_freq[__fls(starvis2->link_freq_bitmap)];
+	if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
+		hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
 
 	/* PIXEL_RATE is fixed and read-only */
 	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 06/13] media: sony-starvis2: Allow runtime control of link frequency
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (4 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 05/13] media: sony-starvis2: Rework 2 lane support for higher link freqs Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:33   ` sashiko-bot
  2026-10-13 15:17 ` [PATCH v2 07/13] media: sony-starvis2: Correct the minimum exposure Dave Stevenson
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

DT allows configuration of multiple link frequencies.
V4L2_CID_LINK_FREQ allows read write control.

Join these up so that link frequency can be configured at run time,
as long as the sensor isn't streaming.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 66c77c5957e3..2bb438d22ada 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -724,6 +724,7 @@ struct starvis2 {
 	struct v4l2_ctrl *exposure;
 	struct v4l2_ctrl *vblank;
 	struct v4l2_ctrl *hblank;
+	struct v4l2_ctrl *link_freq;
 
 	/* Track VMAX for exposure updates */
 	u32 vmax;
@@ -754,6 +755,7 @@ static int starvis2_set_ctrl(struct v4l2_ctrl *ctrl)
 	struct starvis2 *starvis2 = container_of_const(ctrl->handler, struct
 						       starvis2, ctrl_handler);
 	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
+	const struct starvis2_variant *variant = starvis2->variant;
 	const struct v4l2_mbus_framefmt *format;
 	struct v4l2_subdev_state *state;
 	int ret = 0;
@@ -777,6 +779,25 @@ static int starvis2_set_ctrl(struct v4l2_ctrl *ctrl)
 			return ret;
 	}
 
+	if (ctrl->id == V4L2_CID_LINK_FREQ) {
+		u32 hmax = variant->hmax_min_link_freq[ctrl->val];
+		s32 hblank;
+
+		if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
+			hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
+
+		hblank = hmax * variant->pix_per_clk -
+					variant->active_area.width;
+
+		ret = __v4l2_ctrl_modify_range(starvis2->hblank,
+					       hblank,
+					       starvis2->hblank->maximum,
+					       starvis2->hblank->step,
+					       hblank);
+		if (ret)
+			return ret;
+	}
+
 	/*
 	 * Only apply control values when device is powered on (RPM ACTIVE)
 	 * and streaming (usage count != 0)
@@ -823,6 +844,12 @@ static int starvis2_set_ctrl(struct v4l2_ctrl *ctrl)
 		cci_write(starvis2->cci, STARVIS2_REG_WINMODEV, ctrl->val,
 			  &ret);
 		break;
+	case V4L2_CID_LINK_FREQ:
+		/* The STARVIS2_LINK_FREQ_ enums match up with the register */
+		cci_write(starvis2->cci, STARVIS2_REG_DATARATE_SEL, ctrl->val,
+			  &ret);
+		break;
+
 	default:
 		dev_warn(&client->dev,
 			 "ctrl(id:0x%x,val:0x%x) is not handled\n",
@@ -937,9 +964,6 @@ static int starvis2_write_common(struct starvis2 *starvis2)
 
 	cci_write(starvis2->cci, STARVIS2_REG_INCK_SEL, starvis2->inck_sel_val,
 		  &ret);
-	cci_write(starvis2->cci, STARVIS2_REG_DATARATE_SEL,
-		  __fls(starvis2->link_freq_bitmap),
-		  &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_LANEMODE, starvis2->lane_mode,
 		  &ret);
 
@@ -1006,6 +1030,7 @@ static int starvis2_enable_streams(struct v4l2_subdev *sd,
 		goto err_rpm_put;
 	}
 
+	__v4l2_ctrl_grab(starvis2->link_freq, true);
 	return 0;
 
 err_rpm_put:
@@ -1030,6 +1055,8 @@ static int starvis2_disable_streams(struct v4l2_subdev *sd,
 	if (ret)
 		dev_err(&client->dev, "%s failed to stop stream\n", __func__);
 
+	__v4l2_ctrl_grab(starvis2->link_freq, false);
+
 	pm_runtime_put(&client->dev);
 
 	return ret;
@@ -1194,7 +1221,6 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
 	struct i2c_client *client = v4l2_get_subdevdata(&starvis2->sd);
 	const struct starvis2_variant *variant = starvis2->variant;
 	struct v4l2_fwnode_device_properties props;
-	struct v4l2_ctrl *link_freq;
 	s32 hblank, max_hblank, vblank, max_vblank;
 	u32 hmax;
 	int ret;
@@ -1210,25 +1236,23 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
 
 	starvis2->vmax = starvis2->variant->vmax_default;
 
-	hmax = variant->hmax_min_link_freq[__fls(starvis2->link_freq_bitmap)];
-	if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
-		hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
-
 	/* PIXEL_RATE is fixed and read-only */
 	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,
 			  starvis2->variant->pixel_rate,
 			  starvis2->variant->pixel_rate, 1,
 			  starvis2->variant->pixel_rate);
 
-	/* LINK_FREQ is also read only */
-	link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
-					   V4L2_CID_LINK_FREQ,
-					   ARRAY_SIZE(link_freqs) - 1,
-					   __ffs(starvis2->link_freq_bitmap),
-					   link_freqs);
-
-	if (link_freq)
-		link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
+	starvis2->link_freq =
+		v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
+				       V4L2_CID_LINK_FREQ,
+				       __fls(starvis2->link_freq_bitmap),
+				       __ffs(starvis2->link_freq_bitmap),
+				       link_freqs);
+	__v4l2_ctrl_modify_range(starvis2->link_freq,
+				 __ffs(starvis2->link_freq_bitmap),
+				 __fls(starvis2->link_freq_bitmap),
+				 ~(starvis2->link_freq_bitmap),
+				 __ffs(starvis2->link_freq_bitmap));
 
 	vblank = starvis2->vmax - starvis2->variant->active_area.height;
 	max_vblank = STARVIS2_VMAX_MAX - starvis2->variant->active_area.height;
@@ -1236,6 +1260,10 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
 					     V4L2_CID_VBLANK, vblank, max_vblank,
 					     2, vblank);
 
+	hmax = variant->hmax_min_link_freq[starvis2->link_freq->val];
+	if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
+		hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
+
 	hblank = hmax * starvis2->variant->pix_per_clk -
 					starvis2->variant->active_area.width;
 	max_hblank = STARVIS2_HMAX_MAX * starvis2->variant->pix_per_clk -

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 07/13] media: sony-starvis2: Correct the minimum exposure
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (5 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 06/13] media: sony-starvis2: Allow runtime control of link frequency Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 08/13] media: dt-bindings: sony,imx678: Add other Starvis 2 family members Dave Stevenson
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

The software reference for imx678 lists register SHR0 setting
the shutter sweep time with a valid range of 4 to (Number of
lines per frame - 1), and then gives the example of all-pixel
scan mode with VMAX=2250 and SHR0=2249 giving an integration
time of "1H + Toffset" (further defining Toffset as 0).

The driver defining STARVIS2_EXPOSURE_MIN as 2 would therefore
be contradictory, and doubles the minimum exposure achievable.

Correct STARVIS2_EXPOSURE_MIN.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/media/i2c/sony-starvis2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 2bb438d22ada..27287924915c 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -64,7 +64,7 @@
 #define STARVIS2_SHR_MIN                  8
 
 /* Exposure control */
-#define STARVIS2_EXPOSURE_MIN             2
+#define STARVIS2_EXPOSURE_MIN             1
 #define STARVIS2_EXPOSURE_STEP            1
 #define STARVIS2_EXPOSURE_DEFAULT         1000
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 08/13] media: dt-bindings: sony,imx678: Add other Starvis 2 family members
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (6 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 07/13] media: sony-starvis2: Correct the minimum exposure Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 09/13] media: sony-starvis2: Add support for IMX662 Dave Stevenson
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

There are multiple members of the Sony Starvis 2 image sensor family
that have the same hardware requirements as imx678.
Add them as options to the imx678 binding, rather than duplicating it.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 .../devicetree/bindings/media/i2c/sony,imx678.yaml | 38 ++++++++++++++++++----
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/sony,imx678.yaml b/Documentation/devicetree/bindings/media/i2c/sony,imx678.yaml
index 098f72544216..7c4a7a980084 100644
--- a/Documentation/devicetree/bindings/media/i2c/sony,imx678.yaml
+++ b/Documentation/devicetree/bindings/media/i2c/sony,imx678.yaml
@@ -5,7 +5,7 @@
 $id: http://devicetree.org/schemas/media/i2c/sony,imx678.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Sony IMX678 Sensor
+title: Sony IMX678 and Starvis 2 Sensors
 
 maintainers:
   - Jai Luthra <jai.luthra@ideasonboard.com>
@@ -13,21 +13,47 @@ maintainers:
 description:
   Sony IMX678 diagonal 8.86 mm (Type 1/1.8) CMOS active pixel type solid-state
   image sensor with a square pixel array and 8.40M (3856x2180) effective pixels.
+  It is part of the Starvis 2 family of sensors.
+  Other members of the Starvis 2 have the same hardware requirements, and
+  therefore share this binding.
 
 allOf:
   - $ref: /schemas/media/video-interface-devices.yaml#
 
 properties:
   compatible:
-    items:
-      - enum:
-          - sony,imx678-aamr
-          - sony,imx678-aaqr
-      - const: sony,imx678
+    oneOf:
+      - items:
+          - enum:
+              - sony,imx678-aamr
+              - sony,imx678-aaqr
+          - const: sony,imx678
+      - items:
+          - enum:
+              - sony,imx585-aamj
+              - sony,imx585-aaqj
+          - const: sony,imx585
+      - items:
+          - enum:
+              - sony,imx675-aamr
+              - sony,imx675-aaqr
+          - const: sony,imx675
+      - items:
+          - enum:
+              - sony,imx662-aamr
+              - sony,imx662-aaqr
+          - const: sony,imx662
+      - items:
+          - enum:
+              - sony,imx832-amr
+              - sony,imx832-aqr
+          - const: sony,imx832
+
     description:
       The IMX678 sensor exists in a colour variant (IMX678-AAQR) and a mono
       variant (IMX678-AAMR). The variant-specific compatible describes the
       exact sensor variant, with the generic IMX678 compatible as a fallback.
+      The same applies for the other sensors in the family.
 
   reg:
     maxItems: 1

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 09/13] media: sony-starvis2: Add support for IMX662
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (7 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 08/13] media: dt-bindings: sony,imx678: Add other Starvis 2 family members Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 10/13] media: sony-starvis2: Add support for IMX675 Dave Stevenson
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

IMX662 is a 1080p Starvis 2 sensor that follows the same programming
pattern as IMX678, so add it to the newly parameterised common
driver.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 27287924915c..c2d4b0aab8c8 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -8,7 +8,9 @@
  * Currently supported are:
  * IMX678: Diagonal 8.86 mm (Type 1/1.8) CMOS image sensor with 8.40 M effective
  *         pixels.
- *
+ * IMX662: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective
+ *         pixels.
+
  * Copyright (C) 2026 Ideas On Board Oy.
  *
  * Based on Sony IMX678 driver prepared by Will Whang & Soho Enterprise Ltd.
@@ -661,6 +663,136 @@ const struct starvis2_variant imx678_variant_def = {
 	.hmax_min_pixel_array = 550,
 };
 
+static const struct cci_reg_sequence imx662_common_regs[] = {
+	{ CCI_REG8(0x3444), 0xac },
+	{ CCI_REG8(0x3492), 0x08 },
+	{ CCI_REG8(0x3b00), 0x39 },
+	{ CCI_REG8(0x3b23), 0x2d },
+	{ CCI_REG8(0x3b45), 0x04 },
+	{ CCI_REG8(0x3c0a), 0x1f },
+	{ CCI_REG8(0x3c0b), 0x1e },
+	{ CCI_REG8(0x3c38), 0x21 },
+	{ CCI_REG8(0x3c44), 0x00 },
+	{ CCI_REG8(0x3cb6), 0xd8 },
+	{ CCI_REG8(0x3cc4), 0xda },
+	{ CCI_REG8(0x3e24), 0x79 },
+	{ CCI_REG8(0x3e2c), 0x15 },
+	{ CCI_REG8(0x3edc), 0x2d },
+	{ CCI_REG8(0x4498), 0x05 },
+	{ CCI_REG8(0x449c), 0x19 },
+	{ CCI_REG8(0x449d), 0x00 },
+	{ CCI_REG8(0x449e), 0x32 },
+	{ CCI_REG8(0x449f), 0x01 },
+	{ CCI_REG8(0x44a0), 0x92 },
+	{ CCI_REG8(0x44a2), 0x91 },
+	{ CCI_REG8(0x44a4), 0x8c },
+	{ CCI_REG8(0x44a6), 0x87 },
+	{ CCI_REG8(0x44a8), 0x82 },
+	{ CCI_REG8(0x44aa), 0x78 },
+	{ CCI_REG8(0x44ac), 0x6e },
+	{ CCI_REG8(0x44ae), 0x69 },
+	{ CCI_REG8(0x44b0), 0x92 },
+	{ CCI_REG8(0x44b2), 0x91 },
+	{ CCI_REG8(0x44b4), 0x8c },
+	{ CCI_REG8(0x44b6), 0x87 },
+	{ CCI_REG8(0x44b8), 0x82 },
+	{ CCI_REG8(0x44ba), 0x78 },
+	{ CCI_REG8(0x44bc), 0x6e },
+	{ CCI_REG8(0x44be), 0x69 },
+	{ CCI_REG8(0x44c0), 0x7f },
+	{ CCI_REG8(0x44c1), 0x01 },
+	{ CCI_REG8(0x44c2), 0x7f },
+	{ CCI_REG8(0x44c3), 0x01 },
+	{ CCI_REG8(0x44c4), 0x7a },
+	{ CCI_REG8(0x44c5), 0x01 },
+	{ CCI_REG8(0x44c6), 0x7a },
+	{ CCI_REG8(0x44c7), 0x01 },
+	{ CCI_REG8(0x44c8), 0x70 },
+	{ CCI_REG8(0x44c9), 0x01 },
+	{ CCI_REG8(0x44ca), 0x6b },
+	{ CCI_REG8(0x44cb), 0x01 },
+	{ CCI_REG8(0x44cc), 0x6b },
+	{ CCI_REG8(0x44cd), 0x01 },
+	{ CCI_REG8(0x44ce), 0x5c },
+	{ CCI_REG8(0x44cf), 0x01 },
+	{ CCI_REG8(0x44d0), 0x7f },
+	{ CCI_REG8(0x44d1), 0x01 },
+	{ CCI_REG8(0x44d2), 0x7f },
+	{ CCI_REG8(0x44d3), 0x01 },
+	{ CCI_REG8(0x44d4), 0x7a },
+	{ CCI_REG8(0x44d5), 0x01 },
+	{ CCI_REG8(0x44d6), 0x7a },
+	{ CCI_REG8(0x44d7), 0x01 },
+	{ CCI_REG8(0x44d8), 0x70 },
+	{ CCI_REG8(0x44d9), 0x01 },
+	{ CCI_REG8(0x44da), 0x6b },
+	{ CCI_REG8(0x44db), 0x01 },
+	{ CCI_REG8(0x44dc), 0x6b },
+	{ CCI_REG8(0x44dd), 0x01 },
+	{ CCI_REG8(0x44de), 0x5c },
+	{ CCI_REG8(0x44df), 0x01 },
+	{ CCI_REG8(0x4534), 0x1c },
+	{ CCI_REG8(0x4535), 0x03 },
+	{ CCI_REG8(0x4538), 0x1c },
+	{ CCI_REG8(0x4539), 0x1c },
+	{ CCI_REG8(0x453a), 0x1c },
+	{ CCI_REG8(0x453b), 0x1c },
+	{ CCI_REG8(0x453c), 0x1c },
+	{ CCI_REG8(0x453d), 0x1c },
+	{ CCI_REG8(0x453e), 0x1c },
+	{ CCI_REG8(0x453f), 0x1c },
+	{ CCI_REG8(0x4540), 0x1c },
+	{ CCI_REG8(0x4541), 0x03 },
+	{ CCI_REG8(0x4542), 0x03 },
+	{ CCI_REG8(0x4543), 0x03 },
+	{ CCI_REG8(0x4544), 0x03 },
+	{ CCI_REG8(0x4545), 0x03 },
+	{ CCI_REG8(0x4546), 0x03 },
+	{ CCI_REG8(0x4547), 0x03 },
+	{ CCI_REG8(0x4548), 0x03 },
+	{ CCI_REG8(0x4549), 0x03 },
+	{ STARVIS2_REG_WDMODE, 0x00 },
+	{ STARVIS2_REG_MDBIT, 0x01 },
+	{ STARVIS2_REG_XXS_DRV, 0x00 },
+};
+
+static const u16 imx662_min_hmax_2lane[] = {
+	[STARVIS2_LINK_FREQ_297MHZ] = 1980,
+	[STARVIS2_LINK_FREQ_360MHZ] = 1980,
+	[STARVIS2_LINK_FREQ_445MHZ] = 1188,
+	[STARVIS2_LINK_FREQ_594MHZ] = 990,
+	[STARVIS2_LINK_FREQ_720MHZ] = 990,
+	[STARVIS2_LINK_FREQ_891MHZ] = 990,
+	[STARVIS2_LINK_FREQ_1039MHZ] = 990,
+	[STARVIS2_LINK_FREQ_1188MHZ] = 990,
+};
+
+const struct starvis2_variant imx662_variant_def = {
+	.name = "imx662",
+	.id_reg = CCI_REG16_LE(0x4d1c),
+	.id_mask = 0x3ff,
+	.id_value = 0x296,
+	.native_area = {
+		.top = 0,
+		.left = 0,
+		.width = 1937,
+		.height = 1101,
+	},
+	.active_area = {
+		.top = 0,
+		.left = 0,
+		.width = 1936,
+		.height = 1096,
+	},
+	.pixel_rate = 222750000,
+	.pix_per_clk = 3,
+	.common_regs = imx662_common_regs,
+	.num_common_regs = ARRAY_SIZE(imx662_common_regs),
+	.vmax_default = 1136,
+	.hmax_min_link_freq = imx662_min_hmax_2lane,
+	.hmax_min_pixel_array = 990,
+};
+
 struct starvis2_model_info {
 	enum starvis2_type type;
 	const u32 *codes;
@@ -691,6 +823,26 @@ static const struct starvis2_model_info imx678_autodetect_info = {
 	.auto_detect_mono = &imx678_aamr_info,
 };
 
+static const struct starvis2_model_info imx662_aaqr_info = {
+	.type = STARVIS2_COLOR,
+	.codes = codes_bayer,
+	.num_codes = ARRAY_SIZE(codes_bayer),
+	.variant = &imx662_variant_def,
+};
+
+static const struct starvis2_model_info imx662_aamr_info = {
+	.type = STARVIS2_MONOCHROME,
+	.codes = codes_monochrome,
+	.num_codes = ARRAY_SIZE(codes_monochrome),
+	.variant = &imx662_variant_def,
+};
+
+static const struct starvis2_model_info imx662_autodetect_info = {
+	.variant = &imx662_variant_def,
+	.auto_detect_colour = &imx662_aaqr_info,
+	.auto_detect_mono = &imx662_aamr_info,
+};
+
 static const char * const starvis2_supply_name[] = {
 	"avdd",  /* Analog (3.3V) supply */
 	"dvdd",  /* Digital Core (1.1V) supply */
@@ -1499,8 +1651,11 @@ static const struct dev_pm_ops starvis2_pm_ops = {
 static const struct of_device_id starvis2_of_match[] = {
 	{ .compatible = "sony,imx678-aamr", .data = &imx678_aamr_info },
 	{ .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info },
+	{ .compatible = "sony,imx662-aamr", .data = &imx662_aamr_info },
+	{ .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info },
 	/* for non-conforming DTs that rely on runtime check */
 	{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
+	{ .compatible = "sony,imx662", .data = &imx662_autodetect_info },
 	{ /* sentinel */ }
 };
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 10/13] media: sony-starvis2: Add support for IMX675
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (8 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 09/13] media: sony-starvis2: Add support for IMX662 Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 11/13] media: sony-starvis2: Add support for IMX832 Dave Stevenson
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

The IMX675 is a 5MPix Starvis2 sensor that follows the same
programming pattern as IMX678 and IMX662, so add it into the
driver.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index c2d4b0aab8c8..084c7772abad 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -10,7 +10,9 @@
  *         pixels.
  * IMX662: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective
  *         pixels.
-
+ * IMX675: Diagonal 6.53mm (Type 1/2.8) CMOS image sensor with 5.12 M effective
+ *         pixels.
+ *
  * Copyright (C) 2026 Ideas On Board Oy.
  *
  * Based on Sony IMX678 driver prepared by Will Whang & Soho Enterprise Ltd.
@@ -793,6 +795,193 @@ const struct starvis2_variant imx662_variant_def = {
 	.hmax_min_pixel_array = 990,
 };
 
+static const struct cci_reg_sequence imx675_common_regs[] = {
+	{ STARVIS2_REG_THIN_V_EN, 0x00 },
+	{ STARVIS2_REG_VCMODE, 0x01 },
+
+	{ CCI_REG8(0x3081), 0x00 },
+	{ STARVIS2_REG_XXS_OUTSEL, 0xaa },
+	{ STARVIS2_REG_XXS_DRV, 0x0f },
+	{ CCI_REG8(0x30cc), 0x00 },
+	{ CCI_REG8(0x30cd), 0x00 },
+	{ CCI_REG8(0x30ce), 0x02 },
+	{ CCI_REG8(0x3400), 0x01 },
+
+	{ CCI_REG8(0x3460), 0x22 },
+	{ CCI_REG8(0x347b), 0x02 },
+	{ CCI_REG8(0x3492), 0x08 },
+	{ CCI_REG8(0x3b1d), 0x17 },
+	{ CCI_REG8(0x3b44), 0x3f },
+	{ CCI_REG8(0x3b60), 0x03 },
+	{ CCI_REG8(0x3c03), 0x04 },
+	{ CCI_REG8(0x3c04), 0x04 },
+	{ CCI_REG8(0x3c0a), 0x1f },
+	{ CCI_REG8(0x3c0b), 0x1f },
+	{ CCI_REG8(0x3c0c), 0x1f },
+	{ CCI_REG8(0x3c0d), 0x1f },
+	{ CCI_REG8(0x3c0e), 0x1f },
+	{ CCI_REG8(0x3c0f), 0x1f },
+	{ CCI_REG8(0x3c30), 0x73 },
+	{ CCI_REG8(0x3c3c), 0x20 },
+	{ CCI_REG8(0x3c44), 0x06 },
+	{ CCI_REG8(0x3c7c), 0xb9 },
+	{ CCI_REG8(0x3c7d), 0x01 },
+	{ CCI_REG8(0x3c7e), 0xb7 },
+	{ CCI_REG8(0x3c7f), 0x01 },
+	{ CCI_REG8(0x3cb0), 0x00 },
+	{ CCI_REG8(0x3cb2), 0xff },
+	{ CCI_REG8(0x3cb3), 0x03 },
+	{ CCI_REG8(0x3cb4), 0xff },
+	{ CCI_REG8(0x3cb5), 0x03 },
+	{ CCI_REG8(0x3cba), 0xff },
+	{ CCI_REG8(0x3cbb), 0x03 },
+	{ CCI_REG8(0x3cc0), 0xff },
+	{ CCI_REG8(0x3cc1), 0x03 },
+	{ CCI_REG8(0x3cc2), 0x00 },
+	{ CCI_REG8(0x3cc6), 0xff },
+	{ CCI_REG8(0x3cc7), 0x03 },
+	{ CCI_REG8(0x3cc8), 0xff },
+	{ CCI_REG8(0x3cc9), 0x03 },
+	{ CCI_REG8(0x3e00), 0x1e },
+	{ CCI_REG8(0x3e02), 0x04 },
+	{ CCI_REG8(0x3e03), 0x00 },
+	{ CCI_REG8(0x3e20), 0x04 },
+	{ CCI_REG8(0x3e21), 0x00 },
+	{ CCI_REG8(0x3e22), 0x1e },
+	{ CCI_REG8(0x3e24), 0xba },
+	{ CCI_REG8(0x3e72), 0x85 },
+	{ CCI_REG8(0x3e76), 0x0c },
+	{ CCI_REG8(0x3e77), 0x01 },
+	{ CCI_REG8(0x3e7a), 0x85 },
+	{ CCI_REG8(0x3e7e), 0x1f },
+	{ CCI_REG8(0x3e82), 0xa6 },
+	{ CCI_REG8(0x3e86), 0x2d },
+	{ CCI_REG8(0x3ee2), 0x33 },
+	{ CCI_REG8(0x3ee3), 0x03 },
+	{ CCI_REG8(0x4490), 0x07 },
+	{ CCI_REG8(0x4494), 0x19 },
+	{ CCI_REG8(0x4495), 0x00 },
+	{ CCI_REG8(0x4496), 0xbb },
+	{ CCI_REG8(0x4497), 0x00 },
+	{ CCI_REG8(0x4498), 0x55 },
+	{ CCI_REG8(0x449a), 0x50 },
+	{ CCI_REG8(0x449c), 0x50 },
+	{ CCI_REG8(0x449e), 0x50 },
+	{ CCI_REG8(0x44a0), 0x3c },
+	{ CCI_REG8(0x44a2), 0x19 },
+	{ CCI_REG8(0x44a4), 0x19 },
+	{ CCI_REG8(0x44a6), 0x19 },
+	{ CCI_REG8(0x44a8), 0x4b },
+	{ CCI_REG8(0x44aa), 0x4b },
+	{ CCI_REG8(0x44ac), 0x4b },
+	{ CCI_REG8(0x44ae), 0x4b },
+	{ CCI_REG8(0x44b0), 0x3c },
+	{ CCI_REG8(0x44b2), 0x19 },
+	{ CCI_REG8(0x44b4), 0x19 },
+	{ CCI_REG8(0x44b6), 0x19 },
+	{ CCI_REG8(0x44b8), 0x4b },
+	{ CCI_REG8(0x44ba), 0x4b },
+	{ CCI_REG8(0x44bc), 0x4b },
+	{ CCI_REG8(0x44be), 0x4b },
+	{ CCI_REG8(0x44c0), 0x3c },
+	{ CCI_REG8(0x44c2), 0x19 },
+	{ CCI_REG8(0x44c4), 0x19 },
+	{ CCI_REG8(0x44c6), 0x19 },
+	{ CCI_REG8(0x44c8), 0xf0 },
+	{ CCI_REG8(0x44ca), 0xeb },
+	{ CCI_REG8(0x44cc), 0xeb },
+	{ CCI_REG8(0x44ce), 0xe6 },
+	{ CCI_REG8(0x44d0), 0xe6 },
+	{ CCI_REG8(0x44d2), 0xbb },
+	{ CCI_REG8(0x44d4), 0xbb },
+	{ CCI_REG8(0x44d6), 0xbb },
+	{ CCI_REG8(0x44d8), 0xe6 },
+	{ CCI_REG8(0x44da), 0xe6 },
+	{ CCI_REG8(0x44dc), 0xe6 },
+	{ CCI_REG8(0x44de), 0xe6 },
+	{ CCI_REG8(0x44e0), 0xe6 },
+	{ CCI_REG8(0x44e2), 0xbb },
+	{ CCI_REG8(0x44e4), 0xbb },
+	{ CCI_REG8(0x44e6), 0xbb },
+	{ CCI_REG8(0x44e8), 0xe6 },
+	{ CCI_REG8(0x44ea), 0xe6 },
+	{ CCI_REG8(0x44ec), 0xe6 },
+	{ CCI_REG8(0x44ee), 0xe6 },
+	{ CCI_REG8(0x44f0), 0xe6 },
+	{ CCI_REG8(0x44f2), 0xbb },
+	{ CCI_REG8(0x44f4), 0xbb },
+	{ CCI_REG8(0x44f6), 0xbb },
+	{ CCI_REG8(0x4538), 0x15 },
+	{ CCI_REG8(0x4539), 0x15 },
+	{ CCI_REG8(0x453a), 0x15 },
+	{ CCI_REG8(0x4544), 0x15 },
+	{ CCI_REG8(0x4545), 0x15 },
+	{ CCI_REG8(0x4546), 0x15 },
+	{ CCI_REG8(0x4550), 0x10 },
+	{ CCI_REG8(0x4551), 0x10 },
+	{ CCI_REG8(0x4552), 0x10 },
+	{ CCI_REG8(0x4553), 0x10 },
+	{ CCI_REG8(0x4554), 0x10 },
+	{ CCI_REG8(0x4555), 0x10 },
+	{ CCI_REG8(0x4556), 0x10 },
+	{ CCI_REG8(0x4557), 0x10 },
+	{ CCI_REG8(0x4558), 0x10 },
+	{ CCI_REG8(0x455c), 0x10 },
+	{ CCI_REG8(0x455d), 0x10 },
+	{ CCI_REG8(0x455e), 0x10 },
+	{ CCI_REG8(0x455f), 0x10 },
+	{ CCI_REG8(0x4560), 0x10 },
+	{ CCI_REG8(0x4561), 0x10 },
+	{ CCI_REG8(0x4562), 0x10 },
+	{ CCI_REG8(0x4563), 0x10 },
+	{ CCI_REG8(0x4564), 0x10 },
+	{ CCI_REG8(0x4569), 0x01 },
+	{ CCI_REG8(0x456a), 0x01 },
+	{ CCI_REG8(0x456b), 0x06 },
+	{ CCI_REG8(0x456c), 0x06 },
+	{ CCI_REG8(0x456d), 0x06 },
+	{ CCI_REG8(0x456e), 0x06 },
+	{ CCI_REG8(0x456f), 0x06 },
+	{ CCI_REG8(0x4570), 0x06 },
+};
+
+static const u16 imx675_min_hmax_2lane[] = {
+	[STARVIS2_LINK_FREQ_297MHZ] = 2044,
+	[STARVIS2_LINK_FREQ_360MHZ] = 1692,
+	[STARVIS2_LINK_FREQ_445MHZ] = 1376,
+	[STARVIS2_LINK_FREQ_594MHZ] = 1064,
+	[STARVIS2_LINK_FREQ_720MHZ] = 840,
+	[STARVIS2_LINK_FREQ_891MHZ] = 684,
+	[STARVIS2_LINK_FREQ_1039MHZ] = 592,
+	[STARVIS2_LINK_FREQ_1188MHZ] = 528,
+};
+
+const struct starvis2_variant imx675_variant_def = {
+	.name = "imx675",
+	.id_reg = CCI_REG16_LE(0x4d12),
+	.id_mask = 0xfff,
+	.id_value = 0x576,
+	.native_area = {
+		.top = 0,
+		.left = 0,
+		.width = 2609,
+		.height = 1984,
+	},
+	.active_area = {
+		.top = 0,
+		.left = 0,
+		.width = 2608,
+		.height = 1984,
+	},
+	.pixel_rate = 594000000,
+	.pix_per_clk = 8,
+	.common_regs = imx675_common_regs,
+	.num_common_regs = ARRAY_SIZE(imx675_common_regs),
+	.vmax_default = 2024,
+	.hmax_min_link_freq = imx675_min_hmax_2lane,
+	.hmax_min_pixel_array = 528,
+};
+
 struct starvis2_model_info {
 	enum starvis2_type type;
 	const u32 *codes;
@@ -843,6 +1032,26 @@ static const struct starvis2_model_info imx662_autodetect_info = {
 	.auto_detect_mono = &imx662_aamr_info,
 };
 
+static const struct starvis2_model_info imx675_aaqr_info = {
+	.type = STARVIS2_COLOR,
+	.codes = codes_bayer,
+	.num_codes = ARRAY_SIZE(codes_bayer),
+	.variant = &imx675_variant_def,
+};
+
+static const struct starvis2_model_info imx675_aamr_info = {
+	.type = STARVIS2_MONOCHROME,
+	.codes = codes_monochrome,
+	.num_codes = ARRAY_SIZE(codes_monochrome),
+	.variant = &imx675_variant_def,
+};
+
+static const struct starvis2_model_info imx675_autodetect_info = {
+	.variant = &imx675_variant_def,
+	.auto_detect_colour = &imx675_aaqr_info,
+	.auto_detect_mono = &imx675_aamr_info,
+};
+
 static const char * const starvis2_supply_name[] = {
 	"avdd",  /* Analog (3.3V) supply */
 	"dvdd",  /* Digital Core (1.1V) supply */
@@ -1651,10 +1860,13 @@ static const struct dev_pm_ops starvis2_pm_ops = {
 static const struct of_device_id starvis2_of_match[] = {
 	{ .compatible = "sony,imx678-aamr", .data = &imx678_aamr_info },
 	{ .compatible = "sony,imx678-aaqr", .data = &imx678_aaqr_info },
+	{ .compatible = "sony,imx675-aamr", .data = &imx675_aamr_info },
+	{ .compatible = "sony,imx675-aaqr", .data = &imx675_aaqr_info },
 	{ .compatible = "sony,imx662-aamr", .data = &imx662_aamr_info },
 	{ .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info },
 	/* for non-conforming DTs that rely on runtime check */
 	{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
+	{ .compatible = "sony,imx675", .data = &imx675_autodetect_info },
 	{ .compatible = "sony,imx662", .data = &imx662_autodetect_info },
 	{ /* sentinel */ }
 };

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 11/13] media: sony-starvis2: Add support for IMX832
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (9 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 10/13] media: sony-starvis2: Add support for IMX675 Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 12/13] media: sony-starvis2: Only update bits for window mode Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 13/13] media: sony-starvis2: Add support for IMX585 Dave Stevenson
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

IMX832 is replacing IMX662, and it follows the same pattern as all the
Starvis2 sensors.

Add the sensor specific configuration for it.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 084c7772abad..1a2a5d45bcc5 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -12,6 +12,8 @@
  *         pixels.
  * IMX675: Diagonal 6.53mm (Type 1/2.8) CMOS image sensor with 5.12 M effective
  *         pixels.
+ * IMX832: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective
+ *         pixels.
  *
  * Copyright (C) 2026 Ideas On Board Oy.
  *
@@ -982,6 +984,99 @@ const struct starvis2_variant imx675_variant_def = {
 	.hmax_min_pixel_array = 528,
 };
 
+static const struct cci_reg_sequence imx832_common_regs[] = {
+	{ CCI_REG8(0x3460), 0x21 },
+	{ CCI_REG8(0x3a94), 0x75 },
+	{ CCI_REG8(0x3a96), 0x69 },
+	{ CCI_REG8(0x3a98), 0x1e },
+	{ CCI_REG8(0x3a9a), 0x1e },
+	{ CCI_REG8(0x3b58), 0xeb },
+	{ CCI_REG8(0x3b5c), 0xeb },
+	{ CCI_REG8(0x3b88), 0xeb },
+	{ CCI_REG8(0x3b8c), 0xeb },
+	{ CCI_REG8(0x3c40), 0x06 },
+	{ CCI_REG8(0x3cae), 0x79 },
+	{ CCI_REG8(0x3cbc), 0x7b },
+	{ CCI_REG8(0x4508), 0x00 },
+	{ CCI_REG8(0x4509), 0x02 },
+	{ CCI_REG8(0x450a), 0x41 },
+	{ CCI_REG8(0x450b), 0x03 },
+	{ CCI_REG8(0x4660), 0x12 },
+	{ CCI_REG8(0x4661), 0x00 },
+	{ CCI_REG8(0x4662), 0x29 },
+	{ CCI_REG8(0x4664), 0x12 },
+	{ CCI_REG8(0x4665), 0x00 },
+	{ CCI_REG8(0x4666), 0x25 },
+	{ CCI_REG8(0x4667), 0x03 },
+	{ CCI_REG8(0x46c0), 0x13 },
+	{ CCI_REG8(0x46c1), 0x00 },
+	{ CCI_REG8(0x46c2), 0x28 },
+	{ CCI_REG8(0x46c4), 0x13 },
+	{ CCI_REG8(0x46c5), 0x00 },
+	{ CCI_REG8(0x46c6), 0x24 },
+	{ CCI_REG8(0x46c7), 0x03 },
+	{ CCI_REG8(0x4720), 0x07 },
+	{ CCI_REG8(0x4721), 0x00 },
+	{ CCI_REG8(0x4722), 0x23 },
+	{ CCI_REG8(0x4723), 0x03 },
+	{ CCI_REG8(0x4724), 0x14 },
+	{ CCI_REG8(0x4725), 0x00 },
+	{ CCI_REG8(0x4726), 0x2a },
+	{ CCI_REG8(0x4750), 0x1e },
+	{ CCI_REG8(0x4752), 0x22 },
+	{ CCI_REG8(0x4753), 0x03 },
+	{ CCI_REG8(0x4754), 0x25 },
+	{ CCI_REG8(0x4755), 0x00 },
+	{ CCI_REG8(0x4756), 0x29 },
+	{ CCI_REG8(0x4780), 0x08 },
+	{ CCI_REG8(0x4781), 0x00 },
+	{ CCI_REG8(0x4782), 0x1d },
+	{ CCI_REG8(0x4783), 0x03 },
+	{ CCI_REG8(0x4784), 0x15 },
+	{ CCI_REG8(0x4785), 0x00 },
+	{ CCI_REG8(0x4786), 0x24 },
+	{ STARVIS2_REG_WDMODE, 0x00 },
+	{ STARVIS2_REG_MDBIT, 0x01 },
+	{ STARVIS2_REG_XXS_DRV, 0x00 },
+};
+
+static const u16 imx832_min_hmax_2lane[] = {
+	[STARVIS2_LINK_FREQ_297MHZ] = 1980,
+	[STARVIS2_LINK_FREQ_360MHZ] = 1980,
+	[STARVIS2_LINK_FREQ_445MHZ] = 1188,
+	[STARVIS2_LINK_FREQ_594MHZ] = 990,
+	[STARVIS2_LINK_FREQ_720MHZ] = 990,
+	[STARVIS2_LINK_FREQ_891MHZ] = 990,
+	[STARVIS2_LINK_FREQ_1039MHZ] = 990,
+	[STARVIS2_LINK_FREQ_1188MHZ] = 990,
+};
+
+const struct starvis2_variant imx832_variant_def = {
+	.name = "imx832",
+	.id_reg = CCI_REG16_LE(0x4d1c),
+	.id_mask = 0x3ff,
+	.id_value = 0x340,
+	.native_area = {
+		.top = 0,
+		.left = 0,
+		.width = 1937,
+		.height = 1101,
+	},
+	.active_area = {
+		.top = 0,
+		.left = 0,
+		.width = 1936,
+		.height = 1096,
+	},
+	.pixel_rate = 222750000,
+	.pix_per_clk = 3,
+	.common_regs = imx832_common_regs,
+	.num_common_regs = ARRAY_SIZE(imx832_common_regs),
+	.vmax_default = 1136,
+	.hmax_min_link_freq = imx832_min_hmax_2lane,
+	.hmax_min_pixel_array = 990,
+};
+
 struct starvis2_model_info {
 	enum starvis2_type type;
 	const u32 *codes;
@@ -1052,6 +1147,26 @@ static const struct starvis2_model_info imx675_autodetect_info = {
 	.auto_detect_mono = &imx675_aamr_info,
 };
 
+static const struct starvis2_model_info imx832_aqr_info = {
+	.type = STARVIS2_COLOR,
+	.codes = codes_bayer,
+	.num_codes = ARRAY_SIZE(codes_bayer),
+	.variant = &imx832_variant_def,
+};
+
+static const struct starvis2_model_info imx832_amr_info = {
+	.type = STARVIS2_MONOCHROME,
+	.codes = codes_monochrome,
+	.num_codes = ARRAY_SIZE(codes_monochrome),
+	.variant = &imx832_variant_def,
+};
+
+static const struct starvis2_model_info imx832_autodetect_info = {
+	.variant = &imx832_variant_def,
+	.auto_detect_colour = &imx832_aqr_info,
+	.auto_detect_mono = &imx832_amr_info,
+};
+
 static const char * const starvis2_supply_name[] = {
 	"avdd",  /* Analog (3.3V) supply */
 	"dvdd",  /* Digital Core (1.1V) supply */
@@ -1864,10 +1979,13 @@ static const struct of_device_id starvis2_of_match[] = {
 	{ .compatible = "sony,imx675-aaqr", .data = &imx675_aaqr_info },
 	{ .compatible = "sony,imx662-aamr", .data = &imx662_aamr_info },
 	{ .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info },
+	{ .compatible = "sony,imx832-amr", .data = &imx832_amr_info },
+	{ .compatible = "sony,imx832-aqr", .data = &imx832_aqr_info },
 	/* for non-conforming DTs that rely on runtime check */
 	{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
 	{ .compatible = "sony,imx675", .data = &imx675_autodetect_info },
 	{ .compatible = "sony,imx662", .data = &imx662_autodetect_info },
+	{ .compatible = "sony,imx832", .data = &imx832_autodetect_info },
 	{ /* sentinel */ }
 };
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 12/13] media: sony-starvis2: Only update bits for window mode
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (10 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 11/13] media: sony-starvis2: Add support for IMX832 Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:17 ` [PATCH v2 13/13] media: sony-starvis2: Add support for IMX585 Dave Stevenson
  12 siblings, 0 replies; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

IMX585 requires bit 4 of the WINMODE register (0x3018) to be
set, whilst the bottom nibble selects between all-pixel and
window mode.

Switch to using cci_update_bits so that only the bottom nibble
is updated, thereby working on all supported Starvis2 sensors.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 1a2a5d45bcc5..1ce2b86c57ac 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -88,6 +88,7 @@
 
 /* Crop */
 #define STARVIS2_REG_WINMODE		CCI_REG8(0x3018)
+#define STARVIS2_REG_WINMODE_MASK	0x0f
 #define STARVIS2_REG_PIX_HST		CCI_REG16_LE(0x303c)
 #define STARVIS2_REG_PIX_HWIDTH		CCI_REG16_LE(0x303e)
 #define STARVIS2_REG_PIX_VST		CCI_REG16_LE(0x3044)
@@ -1455,7 +1456,8 @@ static int starvis2_program_window(struct starvis2 *starvis2,
 	int ret = 0;
 
 	cci_write(starvis2->cci, STARVIS2_REG_ADDMODE, 0x00, &ret);
-	cci_write(starvis2->cci, STARVIS2_REG_WINMODE, 0x04, &ret);
+	cci_update_bits(starvis2->cci, STARVIS2_REG_WINMODE,
+			STARVIS2_REG_WINMODE_MASK, 0x04, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_PIX_HST,
 		  crop->left - starvis2->variant->active_area.left, &ret);
 	cci_write(starvis2->cci, STARVIS2_REG_PIX_HWIDTH, crop->width, &ret);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 13/13] media: sony-starvis2: Add support for IMX585
  2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
                   ` (11 preceding siblings ...)
  2026-10-13 15:17 ` [PATCH v2 12/13] media: sony-starvis2: Only update bits for window mode Dave Stevenson
@ 2026-10-13 15:17 ` Dave Stevenson
  2026-10-13 15:29   ` sashiko-bot
  12 siblings, 1 reply; 18+ messages in thread
From: Dave Stevenson @ 2026-10-13 15:17 UTC (permalink / raw)
  To: Sakari Ailus, Jai Luthra, Mauro Carvalho Chehab, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Laurent Pinchart, Alexander Shiyan, linux-media, linux-kernel,
	devicetree, Dave Stevenson

IMX585 is an 8MPix Starvis 2 sensor, so add support for it.

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

diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
index 1ce2b86c57ac..c9a3dd4fe529 100644
--- a/drivers/media/i2c/sony-starvis2.c
+++ b/drivers/media/i2c/sony-starvis2.c
@@ -14,6 +14,8 @@
  *         pixels.
  * IMX832: Diagonal 6.45mm (Type 1/2.8) CMOS image sensor with 2.12 M effective
  *         pixels.
+ * IMX585: Diagonal 12.84 mm (Type 1/1.2) CMOS image sensor with 8.40 M effective
+ *         pixels.
  *
  * Copyright (C) 2026 Ideas On Board Oy.
  *
@@ -1078,6 +1080,283 @@ const struct starvis2_variant imx832_variant_def = {
 	.hmax_min_pixel_array = 990,
 };
 
+static const struct cci_reg_sequence imx585_common_regs[] = {
+	{ STARVIS2_REG_THIN_V_EN, 0x00 },
+	{ STARVIS2_REG_VCMODE, 0x01 },
+	{ CCI_REG8(0x306b), 0x00 },
+	{ STARVIS2_REG_GAIN_PGC_FIDMD, 0x01 },
+
+	{ CCI_REG8(0x3460), 0x21 },
+	{ CCI_REG8(0x3478), 0xa1 },
+	{ CCI_REG8(0x347c), 0x01 },
+	{ CCI_REG8(0x3480), 0x01 },
+	{ CCI_REG8(0x3930), 0x0c },
+	{ CCI_REG8(0x3931), 0x01 },
+	{ CCI_REG8(0x3a4c), 0x39 },
+	{ CCI_REG8(0x3a4d), 0x01 },
+	{ CCI_REG8(0x3a4e), 0x14 },
+	{ CCI_REG8(0x3a50), 0x48 },
+	{ CCI_REG8(0x3a51), 0x01 },
+	{ CCI_REG8(0x3a52), 0x14 },
+	{ CCI_REG8(0x3a56), 0x00 },
+	{ CCI_REG8(0x3a5a), 0x00 },
+	{ CCI_REG8(0x3a5e), 0x00 },
+	{ CCI_REG8(0x3a62), 0x00 },
+	{ CCI_REG8(0x3a6a), 0x20 },
+	{ CCI_REG8(0x3a6c), 0x42 },
+	{ CCI_REG8(0x3a6e), 0xa0 },
+	{ CCI_REG8(0x3b2c), 0x0c },
+	{ CCI_REG8(0x3b30), 0x1c },
+	{ CCI_REG8(0x3b34), 0x0c },
+	{ CCI_REG8(0x3b38), 0x1c },
+	{ CCI_REG8(0x3ba0), 0x0c },
+	{ CCI_REG8(0x3ba4), 0x1c },
+	{ CCI_REG8(0x3ba8), 0x0c },
+	{ CCI_REG8(0x3bac), 0x1c },
+	{ CCI_REG8(0x3d3c), 0x11 },
+	{ CCI_REG8(0x3d46), 0x0b },
+	{ CCI_REG8(0x3de0), 0x3f },
+	{ CCI_REG8(0x3de1), 0x08 },
+	{ CCI_REG8(0x3e10), 0x10 },
+	{ CCI_REG8(0x3e14), 0x87 },
+	{ CCI_REG8(0x3e16), 0x91 },
+	{ CCI_REG8(0x3e18), 0x91 },
+	{ CCI_REG8(0x3e1a), 0x87 },
+	{ CCI_REG8(0x3e1c), 0x78 },
+	{ CCI_REG8(0x3e1e), 0x50 },
+	{ CCI_REG8(0x3e20), 0x50 },
+	{ CCI_REG8(0x3e22), 0x50 },
+	{ CCI_REG8(0x3e24), 0x87 },
+	{ CCI_REG8(0x3e26), 0x91 },
+	{ CCI_REG8(0x3e28), 0x91 },
+	{ CCI_REG8(0x3e2a), 0x87 },
+	{ CCI_REG8(0x3e2c), 0x78 },
+	{ CCI_REG8(0x3e2e), 0x50 },
+	{ CCI_REG8(0x3e30), 0x50 },
+	{ CCI_REG8(0x3e32), 0x50 },
+	{ CCI_REG8(0x3e34), 0x87 },
+	{ CCI_REG8(0x3e36), 0x91 },
+	{ CCI_REG8(0x3e38), 0x91 },
+	{ CCI_REG8(0x3e3a), 0x87 },
+	{ CCI_REG8(0x3e3c), 0x78 },
+	{ CCI_REG8(0x3e3e), 0x50 },
+	{ CCI_REG8(0x3e40), 0x50 },
+	{ CCI_REG8(0x3e42), 0x50 },
+	{ CCI_REG8(0x4054), 0x64 },
+	{ CCI_REG8(0x4148), 0xfe },
+	{ CCI_REG8(0x4149), 0x05 },
+	{ CCI_REG8(0x414a), 0xff },
+	{ CCI_REG8(0x414b), 0x05 },
+	{ CCI_REG8(0x420a), 0x03 },
+	{ CCI_REG8(0x4231), 0x08 },
+	{ CCI_REG8(0x423d), 0x9c },
+	{ CCI_REG8(0x4242), 0xb4 },
+	{ CCI_REG8(0x4246), 0xb4 },
+	{ CCI_REG8(0x424e), 0xb4 },
+	{ CCI_REG8(0x425c), 0xb4 },
+	{ CCI_REG8(0x425e), 0xb6 },
+	{ CCI_REG8(0x426c), 0xb4 },
+	{ CCI_REG8(0x426e), 0xb6 },
+	{ CCI_REG8(0x428c), 0xb4 },
+	{ CCI_REG8(0x428e), 0xb6 },
+	{ CCI_REG8(0x4708), 0x00 },
+	{ CCI_REG8(0x4709), 0x00 },
+	{ CCI_REG8(0x470a), 0xff },
+	{ CCI_REG8(0x470b), 0x03 },
+	{ CCI_REG8(0x470c), 0x00 },
+	{ CCI_REG8(0x470d), 0x00 },
+	{ CCI_REG8(0x470e), 0xff },
+	{ CCI_REG8(0x470f), 0x03 },
+	{ CCI_REG8(0x47eb), 0x1c },
+	{ CCI_REG8(0x47f0), 0xa6 },
+	{ CCI_REG8(0x47f2), 0xa6 },
+	{ CCI_REG8(0x47f4), 0xa0 },
+	{ CCI_REG8(0x47f6), 0x96 },
+	{ CCI_REG8(0x4808), 0xa6 },
+	{ CCI_REG8(0x480a), 0xa6 },
+	{ CCI_REG8(0x480c), 0xa0 },
+	{ CCI_REG8(0x480e), 0x96 },
+	{ CCI_REG8(0x492c), 0xb2 },
+	{ CCI_REG8(0x4930), 0x03 },
+	{ CCI_REG8(0x4932), 0x03 },
+	{ CCI_REG8(0x4936), 0x5b },
+	{ CCI_REG8(0x4938), 0x82 },
+	{ CCI_REG8(0x493c), 0x23 },
+	{ CCI_REG8(0x493e), 0x23 },
+	{ CCI_REG8(0x4940), 0x23 },
+	{ CCI_REG8(0x4ba8), 0x1c },
+	{ CCI_REG8(0x4ba9), 0x03 },
+	{ CCI_REG8(0x4bac), 0x1c },
+	{ CCI_REG8(0x4bad), 0x1c },
+	{ CCI_REG8(0x4bae), 0x1c },
+	{ CCI_REG8(0x4baf), 0x1c },
+	{ CCI_REG8(0x4bb0), 0x1c },
+	{ CCI_REG8(0x4bb1), 0x1c },
+	{ CCI_REG8(0x4bb2), 0x1c },
+	{ CCI_REG8(0x4bb3), 0x1c },
+	{ CCI_REG8(0x4bb4), 0x1c },
+	{ CCI_REG8(0x4bb8), 0x03 },
+	{ CCI_REG8(0x4bb9), 0x03 },
+	{ CCI_REG8(0x4bba), 0x03 },
+	{ CCI_REG8(0x4bbb), 0x03 },
+	{ CCI_REG8(0x4bbc), 0x03 },
+	{ CCI_REG8(0x4bbd), 0x03 },
+	{ CCI_REG8(0x4bbe), 0x03 },
+	{ CCI_REG8(0x4bbf), 0x03 },
+	{ CCI_REG8(0x4bc0), 0x03 },
+	{ CCI_REG8(0x4c14), 0x87 },
+	{ CCI_REG8(0x4c16), 0x91 },
+	{ CCI_REG8(0x4c18), 0x91 },
+	{ CCI_REG8(0x4c1a), 0x87 },
+	{ CCI_REG8(0x4c1c), 0x78 },
+	{ CCI_REG8(0x4c1e), 0x50 },
+	{ CCI_REG8(0x4c20), 0x50 },
+	{ CCI_REG8(0x4c22), 0x50 },
+	{ CCI_REG8(0x4c24), 0x87 },
+	{ CCI_REG8(0x4c26), 0x91 },
+	{ CCI_REG8(0x4c28), 0x91 },
+	{ CCI_REG8(0x4c2a), 0x87 },
+	{ CCI_REG8(0x4c2c), 0x78 },
+	{ CCI_REG8(0x4c2e), 0x50 },
+	{ CCI_REG8(0x4c30), 0x50 },
+	{ CCI_REG8(0x4c32), 0x50 },
+	{ CCI_REG8(0x4c34), 0x87 },
+	{ CCI_REG8(0x4c36), 0x91 },
+	{ CCI_REG8(0x4c38), 0x91 },
+	{ CCI_REG8(0x4c3a), 0x87 },
+	{ CCI_REG8(0x4c3c), 0x78 },
+	{ CCI_REG8(0x4c3e), 0x50 },
+	{ CCI_REG8(0x4c40), 0x50 },
+	{ CCI_REG8(0x4c42), 0x50 },
+	{ CCI_REG8(0x4d12), 0x1f },
+	{ CCI_REG8(0x4d13), 0x1e },
+	{ CCI_REG8(0x4d26), 0x33 },
+	{ CCI_REG8(0x4e0e), 0x59 },
+	{ CCI_REG8(0x4e14), 0x55 },
+	{ CCI_REG8(0x4e16), 0x59 },
+	{ CCI_REG8(0x4e1e), 0x3b },
+	{ CCI_REG8(0x4e20), 0x47 },
+	{ CCI_REG8(0x4e22), 0x54 },
+	{ CCI_REG8(0x4e26), 0x81 },
+	{ CCI_REG8(0x4e2c), 0x7d },
+	{ CCI_REG8(0x4e2e), 0x81 },
+	{ CCI_REG8(0x4e36), 0x63 },
+	{ CCI_REG8(0x4e38), 0x6f },
+	{ CCI_REG8(0x4e3a), 0x7c },
+	{ CCI_REG8(0x4f3a), 0x3c },
+	{ CCI_REG8(0x4f3c), 0x46 },
+	{ CCI_REG8(0x4f3e), 0x59 },
+	{ CCI_REG8(0x4f42), 0x64 },
+	{ CCI_REG8(0x4f44), 0x6e },
+	{ CCI_REG8(0x4f46), 0x81 },
+	{ CCI_REG8(0x4f4a), 0x82 },
+	{ CCI_REG8(0x4f5a), 0x81 },
+	{ CCI_REG8(0x4f62), 0xaa },
+	{ CCI_REG8(0x4f72), 0xa9 },
+	{ CCI_REG8(0x4f78), 0x36 },
+	{ CCI_REG8(0x4f7a), 0x41 },
+	{ CCI_REG8(0x4f7c), 0x61 },
+	{ CCI_REG8(0x4f7d), 0x01 },
+	{ CCI_REG8(0x4f7e), 0x7c },
+	{ CCI_REG8(0x4f7f), 0x01 },
+	{ CCI_REG8(0x4f80), 0x77 },
+	{ CCI_REG8(0x4f82), 0x7b },
+	{ CCI_REG8(0x4f88), 0x37 },
+	{ CCI_REG8(0x4f8a), 0x40 },
+	{ CCI_REG8(0x4f8c), 0x62 },
+	{ CCI_REG8(0x4f8d), 0x01 },
+	{ CCI_REG8(0x4f8e), 0x76 },
+	{ CCI_REG8(0x4f8f), 0x01 },
+	{ CCI_REG8(0x4f90), 0x5e },
+	{ CCI_REG8(0x4f91), 0x02 },
+	{ CCI_REG8(0x4f92), 0x69 },
+	{ CCI_REG8(0x4f93), 0x02 },
+	{ CCI_REG8(0x4f94), 0x89 },
+	{ CCI_REG8(0x4f95), 0x02 },
+	{ CCI_REG8(0x4f96), 0xa4 },
+	{ CCI_REG8(0x4f97), 0x02 },
+	{ CCI_REG8(0x4f98), 0x9f },
+	{ CCI_REG8(0x4f99), 0x02 },
+	{ CCI_REG8(0x4f9a), 0xa3 },
+	{ CCI_REG8(0x4f9b), 0x02 },
+	{ CCI_REG8(0x4fa0), 0x5f },
+	{ CCI_REG8(0x4fa1), 0x02 },
+	{ CCI_REG8(0x4fa2), 0x68 },
+	{ CCI_REG8(0x4fa3), 0x02 },
+	{ CCI_REG8(0x4fa4), 0x8a },
+	{ CCI_REG8(0x4fa5), 0x02 },
+	{ CCI_REG8(0x4fa6), 0x9e },
+	{ CCI_REG8(0x4fa7), 0x02 },
+	{ CCI_REG8(0x519e), 0x79 },
+	{ CCI_REG8(0x51a6), 0xa1 },
+	{ CCI_REG8(0x51f0), 0xac },
+	{ CCI_REG8(0x51f2), 0xaa },
+	{ CCI_REG8(0x51f4), 0xa5 },
+	{ CCI_REG8(0x51f6), 0xa0 },
+	{ CCI_REG8(0x5200), 0x9b },
+	{ CCI_REG8(0x5202), 0x91 },
+	{ CCI_REG8(0x5204), 0x87 },
+	{ CCI_REG8(0x5206), 0x82 },
+	{ CCI_REG8(0x5208), 0xac },
+	{ CCI_REG8(0x520a), 0xaa },
+	{ CCI_REG8(0x520c), 0xa5 },
+	{ CCI_REG8(0x520e), 0xa0 },
+	{ CCI_REG8(0x5210), 0x9b },
+	{ CCI_REG8(0x5212), 0x91 },
+	{ CCI_REG8(0x5214), 0x87 },
+	{ CCI_REG8(0x5216), 0x82 },
+	{ CCI_REG8(0x5218), 0xac },
+	{ CCI_REG8(0x521a), 0xaa },
+	{ CCI_REG8(0x521c), 0xa5 },
+	{ CCI_REG8(0x521e), 0xa0 },
+	{ CCI_REG8(0x5220), 0x9b },
+	{ CCI_REG8(0x5222), 0x91 },
+	{ CCI_REG8(0x5224), 0x87 },
+	{ CCI_REG8(0x5226), 0x82 },
+	{ CCI_REG8(0x5b3c), 0x07 },
+
+	{ STARVIS2_REG_WDMODE, 0x00 },
+	{ STARVIS2_REG_MDBIT, 0x01 },
+	{ STARVIS2_REG_XXS_DRV, 0x00 },
+};
+
+static const u16 imx585_min_hmax_2lane[] = {
+	[STARVIS2_LINK_FREQ_297MHZ] = 2984,
+	[STARVIS2_LINK_FREQ_360MHZ] = 2464,
+	[STARVIS2_LINK_FREQ_445MHZ] = 2004,
+	[STARVIS2_LINK_FREQ_594MHZ] = 1512,
+	[STARVIS2_LINK_FREQ_720MHZ] = 1260,
+	[STARVIS2_LINK_FREQ_891MHZ] = 996,
+	[STARVIS2_LINK_FREQ_1039MHZ] = 856,
+	[STARVIS2_LINK_FREQ_1188MHZ] = 856,
+};
+
+const struct starvis2_variant imx585_variant_def = {
+	.name = "imx585",
+	.id_reg = CCI_REG16_LE(0x5a1d),
+	.id_mask = 0x3ff,
+	.id_value = 0x259,
+	.active_area = {
+		.top = 0,
+		.left = 0,
+		.width = 3857,
+		.height = 2201,
+	},
+	.active_area = {
+		.top = 20,
+		.left = 0,
+		.width = 3856,
+		.height = 2180,
+	},
+	.pixel_rate = 594000000,
+	.pix_per_clk = 8,
+	.common_regs = imx585_common_regs,
+	.num_common_regs = ARRAY_SIZE(imx585_common_regs),
+	.vmax_default = 2250,
+	.hmax_min_link_freq = imx585_min_hmax_2lane,
+	.hmax_min_pixel_array = 550,
+};
+
 struct starvis2_model_info {
 	enum starvis2_type type;
 	const u32 *codes;
@@ -1168,6 +1447,26 @@ static const struct starvis2_model_info imx832_autodetect_info = {
 	.auto_detect_mono = &imx832_amr_info,
 };
 
+static const struct starvis2_model_info imx585_aaqj_info = {
+	.type = STARVIS2_COLOR,
+	.codes = codes_bayer,
+	.num_codes = ARRAY_SIZE(codes_bayer),
+	.variant = &imx585_variant_def,
+};
+
+static const struct starvis2_model_info imx585_aamj_info = {
+	.type = STARVIS2_MONOCHROME,
+	.codes = codes_monochrome,
+	.num_codes = ARRAY_SIZE(codes_monochrome),
+	.variant = &imx585_variant_def,
+};
+
+static const struct starvis2_model_info imx585_autodetect_info = {
+	.variant = &imx585_variant_def,
+	.auto_detect_colour = &imx585_aaqj_info,
+	.auto_detect_mono = &imx585_aamj_info,
+};
+
 static const char * const starvis2_supply_name[] = {
 	"avdd",  /* Analog (3.3V) supply */
 	"dvdd",  /* Digital Core (1.1V) supply */
@@ -1983,11 +2282,14 @@ static const struct of_device_id starvis2_of_match[] = {
 	{ .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info },
 	{ .compatible = "sony,imx832-amr", .data = &imx832_amr_info },
 	{ .compatible = "sony,imx832-aqr", .data = &imx832_aqr_info },
+	{ .compatible = "sony,imx585-aamj", .data = &imx585_aamj_info },
+	{ .compatible = "sony,imx585-aaqj", .data = &imx585_aaqj_info },
 	/* for non-conforming DTs that rely on runtime check */
 	{ .compatible = "sony,imx678", .data = &imx678_autodetect_info },
 	{ .compatible = "sony,imx675", .data = &imx675_autodetect_info },
 	{ .compatible = "sony,imx662", .data = &imx662_autodetect_info },
 	{ .compatible = "sony,imx832", .data = &imx832_autodetect_info },
+	{ .compatible = "sony,imx585", .data = &imx585_autodetect_info },
 	{ /* sentinel */ }
 };
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 13/13] media: sony-starvis2: Add support for IMX585
  2026-10-13 15:17 ` [PATCH v2 13/13] media: sony-starvis2: Add support for IMX585 Dave Stevenson
@ 2026-10-13 15:29   ` sashiko-bot
  0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-10-13 15:29 UTC (permalink / raw)
  To: Dave Stevenson; +Cc: devicetree, robh, conor+dt, media-ci

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] media: duplicate .active_area initialization in imx585_variant_def leaves .native_area zeroed
--

commit 189fbc745613583120b9ef2ff05d5e60a02d4cb3
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>

media: sony-starvis2: Add support for IMX585

This commit adds support for the IMX585 8MPix Starvis 2 sensor.

> diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
> index 1ce2b86c57acc..c9a3dd4fe529b 100644
> --- a/drivers/media/i2c/sony-starvis2.c
> +++ b/drivers/media/i2c/sony-starvis2.c

[ ... ]

> +const struct starvis2_variant imx585_variant_def = {
> +	.name = "imx585",
> +	.id_reg = CCI_REG16_LE(0x5a1d),
> +	.id_mask = 0x3ff,
> +	.id_value = 0x259,
> +	.active_area = {
> +		.top = 0,
> +		.left = 0,
> +		.width = 3857,
> +		.height = 2201,
> +	},
> +	.active_area = {
> +		.top = 20,
> +		.left = 0,
> +		.width = 3856,
> +		.height = 2180,
> +	},

[Severity: High]
Does this code inadvertently leave .native_area uninitialized?

By defining .active_area twice, the second definition overwrites the first,
leaving .native_area implicitly zero-initialized. When userspace queries
V4L2_SEL_TGT_NATIVE_SIZE via starvis2_get_selection(), it will inadvertently
receive a 0x0 native area.

Was the first .active_area initialization intended to be .native_area?

> +	.pixel_rate = 594000000,
> +	.pix_per_clk = 8,
> +	.common_regs = imx585_common_regs,
> +	.num_common_regs = ARRAY_SIZE(imx585_common_regs),
> +	.vmax_default = 2250,
> +	.hmax_min_link_freq = imx585_min_hmax_2lane,
> +	.hmax_min_pixel_array = 550,
> +};

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-media-starvis2-v2-0-3670722d250a@raspberrypi.com?part=13

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 01/13] media: imx678: Rework into generic Starvis 2 sensor driver.
  2026-10-13 15:17 ` [PATCH v2 01/13] media: imx678: Rework into generic Starvis 2 sensor driver Dave Stevenson
@ 2026-10-13 15:32   ` sashiko-bot
  0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-10-13 15:32 UTC (permalink / raw)
  To: Dave Stevenson; +Cc: devicetree, robh, conor+dt, media-ci

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] kconfig: VIDEO_IMX678 selects VIDEO_SONY_STARVIS2 without inheriting GPIOLIB dependency
- [High] build: missing removal of imx678.o from Makefile causes build failure
--

commit 1c5c35700f9fe2a06860a9b3d153305723dc7e5f
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>

media: imx678: Rework into generic Starvis 2 sensor driver.

The register layout and programming model for multiple of the
Sony Starvis2 sensors is identical, so prepare for supporting
those by renaming all common parts of the driver to a starvis2_
prefix, and renaming the driver.

> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -323,14 +323,11 @@ config VIDEO_IMX576
>  
>  config VIDEO_IMX678
>  	tristate "Sony IMX678 sensor support"
> -	depends on GPIOLIB
> -	select V4L2_CCI_I2C
> +	select VIDEO_SONY_STARVIS2

[Severity: High]
Does selecting VIDEO_SONY_STARVIS2 without inheriting its GPIOLIB dependency
cause Kconfig warnings or build failures? The VIDEO_SONY_STARVIS2 symbol added
below explicitly depends on GPIOLIB, so enabling VIDEO_IMX678 on a platform
without GPIOLIB would forcefully enable the target driver and could lead to
unmet direct dependencies.

>  	help
>  	  This is a Video4Linux2 sensor driver for the Sony
> -	  IMX678 camera.
> -
> -	  To compile this driver as a module, choose M here: the
> -	  module will be called imx678.
> +	  IMX678 camera. This sensor is now supported by the common
> +	  Sony Starvis 2 sensor driver.

[ ... ]

> @@ -879,6 +876,17 @@ config VIDEO_S5KJN5
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called s5kjn5.
>  
> +config VIDEO_SONY_STARVIS2
> +	tristate "Sony Starvis 2 sensor support"
> +	depends on GPIOLIB
> +	select V4L2_CCI_I2C
> +	help
> +	  This is a Video4Linux2 sensor driver for the Sony Starvis
> +	  2 image sensors.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called sony-starvis2.
> +

> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
> --- a/drivers/media/i2c/Makefile
> +++ b/drivers/media/i2c/Makefile
> @@ -146,6 +146,7 @@ obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o
>  obj-$(CONFIG_VIDEO_SAA717X) += saa717x.o
>  obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o
>  obj-$(CONFIG_VIDEO_SONY_BTF_MPX) += sony-btf-mpx.o
> +obj-$(CONFIG_VIDEO_SONY_STARVIS2) += sony-starvis2.o

[Severity: High]
Does omitting the removal of the obj-$(CONFIG_VIDEO_IMX678) rule cause a
build failure? Since the source file imx678.c was renamed to sony-starvis2.c
and CONFIG_VIDEO_IMX678 remains in Kconfig for backwards compatibility, Kbuild
will attempt to build the non-existent imx678.o target.

>  obj-$(CONFIG_VIDEO_ST_MIPID02) += st-mipid02.o
>  obj-$(CONFIG_VIDEO_T4KA3) += t4ka3.o
>  obj-$(CONFIG_VIDEO_TC358743) += tc358743.o

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-media-starvis2-v2-0-3670722d250a@raspberrypi.com?part=1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 06/13] media: sony-starvis2: Allow runtime control of link frequency
  2026-10-13 15:17 ` [PATCH v2 06/13] media: sony-starvis2: Allow runtime control of link frequency Dave Stevenson
@ 2026-10-13 15:33   ` sashiko-bot
  0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-10-13 15:33 UTC (permalink / raw)
  To: Dave Stevenson; +Cc: devicetree, robh, conor+dt, media-ci

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] media: sony-starvis2: missing lock and NULL check for link_freq init
--

commit 54243fb94593be25be7c3f168bb8161959b863e5
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>

media: sony-starvis2: Allow runtime control of link frequency

This commit connects V4L2_CID_LINK_FREQ to allow runtime configuration
of the link frequency when the sensor is not streaming.

> diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
> index 66c77c5957e32..2bb438d22ada0 100644
> --- a/drivers/media/i2c/sony-starvis2.c
> +++ b/drivers/media/i2c/sony-starvis2.c

[ ... ]

> @@ -1210,25 +1236,23 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
>  
>  	starvis2->vmax = starvis2->variant->vmax_default;
>  
> -	hmax = variant->hmax_min_link_freq[__fls(starvis2->link_freq_bitmap)];
> -	if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
> -		hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
> -
>  	/* PIXEL_RATE is fixed and read-only */
>  	v4l2_ctrl_new_std(ctrl_hdlr, &starvis2_ctrl_ops, V4L2_CID_PIXEL_RATE,
>  			  starvis2->variant->pixel_rate,
>  			  starvis2->variant->pixel_rate, 1,
>  			  starvis2->variant->pixel_rate);
>  
> -	/* LINK_FREQ is also read only */
> -	link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
> -					   V4L2_CID_LINK_FREQ,
> -					   ARRAY_SIZE(link_freqs) - 1,
> -					   __ffs(starvis2->link_freq_bitmap),
> -					   link_freqs);
> -
> -	if (link_freq)
> -		link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
> +	starvis2->link_freq =
> +		v4l2_ctrl_new_int_menu(ctrl_hdlr, &starvis2_ctrl_ops,
> +				       V4L2_CID_LINK_FREQ,
> +				       __fls(starvis2->link_freq_bitmap),
> +				       __ffs(starvis2->link_freq_bitmap),
> +				       link_freqs);
> +	__v4l2_ctrl_modify_range(starvis2->link_freq,
> +				 __ffs(starvis2->link_freq_bitmap),
> +				 __fls(starvis2->link_freq_bitmap),
> +				 ~(starvis2->link_freq_bitmap),
> +				 __ffs(starvis2->link_freq_bitmap));

[Severity: High]
Does this code pass starvis2->link_freq to __v4l2_ctrl_modify_range() without
checking if it is NULL? If v4l2_ctrl_new_int_menu() fails to allocate memory,
it returns NULL, which would cause a NULL pointer dereference when
__v4l2_ctrl_modify_range() accesses ctrl->handler.

Also, is it safe to call __v4l2_ctrl_modify_range() in starvis2_init_controls()
without holding the control handler lock? This unlocked variant expects the
handler lock to be held, which will trigger a lockdep assertion failure. Should
this code use the locked variant v4l2_ctrl_modify_range() instead?

>  	vblank = starvis2->vmax - starvis2->variant->active_area.height;
>  	max_vblank = STARVIS2_VMAX_MAX - starvis2->variant->active_area.height;
> @@ -1236,6 +1260,10 @@ static int starvis2_init_controls(struct starvis2 *starvis2)
>  					     V4L2_CID_VBLANK, vblank, max_vblank,
>  					     2, vblank);
>  
> +	hmax = variant->hmax_min_link_freq[starvis2->link_freq->val];

[Severity: High]
Can this cause a NULL pointer dereference if starvis2->link_freq is NULL?
It appears this accesses the val field without a prior check.

> +	if (starvis2->lane_mode == STARVIS2_LANEMODE_4L)
> +		hmax = max(hmax >> 1, variant->hmax_min_pixel_array);
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-media-starvis2-v2-0-3670722d250a@raspberrypi.com?part=6

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 04/13] media: sony-starvis2: Parameterise the configuration to allow for other models
  2026-10-13 15:17 ` [PATCH v2 04/13] media: sony-starvis2: Parameterise the configuration to allow for other models Dave Stevenson
@ 2026-10-13 15:35   ` sashiko-bot
  0 siblings, 0 replies; 18+ messages in thread
From: sashiko-bot @ 2026-10-13 15:35 UTC (permalink / raw)
  To: Dave Stevenson; +Cc: devicetree, robh, conor+dt, media-ci

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] media: sony-starvis2: missing hardware init if PM is disabled
--

commit 7eb8011a8d0af06bdae270bac96946f8a554e9b6
Author: Dave Stevenson <dave.stevenson@raspberrypi.com>

media: sony-starvis2: Parameterise the configuration to allow for other models

This commit parameterises various sensor configurations such as the pixel
array size and timings in preparation for supporting other Starvis 2 variants.

> diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c
> index 20f3489b58d36..f62a957ff1a8c 100644
> --- a/drivers/media/i2c/sony-starvis2.c
> +++ b/drivers/media/i2c/sony-starvis2.c
[ ... ]
> @@ -895,8 +926,12 @@ static int starvis2_write_common(struct starvis2 *starvis2)
>  {
>  	int ret = 0;
>  
> -	cci_multi_reg_write(starvis2->cci, common_regs, ARRAY_SIZE(common_regs),
> -			    &ret);
> +	if (!starvis2->variant)
> +		/* Powered on during probe to do detection. Variant unknown. */
> +		return 0;
> +
> +	cci_multi_reg_write(starvis2->cci, starvis2->variant->common_regs,
> +			    starvis2->variant->num_common_regs, &ret);
>  
>  	cci_write(starvis2->cci, STARVIS2_REG_INCK_SEL, starvis2->inck_sel_val,
>  		  &ret);

[Severity: High]
If CONFIG_PM is disabled or userspace prevents runtime suspend, does this
skip hardware initialization entirely when starting the stream?

In starvis2_probe(), starvis2_power_on() is called before
starvis2_identify_model() populates starvis2->variant:

starvis2_probe() {
	...
	ret = starvis2_power_on(dev);
	...
	ret = starvis2_identify_model(starvis2);
	...
}

Because starvis2->variant is NULL during the initial probe,
starvis2_write_common() returns early here and skips writing the common
configuration.

If the device never runtime suspends after probe, the later call to
pm_runtime_resume_and_get() in starvis2_enable_streams() will return
immediately without invoking the resume callback, bypassing any subsequent
call to starvis2_power_on(). This appears to result in the stream starting
without the sensor's common configuration and clock settings being programmed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013-media-starvis2-v2-0-3670722d250a@raspberrypi.com?part=4

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-10-13 15:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 15:16 [PATCH v2 00/13] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 01/13] media: imx678: Rework into generic Starvis 2 sensor driver Dave Stevenson
2026-10-13 15:32   ` sashiko-bot
2026-10-13 15:17 ` [PATCH v2 02/13] media: sony-starvis2: Reorder link frequencies to remove lookup Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 03/13] media: sony-starvis2: Always program the sensor in window mode Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 04/13] media: sony-starvis2: Parameterise the configuration to allow for other models Dave Stevenson
2026-10-13 15:35   ` sashiko-bot
2026-10-13 15:17 ` [PATCH v2 05/13] media: sony-starvis2: Rework 2 lane support for higher link freqs Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 06/13] media: sony-starvis2: Allow runtime control of link frequency Dave Stevenson
2026-10-13 15:33   ` sashiko-bot
2026-10-13 15:17 ` [PATCH v2 07/13] media: sony-starvis2: Correct the minimum exposure Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 08/13] media: dt-bindings: sony,imx678: Add other Starvis 2 family members Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 09/13] media: sony-starvis2: Add support for IMX662 Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 10/13] media: sony-starvis2: Add support for IMX675 Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 11/13] media: sony-starvis2: Add support for IMX832 Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 12/13] media: sony-starvis2: Only update bits for window mode Dave Stevenson
2026-10-13 15:17 ` [PATCH v2 13/13] media: sony-starvis2: Add support for IMX585 Dave Stevenson
2026-10-13 15:29   ` sashiko-bot

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.