From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.167.242.64 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796011700; b=Z7Bx5EGpbCRejZCVVkOfCT4h8mnANsofOisSpR8foRH/nd1FrALLkOCNSWOHk7DiHdB5 Yl6dF1/lazOW6TYVccqUMsYeYqTW1Q8a+IVBSXL6XFUs+t5aSYWGyrRSS9yW/QSjKzF0u IR1QW1X47TeQ5aDfT9Sf9+oIL18e5G28FHiMdfEpcemiDThOxrzGxvd3uPZfPeaZZXCPL sCz6gcZ+Hwp/XZGeNAzyHkIzoXagd9+z+OwIXw1aqZLobOIVyHkwJp2A+dR/25At1QUxx zV+UTYHSPGhItzaQRAjWRF9E+hJhv5gVC55dVdldjf8otk3IyTZHvM9gz9d8tkLxa1Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796011700; h=DMARC-Filter:Received:DKIM-Signature:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=MmsbRkgQpatfcKXYJoTbO1I5PKtvewI7vSb1a1s2+jg=; b=1Iaz0Sht25yPk3uGQaGvnOSQbY5DeNK8dJ/QtVwPzRHKUxIh4X7CoMgCrkqF6RnkXhZV n6OZctS5AZdEMExtYDuiSFroIZJQBVML+cPanj8bBwfgh1ps7FVvvjx43Nf/u0uciraUf HYjVLPEt7lOGBvEt6wLBBTtRDPnOLn1u6011u5ca2y/JVDSpBS8t/f9SGCefXWbooaL5l sZ7sJOJvJNkzWIrVNCMdQ7ambFrlLzAiCoynRNlMYPh6QoXscNvv0dW/nlvyfi+x/t2oZ iqQNXwdbwvt+8GV1trlYKHphp43/Qu7lSCCfBtyK9DSnsAxLkBHdWUYmR8WyoCxP29w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=MYc7i4Tg; arc=none smtp.remote-ip=213.167.242.64 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81084606A329; Mon, 30 Nov 2026 04:08:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 81084606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.a=rsa-sha256 header.s=mail header.b=MYc7i4Tg Received: from killaraus.ideasonboard.com (sp49-96-232-4.msc.dcmisp.ne.jp [49.96.232.4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 19FF6802; Mon, 30 Nov 2026 05:05:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1796011541; bh=gXyNkJYMzPGIVkPbdRS3E3xdJPLZMG8PFom3dDjWju4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MYc7i4Tg1MQV+YhhfYbMpLMFkWZXzyR9s36V+xoaWAHp9O26Op4OyCUvJV6n3qqmD nxanDC5aC3mmIejJJFNxpxombsKuX63+hIBp8vouQhBGl1i45mAZFXjvENlchkRW90 tm+H3cKRvKJ+YInILpDTYdYhGGRPQ3GUsZYkHWJw= Date: Mon, 30 Nov 2026 13:08:11 +0900 From: Laurent Pinchart To: Dave Stevenson Cc: Sakari Ailus , Jai Luthra , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alexander Shiyan , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v7 11/18] media: sony-starvis2: Add support for IMX662 Message-ID: <20261130040811.GF4286@killaraus.ideasonboard.com> References: <20261029-media-starvis2-v7-0-b33a1332fdfc@raspberrypi.com> <20261029-media-starvis2-v7-11-b33a1332fdfc@raspberrypi.com> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261029-media-starvis2-v7-11-b33a1332fdfc@raspberrypi.com> On Thu, Oct 29, 2026 at 02:18:32PM +0000, Dave Stevenson wrote: > 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 > --- > drivers/media/i2c/sony-starvis2.c | 155 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 155 insertions(+) > > diff --git a/drivers/media/i2c/sony-starvis2.c b/drivers/media/i2c/sony-starvis2.c > index 27357cc293be..2db9ac28308a 100644 > --- a/drivers/media/i2c/sony-starvis2.c > +++ b/drivers/media/i2c/sony-starvis2.c > @@ -8,6 +8,8 @@ > * 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. Let's sort entries alphabetically, here and everywhere below. > * > * Copyright (C) 2026 Ideas On Board Oy. > * Copyright (C) 2026 Raspberry Pi > @@ -663,6 +665,136 @@ static 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, > +}; > + > +static const struct starvis2_variant imx662_variant_def = { There are no variants other than this one, so you can call it imx662_variant (or starvis2_variant_imx662). Same for all other models. > + .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, 3 is a fairly strange value. Where does it come from ? > + .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; > @@ -693,6 +825,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, > +}; Given that the media bus codes are the same across all variants, it could be nice not to store them in starvis2_model_info structure. > + > +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 */ > @@ -1528,9 +1680,12 @@ static const struct dev_pm_ops starvis2_pm_ops = { > }; > > static const struct of_device_id starvis2_of_match[] = { > + { .compatible = "sony,imx662-aamr", .data = &imx662_aamr_info }, > + { .compatible = "sony,imx662-aaqr", .data = &imx662_aaqr_info }, > { .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,imx662", .data = &imx662_autodetect_info }, See my comment in 04/18. > { .compatible = "sony,imx678", .data = &imx678_autodetect_info }, > { /* sentinel */ } > }; -- Regards, Laurent Pinchart