Linux Media Controller development
 help / color / mirror / Atom feed
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Jai Luthra <jai.luthra@ideasonboard.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	 Alexander Shiyan <eagle.alexander923@gmail.com>,
	 linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Dave Stevenson <dave.stevenson@raspberrypi.com>
Subject: [PATCH RFC 3/4] media: i2c: imx678: Add imx662 support to the driver
Date: Wed, 05 Aug 2026 17:09:18 +0100	[thread overview]
Message-ID: <20260805-media-starvis2-v1-3-91e8e4eae44f@raspberrypi.com> (raw)
In-Reply-To: <20260805-media-starvis2-v1-0-91e8e4eae44f@raspberrypi.com>

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

FIXME: Update the common registers based on the Sony spreadsheet.

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

diff --git a/drivers/media/i2c/imx678.c b/drivers/media/i2c/imx678.c
index 40ba6661b366..9083f2744510 100644
--- a/drivers/media/i2c/imx678.c
+++ b/drivers/media/i2c/imx678.c
@@ -673,6 +673,47 @@ const struct imx678_variant imx678_variant_def = {
 	.hmax_min = imx678_min_hmax_4lane,
 };
 
+static const struct cci_reg_sequence imx662_common_regs[] = {
+	{ IMX678_REG_WDMODE, 0x00 },
+	{ IMX678_REG_MDBIT, 0x01 },
+	{ IMX678_REG_XXS_DRV, 0x00 },
+};
+
+static const u16 imx662_min_hmax_4lane[] = {
+	[IMX678_LINK_FREQ_297MHZ] = 990,
+	[IMX678_LINK_FREQ_360MHZ] = 990,
+	[IMX678_LINK_FREQ_445MHZ] = 990,
+	[IMX678_LINK_FREQ_594MHZ] = 990,
+	[IMX678_LINK_FREQ_720MHZ] = 990,
+	[IMX678_LINK_FREQ_891MHZ] = 990,
+	[IMX678_LINK_FREQ_1039MHZ] = 990,
+	[IMX678_LINK_FREQ_1188MHZ] = 990,
+};
+
+const struct imx678_variant imx662_variant_def = {
+	.name = "imx662",
+	.id_reg = IMX678_REG_MODULE_ID,
+	.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 = 1096 + 40,
+	.hmax_min = imx662_min_hmax_4lane,
+};
+
 struct imx678_model_info {
 	enum imx678_type type;
 	const u32 *codes;
@@ -703,6 +744,26 @@ static const struct imx678_model_info imx678_autodetect_info = {
 	.auto_detect_mono = &imx678_aamr_info,
 };
 
+static const struct imx678_model_info imx662_aaqr_info = {
+	.type = IMX678_COLOR,
+	.codes = codes_bayer,
+	.num_codes = ARRAY_SIZE(codes_bayer),
+	.variant = &imx662_variant_def,
+};
+
+static const struct imx678_model_info imx662_aamr_info = {
+	.type = IMX678_MONOCHROME,
+	.codes = codes_monochrome,
+	.num_codes = ARRAY_SIZE(codes_monochrome),
+	.variant = &imx662_variant_def,
+};
+
+static const struct imx678_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 imx678_supply_name[] = {
 	"avdd",  /* Analog (3.3V) supply */
 	"dvdd",  /* Digital Core (1.1V) supply */
@@ -1470,8 +1531,11 @@ static const struct dev_pm_ops imx678_pm_ops = {
 static const struct of_device_id imx678_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


  parent reply	other threads:[~2026-08-05 16:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 16:09 [PATCH RFC 0/4] Update imx678 to act as a common Sony Starvis 2 driver Dave Stevenson
2026-08-05 16:09 ` [PATCH RFC 1/4] media: i2c: imx678: Always program the sensor in window mode Dave Stevenson
2026-08-05 16:09 ` [PATCH RFC 2/4] media: i2c: imx678: Parameterise the configuration to allow for other models Dave Stevenson
2026-08-05 16:09 ` Dave Stevenson [this message]
2026-08-05 16:09 ` [PATCH RFC 4/4] media: i2c: imx678: Add imx675 support to the driver Dave Stevenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260805-media-starvis2-v1-3-91e8e4eae44f@raspberrypi.com \
    --to=dave.stevenson@raspberrypi.com \
    --cc=eagle.alexander923@gmail.com \
    --cc=jai.luthra@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox