From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D29122A7E9; Fri, 13 Feb 2026 14:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991329; cv=none; b=o40/rP2Z/c1uwX6oAez2vwdn++ox6kY4e5IvAK1hG/c5sAlP+dpYocKCLX3IBdnraUp1OkCkpFgztwSIH17sbZojQET57wTUqO3yTG/y/sZo1JvtbCVl/Q+x0lqzk9q217b/teCPG12V6PamVsNfYwCKlUxl/SMQSWANN696XGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991329; c=relaxed/simple; bh=eGDt+QUEP8jNkwnTJw5v7lLHwdQU7KiuyW9rW8rRK9w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jBV+oIhZ5fET38VtiQldGV19lXGWVZ3j/C+maULUxmq+Nc3x/XxRwtxnQjY+4F0b+/LmuxJKI7WNLxpjTsMJly0pYBJhvdnVe34GbUxQSDHTnE1cnIuscCx/OykKOyhL+jX9eNhA/xqvC+LUT6SYd0+GlKWGiCzRQADHrVy3E60= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=ia08d3UI; arc=none smtp.client-ip=213.167.242.64 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.b="ia08d3UI" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 48BD1CF5; Fri, 13 Feb 2026 15:01:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991277; bh=eGDt+QUEP8jNkwnTJw5v7lLHwdQU7KiuyW9rW8rRK9w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ia08d3UIriE4hYdb2pdX/lZHbIK4Ez4DR6ViF5/DJAloJuAZgfY/tSgiMJyA6l5zW Jur2ixrRB4Vv9k7z4TSLaZ5wrfOSJeAm5OsioB7969W7jHBV0sdI1JJ9wll6XaMCPq vtXNMkm2+dZI1c8ZBKTMCKH2UOKIjw9EE0Gb7rCs= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:40 +0000 Subject: [PATCH v2 01/25] media: i2c: imx283: Report correct V4L2_SEL_TGT_CROP Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-1-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham , Stefan Klug , stable@vger.kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991324; l=1325; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=BBivussIvk9YcKcloCC2V2eItBbXaeuB2KOGJapG5tY=; b=axDFgGxuFDNwToutEE2Vf2IR9/QkpNEM4JYDiSzDExFULz8eu7v4jwkp0GiPP1qi5T679QDxa ZcNs/4MaTxeAvy/1snaKPs0IXCUnq+p9QxW7Zm2W2gwC8Abkptm++cc X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= From: Stefan Klug The target crop rectangle is initialized with the crop of the default sensor mode. This is incorrect when a different sensor mode gets selected. Fix that by updating the crop rectangle when changing the sensor mode. Cc: stable@vger.kernel.org # v6.10-rc1-70-gccb4eb4496fa Fixes: ccb4eb4496fa ("media: i2c: Add imx283 camera sensor driver") Reviewed-by: Kieran Bingham Tested-by: Kieran Bingham Signed-off-by: Stefan Klug Reviewed-by: Jai Luthra =20 --- drivers/media/i2c/imx283.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 8ab63ad8f385..e5c04d259625 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -956,6 +956,7 @@ static int imx283_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { + struct v4l2_rect *crop; struct v4l2_mbus_framefmt *format; const struct imx283_mode *mode; struct imx283 *imx283 =3D to_imx283(sd); @@ -982,6 +983,9 @@ static int imx283_set_pad_format(struct v4l2_subdev *sd, =20 *format =3D fmt->format; =20 + crop =3D v4l2_subdev_state_get_crop(sd_state, IMAGE_PAD); + *crop =3D mode->crop; + return 0; } =20 --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4150736165A; Fri, 13 Feb 2026 14:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991332; cv=none; b=nGiVBBR69+0tZ1SfBfvnCPe2rHLTIlVjML2FTNoC6BPMc4lkf5bl0+kj0bfv+37O2+nY4HpONTRYuXshW2TWbXc4kvlhiyPtp6gV4azdvJAP82pCmIzVWk3In/LNKUeInMMHKclT5FHANbcHkEqCnGg3GgUE0auPPGxiRzKltEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991332; c=relaxed/simple; bh=NTgQ/2rHGAkPHH2Uu+x00zM1XvwISbGU3Lf7Bopj7uk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pzr3Y4M7qEYvPmW2vngCBxFuY/03ZsF/znyBx/xwVAVQFb0gXV5khCytpM4DD+SmMV3ZqqOT+X4ZCZwMO1NW9NV8bwDqc44QRfW2Tfsq0t3HRkSSFy+Ma3/aItGGZ/Z2TG5zZodx283mRNYLjKzqNoBdG9PKkBV4iCU1R2XWkLM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=B4xy1JG6; arc=none smtp.client-ip=213.167.242.64 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.b="B4xy1JG6" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AAE0CDDE; Fri, 13 Feb 2026 15:01:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991277; bh=NTgQ/2rHGAkPHH2Uu+x00zM1XvwISbGU3Lf7Bopj7uk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=B4xy1JG6+D0tWwIUlgmbnKlfNQcEIspsOE2FCsdNwf9kNFGeG7rz0/1qPDKOZkKr9 CQqh1JWJYTPELpxYUzGICr2FRtYfnChS23sG5RBWk5Hvhs9W+WdpGuy13g3XgH+SW/ Fhp78L6F56bv24tErAHGgd2CxKgnWPliuAc65v6k= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:41 +0000 Subject: [PATCH v2 02/25] media: i2c: imx283: Fix handling of unsupported mbus codes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-2-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham , Stefan Klug , stable@vger.kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=2730; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=LXvzP9NDUjaZdrRJSZzGi0gFzLYd6GS/gd80rfLdYBU=; b=eeGD/3lYfBUV3moy9r8cJaTHZ/gtLIdRP5H8tmDP96RHYa/YlS9dDPn2sEU0FMSuLR9J9TCyy SMLNZmT4POtApeykPJJzK6uSvEMjgB2EikDdBYtjrolaoc6KFlmuElA X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= From: Stefan Klug When the code requested by imx283_set_pad_format() is not supported, a kernel exception occurs due to dereferencing the mode variable which is null. Fix that by correcting the code to a valid value before getting the mode table. While at it, remove the cases for the other unsupported codes in get_mode_table. Cc: stable@vger.kernel.org # v6.10-rc1-70-gccb4eb4496fa Fixes: ccb4eb4496fa ("media: i2c: Add imx283 camera sensor driver") Reviewed-by: Kieran Bingham Tested-by: Kieran Bingham Signed-off-by: Stefan Klug Reviewed-by: Jai Luthra =20 --- drivers/media/i2c/imx283.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index e5c04d259625..9a47cd0b181a 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -576,23 +576,31 @@ static inline struct imx283 *to_imx283(struct v4l2_su= bdev *sd) return container_of_const(sd, struct imx283, sd); } =20 +static inline int get_format_code(unsigned int code) +{ + unsigned int i; + + for (i =3D 0; i < ARRAY_SIZE(imx283_mbus_codes); i++) + if (imx283_mbus_codes[i] =3D=3D code) + break; + + if (i >=3D ARRAY_SIZE(imx283_mbus_codes)) + i =3D 0; + + return imx283_mbus_codes[i]; +} + static inline void get_mode_table(unsigned int code, const struct imx283_mode **mode_list, unsigned int *num_modes) { switch (code) { case MEDIA_BUS_FMT_SRGGB12_1X12: - case MEDIA_BUS_FMT_SGRBG12_1X12: - case MEDIA_BUS_FMT_SGBRG12_1X12: - case MEDIA_BUS_FMT_SBGGR12_1X12: *mode_list =3D supported_modes_12bit; *num_modes =3D ARRAY_SIZE(supported_modes_12bit); break; =20 case MEDIA_BUS_FMT_SRGGB10_1X10: - case MEDIA_BUS_FMT_SGRBG10_1X10: - case MEDIA_BUS_FMT_SGBRG10_1X10: - case MEDIA_BUS_FMT_SBGGR10_1X10: *mode_list =3D supported_modes_10bit; *num_modes =3D ARRAY_SIZE(supported_modes_10bit); break; @@ -963,6 +971,8 @@ static int imx283_set_pad_format(struct v4l2_subdev *sd, const struct imx283_mode *mode_list; unsigned int num_modes; =20 + fmt->format.code =3D get_format_code(fmt->format.code); + get_mode_table(fmt->format.code, &mode_list, &num_modes); =20 mode =3D v4l2_find_nearest_size(mode_list, num_modes, width, height, @@ -1361,8 +1371,6 @@ static int imx283_init_controls(struct imx283 *imx283) =20 imx283->vflip =3D v4l2_ctrl_new_std(ctrl_hdlr, &imx283_ctrl_ops, V4L2_CID= _VFLIP, 0, 1, 1, 0); - if (imx283->vflip) - imx283->vflip->flags |=3D V4L2_CTRL_FLAG_MODIFY_LAYOUT; =20 v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &imx283_ctrl_ops, V4L2_CID_TEST_PATTERN, --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4982436165E; Fri, 13 Feb 2026 14:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991332; cv=none; b=FzyA/vCSMv3SdLdWKebAs3ZJRXPOYTS17PJsQXrhHGW8E0XHuBjacCq4jNrIstFdHJRzEjV69DEr9VLFCTV6m1841t3FToghhwBSy52j8VlW8su0SHBg3KWeXIlA78ujZ4LD5s9fYL37j7LXvbvShzxjxUlAyyKg+wBcTp5PNTA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991332; c=relaxed/simple; bh=F4uVtfvNBktKfqDGbg5M69Sf5liv6m8cJ/tSteIi9ZE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IPLo16eHnwexo+MKdwMZcwxI0EVG3+FMXBVpl+j8zvYjdYLpmER9MmBngD/iTwpTNJ8joNRzGVGob2yvgMiwFWhDIeK9ZDUbAyMJEj7PXpO6bbQjgXCSsrksiLncuBQxvBkuWqY4D15CsYgHYyU3n7AwJrGpJ0V/KUXAtA8hliI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=u5QbiwFH; arc=none smtp.client-ip=213.167.242.64 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.b="u5QbiwFH" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 19F76180F; Fri, 13 Feb 2026 15:01:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991278; bh=F4uVtfvNBktKfqDGbg5M69Sf5liv6m8cJ/tSteIi9ZE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=u5QbiwFH6rEEqU/QOh4AaiTftX/CxdrtOZTthbm007eQnLnGB9jcVbXa3BCOAjnFu 0D8B+ZMO7r0Rnjq5FSqtuhqI2YUf3jLWrPhpx5djgt6R00YJBC3xdg9dFcMqT46lvK BDXVi3rH2Hm2HZiWFxOeqb5mdCu/X06wNiO4RZ3U= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:42 +0000 Subject: [PATCH v2 03/25] media: i2c: imx283: Move imx283_mode structure definition Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-3-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=3614; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=F4uVtfvNBktKfqDGbg5M69Sf5liv6m8cJ/tSteIi9ZE=; b=M7R7ZG5b1HwRG1d7TYIhc8EIOlnXkkkKdRFjEWYgVam8gKEUgzZfILyBsraRJSnIa+Y3BbQ4v eYCdEjPkiOiDlcGBPaz1XdOkHlEDFKEycNK4/Je8pkR/Sn9p0y1GqT6 X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Move the struct imx283_mode further down in the compilation unit so that it can make reference of the scan out mode structures which are presently defined after. No functional change intended in this commit. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 118 ++++++++++++++++++++++-------------------= ---- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 9a47cd0b181a..d53cea49baae 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -195,65 +195,6 @@ struct imx283_reg_list { const struct cci_reg_sequence *regs; }; =20 -/* Mode : resolution and related config values */ -struct imx283_mode { - unsigned int mode; - - /* Bits per pixel */ - unsigned int bpp; - - /* Frame width */ - unsigned int width; - - /* Frame height */ - unsigned int height; - - /* - * Minimum horizontal timing in pixel-units - * - * Note that HMAX is written in 72MHz units, and the datasheet assumes a - * 720MHz link frequency. Convert datasheet values with the following: - * - * For 12 bpp modes (480Mbps) convert with: - * hmax =3D [hmax in 72MHz units] * 480 / 72 - * - * For 10 bpp modes (576Mbps) convert with: - * hmax =3D [hmax in 72MHz units] * 576 / 72 - */ - u32 min_hmax; - - /* minimum V-timing in lines */ - u32 min_vmax; - - /* default H-timing */ - u32 default_hmax; - - /* default V-timing */ - u32 default_vmax; - - /* minimum SHR */ - u32 min_shr; - - /* - * Per-mode vertical crop constants used to calculate values - * of IMX283REG_WIDCUT and IMX283_REG_VWINPOS. - */ - u32 veff; - u32 vst; - u32 vct; - - /* Horizontal and vertical binning ratio */ - u8 hbin_ratio; - u8 vbin_ratio; - - /* Optical Blanking */ - u32 horizontal_ob; - u32 vertical_ob; - - /* Analog crop rectangle. */ - struct v4l2_rect crop; -}; - struct imx283_input_frequency { unsigned int mhz; unsigned int reg_count; @@ -352,6 +293,65 @@ static const struct imx283_readout_mode imx283_readout= _modes[] =3D { */ }; =20 +/* Mode : resolution and related config values */ +struct imx283_mode { + unsigned int mode; + + /* Bits per pixel */ + unsigned int bpp; + + /* Frame width */ + unsigned int width; + + /* Frame height */ + unsigned int height; + + /* + * Minimum horizontal timing in pixel-units + * + * Note that HMAX is written in 72MHz units, and the datasheet assumes a + * 720MHz link frequency. Convert datasheet values with the following: + * + * For 12 bpp modes (480Mbps) convert with: + * hmax =3D [hmax in 72MHz units] * 480 / 72 + * + * For 10 bpp modes (576Mbps) convert with: + * hmax =3D [hmax in 72MHz units] * 576 / 72 + */ + u32 min_hmax; + + /* minimum V-timing in lines */ + u32 min_vmax; + + /* default H-timing */ + u32 default_hmax; + + /* default V-timing */ + u32 default_vmax; + + /* minimum SHR */ + u32 min_shr; + + /* + * Per-mode vertical crop constants used to calculate values + * of IMX283REG_WIDCUT and IMX283_REG_VWINPOS. + */ + u32 veff; + u32 vst; + u32 vct; + + /* Horizontal and vertical binning ratio */ + u8 hbin_ratio; + u8 vbin_ratio; + + /* Optical Blanking */ + u32 horizontal_ob; + u32 vertical_ob; + + /* Analog crop rectangle. */ + struct v4l2_rect crop; +}; + static const struct cci_reg_sequence mipi_data_rate_1440Mbps[] =3D { /* The default register settings provide the 1440Mbps rate */ { CCI_REG8(0x36c5), 0x00 }, /* Undocumented */ --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01686361DCF; Fri, 13 Feb 2026 14:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991335; cv=none; b=HetVXHHXCGPb/vv0jjgFfN0VZuAo+S2qIGZ7CQLdqexf85/R0mCjbzN7nGiC9WaI2izddypGTWdgi4HRhBMetaGhZIFvTiSGoq8BZ4SisKXYSagjKpDN4yi5WZenZL1/yQo8yv5Zy4u7+gMMtGFPLxpuxKhte+Ih76oa1VNSS2g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991335; c=relaxed/simple; bh=QqgQyWdO4Ut0ngGaW/ZW4D336zGgMk+CJLwaBYWu2Hc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Dszb1I77lK/v2aazNeXGIAy5aL2945NbHLor5xFN2Uc4PPPmxaN7bsoKTDNCHwfawgM4TmhJ3qKA9O08tmJz3PkNf8Gsn5S5sTjhGe17zg+7WilIP7op3rMP11arXFcobW4XQ7YzCQpsJidO4LlBZaQXYqvQAJM11tlO+rDnbBM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=m/fLK/ap; arc=none smtp.client-ip=213.167.242.64 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.b="m/fLK/ap" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 70894268F; Fri, 13 Feb 2026 15:01:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991278; bh=QqgQyWdO4Ut0ngGaW/ZW4D336zGgMk+CJLwaBYWu2Hc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=m/fLK/ap1T8MN33o6clLop/gr4Gm9NIOkXNQH0fBsMaJu2Vd2Vs40LPlHHYFxWCRE cIofATYKlDGNVGEzgIbmpNuIOWGe87QolJBY+nXjXh0LxTdJ6eMq1HdQONpMzpldc2 0bk6VrYEgEnDX0jY8UkObiICNqwy0QkLrhqJY2Jo= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:43 +0000 Subject: [PATCH v2 04/25] media: i2c: imx283: Move scan out data to single data structure Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-4-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=6712; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=QqgQyWdO4Ut0ngGaW/ZW4D336zGgMk+CJLwaBYWu2Hc=; b=2+YvjgHKhnqxNN+7bt1p4To4+uZ3Ih5VH7dktgwhioyh7YQcMvZ6jGnrZVgBnBIbgBeqZFcIh cJkUkig7qO8DmraRrifns7Va6vA9L4axyUVPrptFXwariJ8FFiDESTu X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Move the common data structures to a new scanout table and allow v4l2 output modes to reference their scanout. This removes duplication from the mode definitions. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 90 +++++++++++++++++++++++++++++++-----------= ---- 1 file changed, 62 insertions(+), 28 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index d53cea49baae..3e97ad38f716 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -264,28 +264,63 @@ struct imx283_readout_mode { u8 mdsel4; }; =20 -static const struct imx283_readout_mode imx283_readout_modes[] =3D { +struct imx283_scanout { + u8 bpp; + struct imx283_readout_mode readout; +}; + +static const struct imx283_scanout imx283_scan_modes[] =3D { /* All pixel scan modes */ - [IMX283_MODE_0] =3D { 0x04, 0x03, 0x10, 0x00 }, /* 12 bit */ - [IMX283_MODE_1] =3D { 0x04, 0x01, 0x00, 0x00 }, /* 10 bit */ - [IMX283_MODE_1A] =3D { 0x04, 0x01, 0x20, 0x50 }, /* 10 bit */ - [IMX283_MODE_1S] =3D { 0x04, 0x41, 0x20, 0x50 }, /* 10 bit */ + [IMX283_MODE_0] =3D { + .bpp =3D 12, + .readout =3D { 0x04, 0x03, 0x10, 0x00 }, + }, + [IMX283_MODE_1] =3D { + .bpp =3D 10, + .readout =3D { 0x04, 0x01, 0x00, 0x00 }, + }, + [IMX283_MODE_1A] =3D { + .bpp =3D 10, + .readout =3D { 0x04, 0x01, 0x20, 0x50 }, + }, + [IMX283_MODE_1S] =3D { + .bpp =3D 10, + .readout =3D { 0x04, 0x41, 0x20, 0x50 }, + }, =20 /* Horizontal / Vertical 2/2-line binning */ - [IMX283_MODE_2] =3D { 0x0d, 0x11, 0x50, 0x00 }, /* 12 bit */ - [IMX283_MODE_2A] =3D { 0x0d, 0x11, 0x70, 0x50 }, /* 12 bit */ + [IMX283_MODE_2] =3D { + .bpp =3D 12, + .readout =3D { 0x0d, 0x11, 0x50, 0x00 }, + }, + [IMX283_MODE_2A] =3D { + .bpp =3D 12, + .readout =3D { 0x0d, 0x11, 0x70, 0x50 }, + }, =20 /* Horizontal / Vertical 3/3-line binning */ - [IMX283_MODE_3] =3D { 0x1e, 0x18, 0x10, 0x00 }, /* 12 bit */ + [IMX283_MODE_3] =3D { + .bpp =3D 12, + .readout =3D { 0x1e, 0x18, 0x10, 0x00 }, + }, =20 /* Vertical 2/9 subsampling, horizontal 3 binning cropping */ - [IMX283_MODE_4] =3D { 0x29, 0x18, 0x30, 0x50 }, /* 12 bit */ + [IMX283_MODE_4] =3D { + .bpp =3D 12, + .readout =3D { 0x29, 0x18, 0x30, 0x50 }, + }, =20 /* Vertical 2/19 subsampling binning, horizontal 3 binning */ - [IMX283_MODE_5] =3D { 0x2d, 0x18, 0x10, 0x00 }, /* 12 bit */ + [IMX283_MODE_5] =3D { + .bpp =3D 12, + .readout =3D { 0x2d, 0x18, 0x10, 0x00 }, + }, =20 /* Vertical 2 binning horizontal 2/4, subsampling 16:9 cropping */ - [IMX283_MODE_6] =3D { 0x18, 0x21, 0x00, 0x09 }, /* 10 bit */ + [IMX283_MODE_6] =3D { + .bpp =3D 10, + .readout =3D { 0x18, 0x21, 0x00, 0x09 }, + }, =20 /* * New modes should make sure the offset period is complied. @@ -293,12 +328,14 @@ static const struct imx283_readout_mode imx283_readou= t_modes[] =3D { */ }; =20 +static bool scan_mode(const struct imx283_scanout *scan, enum imx283_modes= mode) +{ + return scan =3D=3D &imx283_scan_modes[mode]; +} + /* Mode : resolution and related config values */ struct imx283_mode { - unsigned int mode; - - /* Bits per pixel */ - unsigned int bpp; + const struct imx283_scanout *scan; =20 /* Frame width */ unsigned int width; @@ -410,8 +447,8 @@ static const struct imx283_reg_list link_freq_reglist[]= =3D { static const struct imx283_mode supported_modes_12bit[] =3D { { /* 20MPix 21.40 fps readout mode 0 */ - .mode =3D IMX283_MODE_0, - .bpp =3D 12, + .scan =3D &imx283_scan_modes[IMX283_MODE_0], + .width =3D 5472, .height =3D 3648, .min_hmax =3D 5914, /* 887 @ 480MHz/72MHz */ @@ -442,8 +479,7 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { /* * Readout mode 2 : 2/2 binned mode (2736x1824) */ - .mode =3D IMX283_MODE_2, - .bpp =3D 12, + .scan =3D &imx283_scan_modes[IMX283_MODE_2], .width =3D 2736, .height =3D 1824, .min_hmax =3D 2414, /* Pixels (362 * 480MHz/72MHz + padding) */ @@ -475,8 +511,7 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { /* * Readout mode 3 : 3/3 binned mode (1824x1216) */ - .mode =3D IMX283_MODE_3, - .bpp =3D 12, + .scan =3D &imx283_scan_modes[IMX283_MODE_3], .width =3D 1824, .height =3D 1216, .min_hmax =3D 1894, /* Pixels (284 * 480MHz/72MHz + padding) */ @@ -509,8 +544,7 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { static const struct imx283_mode supported_modes_10bit[] =3D { { /* 20MPix 25.48 fps readout mode 1 */ - .mode =3D IMX283_MODE_1, - .bpp =3D 10, + .scan =3D &imx283_scan_modes[IMX283_MODE_1], .width =3D 5472, .height =3D 3648, .min_hmax =3D 5960, /* 745 @ 576MHz / 72MHz */ @@ -616,7 +650,7 @@ static u64 imx283_pixel_rate(struct imx283 *imx283, const struct imx283_mode *mode) { u64 link_frequency =3D link_frequencies[__ffs(imx283->link_freq_bitmap)]; - unsigned int bpp =3D mode->bpp; + unsigned int bpp =3D mode->scan->bpp; const unsigned int ddr =3D 2; /* Double Data Rate */ const unsigned int lanes =3D 4; /* Only 4 lane support */ u64 numerator =3D link_frequency * ddr * lanes; @@ -673,7 +707,7 @@ static u32 imx283_exposure(struct imx283 *imx283, u64 numerator; =20 /* Number of clocks per internal offset period */ - offset =3D mode->mode =3D=3D IMX283_MODE_0 ? 209 : 157; + offset =3D scan_mode(mode->scan, IMX283_MODE_0) ? 209 : 157; numerator =3D (imx283->vmax * (svr + 1) - shr) * imx283->hmax + offset; =20 do_div(numerator, imx283->hmax); @@ -708,7 +742,7 @@ static u32 imx283_shr(struct imx283 *imx283, const stru= ct imx283_mode *mode, u64 temp; =20 /* Number of clocks per internal offset period */ - offset =3D mode->mode =3D=3D IMX283_MODE_0 ? 209 : 157; + offset =3D scan_mode(mode->scan, IMX283_MODE_0) ? 209 : 157; temp =3D ((u64)exposure * imx283->hmax - offset); do_div(temp, imx283->hmax); =20 @@ -1073,7 +1107,7 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, * Set the readout mode registers. * MDSEL3 and MDSEL4 are updated to enable Arbitrary Vertical Cropping. */ - readout =3D &imx283_readout_modes[mode->mode]; + readout =3D &mode->scan->readout; cci_write(imx283->cci, IMX283_REG_MDSEL1, readout->mdsel1, &ret); cci_write(imx283->cci, IMX283_REG_MDSEL2, readout->mdsel2, &ret); cci_write(imx283->cci, IMX283_REG_MDSEL3, @@ -1082,7 +1116,7 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, readout->mdsel4 | IMX283_MDSEL4_VCROP_EN, &ret); =20 /* Mode 1S specific entries from the Readout Drive Mode Tables */ - if (mode->mode =3D=3D IMX283_MODE_1S) { + if (scan_mode(mode->scan, IMX283_MODE_1S)) { cci_write(imx283->cci, IMX283_REG_MDSEL7, 0x01, &ret); cci_write(imx283->cci, IMX283_REG_MDSEL18, 0x1098, &ret); } --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0160036074B; Fri, 13 Feb 2026 14:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991335; cv=none; b=V7KoMJ0/9Uq19JwbQFXIdfz8AL4rUdMYwagw96SR2Kv3dLcKvozOi4nN8tPBsokAWTzZRugLZHWfeqgN03RXHjAN01JneZ37MObXw8hvtH+avbAQM4NPaqCiJxKbd3ZxfRdcHAKQYoM4IMuF0m1idiIoODiiDep6nR2dD+BpKpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991335; c=relaxed/simple; bh=9kXjyYaL4aJFjcgrdkKkCBrOvdUj19zGBigH7bk/Tvo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EDqShMYQiATUZzs5ImPnBYLMrkw6JtRarnSVwTQ29HD+Ac0ZF9MkHnlVLzfOdjRtjlWhbsadkrLuqeM8DeT2xHhPAfDkCRKZDZDZA6PRgzCMHloNaT3+T78Lxt7MvzmnKV13fdc4apPk7rUGI6TjbrLi9JwJfI9dupuG6YtaTI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=eUey0DPY; arc=none smtp.client-ip=213.167.242.64 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.b="eUey0DPY" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CB22E2691; Fri, 13 Feb 2026 15:01:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991279; bh=9kXjyYaL4aJFjcgrdkKkCBrOvdUj19zGBigH7bk/Tvo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eUey0DPYiRRmKTPIkpLQtnZDEO1BKEIVSU+p27mgJm8qOuOQnBzclsm/bScB0uFNy fMldCzeDr3LwEvHKCwC7rrjOQS1w5USQ06zPiyzntnhSu66CtN6gmXriDY1BMpStFO QuUS99jOjmLwAWS+MOGuroFoLH9zZeYE1ydAitRw= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:44 +0000 Subject: [PATCH v2 05/25] media: i2c: imx283: Remove horizontal_ob Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-5-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1513; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=9kXjyYaL4aJFjcgrdkKkCBrOvdUj19zGBigH7bk/Tvo=; b=BxTYFOA/Dfh4csfUUvJgOoxZ0Hbw35akOXoeBM6OFwLqR021WW7CenFBaRHLFMF94tX8+U2An AIfRC2jllbeD9x/JI+NcPzYD3eu1U1RMs9tzT73bLcc2qRThgPyThij X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The horizontal optical black values are not used as we do not enable HOB output - and instead directly use HTRIMMING to request the desired horizontal cropping position. Remove the unused reference to simplify. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 3e97ad38f716..fe63700da872 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -382,7 +382,6 @@ struct imx283_mode { u8 vbin_ratio; =20 /* Optical Blanking */ - u32 horizontal_ob; u32 vertical_ob; =20 /* Analog crop rectangle. */ @@ -466,7 +465,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .default_vmax =3D 4000, =20 .min_shr =3D 11, - .horizontal_ob =3D 96, .vertical_ob =3D 16, .crop =3D { .top =3D 40, @@ -497,7 +495,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .vbin_ratio =3D 2, =20 .min_shr =3D 12, - .horizontal_ob =3D 48, .vertical_ob =3D 4, =20 .crop =3D { @@ -529,7 +526,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .vbin_ratio =3D 3, =20 .min_shr =3D 16, - .horizontal_ob =3D 32, .vertical_ob =3D 4, =20 .crop =3D { @@ -555,7 +551,6 @@ static const struct imx283_mode supported_modes_10bit[]= =3D { .default_vmax =3D 3840, =20 .min_shr =3D 10, - .horizontal_ob =3D 96, .vertical_ob =3D 16, .crop =3D { .top =3D 40, --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A74D36166A; Fri, 13 Feb 2026 14:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991337; cv=none; b=Qlu9BfJo0aPrmxXoTKyQNvS0JkfXIxUzET9hlUkhJODErJIU/so4acUTvbhCgIwcbcgFY1v/5qRTXlSX4C9hpJdVWVaBUPnVmuAvYscrVT6cxCB8DubJrm8bn9IYyCbFp8gD2n/qXqILH2il/jOp7omnjnid0AxpP2dQOgJsxT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991337; c=relaxed/simple; bh=FTYr05q00nZpiIwRutnF6nhQBZV3JEZL3mZmsvhNw/k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ExA6lhluGLANDBay+fMBM6PilOTdog5dpLJ3UZLDWcY488CWY5sutrnog0cbVkfFK0+H5Xy7NefGpC+D/vPZRcb9jwoc2h+tH9PEb/oRmCzYF+9bmJKNIRg9QKQkwlI8Xed7kRHxSrgJ91FIbuXrPC+sV4orMm+ek9MDyqLp9fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Jw6Vm2qU; arc=none smtp.client-ip=213.167.242.64 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.b="Jw6Vm2qU" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 354F326A1; Fri, 13 Feb 2026 15:01:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991279; bh=FTYr05q00nZpiIwRutnF6nhQBZV3JEZL3mZmsvhNw/k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Jw6Vm2qU95BeiABxV4IvxfiJt2dm3M9q4N9TM2TbM9dLN2uywTg4XOyBQwtzLlXVO LJqXWu44Lxn0rBFUL9V6EU11hjXH8947OqkMx/HCfS8LDFOyrllJvptQBRiQ4CCVUV Mb+kkWBJLSK/Nw1jWImqxQegzDq/77KQ8qXbUNoM= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:45 +0000 Subject: [PATCH v2 06/25] media: i2c: imx283: Move vertical_ob to scan modes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-6-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=4172; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=FTYr05q00nZpiIwRutnF6nhQBZV3JEZL3mZmsvhNw/k=; b=zjZGYNewdePuh5YLp57IKOHb1rWUsNthvdmcRCGAUva9cqlup3EFd4OyptWyHrzkCUzeWeIa7 24K+iQlrjK4DZDOc6iTC4BXai70ACmxq8H4Yg+PVdGdezirK0aw/n5l X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The Vertical Optical Black region is a property of the selected scan mode. Move the storage of this property to the scan mode table so it does not get duplicated when adding new output modes. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index fe63700da872..164e7c6125ae 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -267,6 +267,9 @@ struct imx283_readout_mode { struct imx283_scanout { u8 bpp; struct imx283_readout_mode readout; + + /* Optical Blanking */ + u8 vertical_ob; }; =20 static const struct imx283_scanout imx283_scan_modes[] =3D { @@ -274,52 +277,62 @@ static const struct imx283_scanout imx283_scan_modes[= ] =3D { [IMX283_MODE_0] =3D { .bpp =3D 12, .readout =3D { 0x04, 0x03, 0x10, 0x00 }, + .vertical_ob =3D 16, }, [IMX283_MODE_1] =3D { .bpp =3D 10, .readout =3D { 0x04, 0x01, 0x00, 0x00 }, + .vertical_ob =3D 16, }, [IMX283_MODE_1A] =3D { .bpp =3D 10, .readout =3D { 0x04, 0x01, 0x20, 0x50 }, + .vertical_ob =3D 16, }, [IMX283_MODE_1S] =3D { .bpp =3D 10, .readout =3D { 0x04, 0x41, 0x20, 0x50 }, + .vertical_ob =3D 16, }, =20 /* Horizontal / Vertical 2/2-line binning */ [IMX283_MODE_2] =3D { .bpp =3D 12, .readout =3D { 0x0d, 0x11, 0x50, 0x00 }, + .vertical_ob =3D 4, }, [IMX283_MODE_2A] =3D { .bpp =3D 12, .readout =3D { 0x0d, 0x11, 0x70, 0x50 }, + .vertical_ob =3D 4, }, =20 /* Horizontal / Vertical 3/3-line binning */ [IMX283_MODE_3] =3D { .bpp =3D 12, .readout =3D { 0x1e, 0x18, 0x10, 0x00 }, + .vertical_ob =3D 4, }, =20 /* Vertical 2/9 subsampling, horizontal 3 binning cropping */ [IMX283_MODE_4] =3D { .bpp =3D 12, .readout =3D { 0x29, 0x18, 0x30, 0x50 }, + .vertical_ob =3D 4, }, =20 /* Vertical 2/19 subsampling binning, horizontal 3 binning */ [IMX283_MODE_5] =3D { .bpp =3D 12, .readout =3D { 0x2d, 0x18, 0x10, 0x00 }, + .vertical_ob =3D 4, }, =20 /* Vertical 2 binning horizontal 2/4, subsampling 16:9 cropping */ [IMX283_MODE_6] =3D { .bpp =3D 10, .readout =3D { 0x18, 0x21, 0x00, 0x09 }, + .vertical_ob =3D 4, }, =20 /* @@ -381,9 +394,6 @@ struct imx283_mode { u8 hbin_ratio; u8 vbin_ratio; =20 - /* Optical Blanking */ - u32 vertical_ob; - /* Analog crop rectangle. */ struct v4l2_rect crop; }; @@ -465,7 +475,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .default_vmax =3D 4000, =20 .min_shr =3D 11, - .vertical_ob =3D 16, .crop =3D { .top =3D 40, .left =3D 108, @@ -495,7 +504,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .vbin_ratio =3D 2, =20 .min_shr =3D 12, - .vertical_ob =3D 4, =20 .crop =3D { .top =3D 40, @@ -526,7 +534,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .vbin_ratio =3D 3, =20 .min_shr =3D 16, - .vertical_ob =3D 4, =20 .crop =3D { .top =3D 40, @@ -551,7 +558,6 @@ static const struct imx283_mode supported_modes_10bit[]= =3D { .default_vmax =3D 3840, =20 .min_shr =3D 10, - .vertical_ob =3D 16, .crop =3D { .top =3D 40, .left =3D 108, @@ -1132,7 +1138,7 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, mode->crop.height); =20 y_out_size =3D mode->crop.height / mode->vbin_ratio; - write_v_size =3D y_out_size + mode->vertical_ob; + write_v_size =3D y_out_size + mode->scan->vertical_ob; /* * cropping start position =3D (VWINPOS =E2=80=93 Vst) =C3=97 2 * cropping width =3D Veff =E2=80=93 (VWIDCUT =E2=80=93 Vct) =C3=97 2 @@ -1147,7 +1153,7 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, cci_write(imx283->cci, IMX283_REG_VWIDCUT, v_widcut, &ret); cci_write(imx283->cci, IMX283_REG_VWINPOS, v_pos, &ret); =20 - cci_write(imx283->cci, IMX283_REG_OB_SIZE_V, mode->vertical_ob, &ret); + cci_write(imx283->cci, IMX283_REG_OB_SIZE_V, mode->scan->vertical_ob, &re= t); =20 /* TODO: Validate mode->crop is fully contained within imx283_native_area= */ cci_write(imx283->cci, IMX283_REG_HTRIMMING_START, mode->crop.left, &ret); --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B22B1362139; Fri, 13 Feb 2026 14:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991342; cv=none; b=nLDDGKB9e7cgVTuLcyFt4ExhpKv2eihfvXHzbSUSUvrtCpEERoE/is3y9j2zPwGuofyRF1qDJE2BbU2o41uOktuFPoeaJ8L+HHLreX0Xr4g744E8bbIDSgy3PYqcKiSl/XeaVoEIWYlUWhHkp281XVlffcTSUEu9AQPXUCbUkBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991342; c=relaxed/simple; bh=SQ/dqcNpMoCW4Rs/Izr97KYeYhBCOM4r6Oq2FBVzMBo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fQckTEVXUsoOg7COYB3wTQTmjXGvaFyE0qQRJVtO9QocmQzKPW6OzTHVb+4cwWZynOWz9gSzDe2oT77nT08sXZL6DgAfdgWTbnVDkMY8eNI2Cp1GO8c15if3K97H/dTA+QdNNSuO+oiPt8KRJAYOE3WSNuWFoV76Nv+zy+g/MXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Lo4ofjqF; arc=none smtp.client-ip=213.167.242.64 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.b="Lo4ofjqF" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8EA1326A5; Fri, 13 Feb 2026 15:01:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991279; bh=SQ/dqcNpMoCW4Rs/Izr97KYeYhBCOM4r6Oq2FBVzMBo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Lo4ofjqFbti/6Z2l6i4ziMr/qHFT9gipGP9MwpGO6fgrtbhlFBnZ4ZS1Z0MtNgc4l sJEqNz5ndXW42xo3dEmAtPgwQs4xPKqRu28q2AmdZ8Cryjk0QaHJs3lBs3No1nK9XP LXF8MJs01ScY7TYddz2eAkboy/pX1ordVzI2Q7KE= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:46 +0000 Subject: [PATCH v2 07/25] media: i2c: imx283: Factor out vertical cropping parameters Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-7-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=4967; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=SQ/dqcNpMoCW4Rs/Izr97KYeYhBCOM4r6Oq2FBVzMBo=; b=wrWtqTMLslPG4e2JiVuZp1ZPqMo1/xm6f1BDadmryX8wVUWXPK1nVBOkO38QelEw1+OXWR88H 5GJ9QSaYUBqDDuqZLFp8Vo0d2z5lCMEJaafpgH5N7I5BOt+aCniJ5OQ X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The vertical cropping parameters are specific to the readout mode selected and do not need to be duplicated on v4l2 mode choices. Move them to the imx283_scanout definitions. This also fixes the 10bit mode which had not yet defined the veff correctly and worked by chance. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 61 +++++++++++++++++++++++++++++-------------= ---- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 164e7c6125ae..0abfeeb89425 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -270,6 +270,11 @@ struct imx283_scanout { =20 /* Optical Blanking */ u8 vertical_ob; + + /* Vertical Arbitrary Cropping Function */ + u16 vst; + u16 vct; + u16 veff; }; =20 static const struct imx283_scanout imx283_scan_modes[] =3D { @@ -278,21 +283,33 @@ static const struct imx283_scanout imx283_scan_modes[= ] =3D { .bpp =3D 12, .readout =3D { 0x04, 0x03, 0x10, 0x00 }, .vertical_ob =3D 16, + .vst =3D 0, + .vct =3D 0, + .veff =3D 3694, }, [IMX283_MODE_1] =3D { .bpp =3D 10, .readout =3D { 0x04, 0x01, 0x00, 0x00 }, .vertical_ob =3D 16, + .vst =3D 0, + .vct =3D 0, + .veff =3D 3694, }, [IMX283_MODE_1A] =3D { .bpp =3D 10, .readout =3D { 0x04, 0x01, 0x20, 0x50 }, .vertical_ob =3D 16, + .vst =3D 146, + .vct =3D 291, + .veff =3D 3112, }, [IMX283_MODE_1S] =3D { .bpp =3D 10, .readout =3D { 0x04, 0x41, 0x20, 0x50 }, .vertical_ob =3D 16, + .vst =3D 162, + .vct =3D 324, + .veff =3D 3046, }, =20 /* Horizontal / Vertical 2/2-line binning */ @@ -300,11 +317,17 @@ static const struct imx283_scanout imx283_scan_modes[= ] =3D { .bpp =3D 12, .readout =3D { 0x0d, 0x11, 0x50, 0x00 }, .vertical_ob =3D 4, + .vst =3D 0, + .vct =3D 0, + .veff =3D 1824, }, [IMX283_MODE_2A] =3D { .bpp =3D 12, .readout =3D { 0x0d, 0x11, 0x70, 0x50 }, .vertical_ob =3D 4, + .vst =3D 71, + .vct =3D 143, + .veff =3D 1556, }, =20 /* Horizontal / Vertical 3/3-line binning */ @@ -312,6 +335,9 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x1e, 0x18, 0x10, 0x00 }, .vertical_ob =3D 4, + .vst =3D 0, + .vct =3D 0, + .veff =3D 1234, }, =20 /* Vertical 2/9 subsampling, horizontal 3 binning cropping */ @@ -319,6 +345,9 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x29, 0x18, 0x30, 0x50 }, .vertical_ob =3D 4, + .vst =3D 9, + .vct =3D 17, + .veff =3D 378, }, =20 /* Vertical 2/19 subsampling binning, horizontal 3 binning */ @@ -326,6 +355,9 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x2d, 0x18, 0x10, 0x00 }, .vertical_ob =3D 4, + .vst =3D 0, + .vct =3D 0, + .veff =3D 198, }, =20 /* Vertical 2 binning horizontal 2/4, subsampling 16:9 cropping */ @@ -333,6 +365,9 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 10, .readout =3D { 0x18, 0x21, 0x00, 0x09 }, .vertical_ob =3D 4, + .vst =3D 0, + .vct =3D 0, + .veff =3D 1556, }, =20 /* @@ -382,14 +417,6 @@ struct imx283_mode { /* minimum SHR */ u32 min_shr; =20 - /* - * Per-mode vertical crop constants used to calculate values - * of IMX283REG_WIDCUT and IMX283_REG_VWINPOS. - */ - u32 veff; - u32 vst; - u32 vct; - /* Horizontal and vertical binning ratio */ u8 hbin_ratio; u8 vbin_ratio; @@ -463,10 +490,6 @@ static const struct imx283_mode supported_modes_12bit[= ] =3D { .min_hmax =3D 5914, /* 887 @ 480MHz/72MHz */ .min_vmax =3D 3793, /* Lines */ =20 - .veff =3D 3694, - .vst =3D 0, - .vct =3D 0, - .hbin_ratio =3D 1, .vbin_ratio =3D 1, =20 @@ -496,10 +519,6 @@ static const struct imx283_mode supported_modes_12bit[= ] =3D { .default_hmax =3D 2500, /* 375 @ 480MHz/72Mhz */ .default_vmax =3D 3840, =20 - .veff =3D 1824, - .vst =3D 0, - .vct =3D 0, - .hbin_ratio =3D 2, .vbin_ratio =3D 2, =20 @@ -526,10 +545,6 @@ static const struct imx283_mode supported_modes_12bit[= ] =3D { .default_hmax =3D 1900, /* 285 @ 480MHz/72Mhz */ .default_vmax =3D 4200, =20 - .veff =3D 1234, - .vst =3D 0, - .vct =3D 0, - .hbin_ratio =3D 3, .vbin_ratio =3D 3, =20 @@ -1144,9 +1159,9 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, * cropping width =3D Veff =E2=80=93 (VWIDCUT =E2=80=93 Vct) =C3=97 2 */ v_pos =3D imx283->vflip->val ? - ((-mode->crop.top / mode->vbin_ratio) / 2) + mode->vst : - ((mode->crop.top / mode->vbin_ratio) / 2) + mode->vst; - v_widcut =3D ((mode->veff - y_out_size) / 2) + mode->vct; + ((-mode->crop.top / mode->vbin_ratio) / 2) + mode->scan->vst : + ((mode->crop.top / mode->vbin_ratio) / 2) + mode->scan->vst; + v_widcut =3D ((mode->scan->veff - y_out_size) / 2) + mode->scan->vct; =20 cci_write(imx283->cci, IMX283_REG_Y_OUT_SIZE, y_out_size, &ret); cci_write(imx283->cci, IMX283_REG_WRITE_VSIZE, write_v_size, &ret); --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EBBC361DC1; Fri, 13 Feb 2026 14:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991340; cv=none; b=LxRfOR2XwhT38rEUDuC7rJkJeqcNUnpx0HHVvGdJxZOE2h8b/1YO9XI0yaVP5+4+A0XskSet1PXh1teH4SLuZVBb1NBa1VBL2+5ZjiukPARzTUoSTXVPrI8IsZc+kTw7mBsVQjgWZySAp1Map++zofeKlA40kHFck6pjUY6ULnI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991340; c=relaxed/simple; bh=78T0LnvdtFFAIIJ76DTX3FnmfK0GiECbM3UInTJHW6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=K/s25G0VGp9rc0nIz0rFhwQHf88m4XbHqifoHb6yTF72DKIxw3yxmr3FlWGErmHLr6vaN0PphthporPB6dMDSrqO8fJsE55aHG5enTzgD+rxbppMWy9aMSns2UkPF0jGw0fsmNg5J57kHzdbupGGdyAVSB4TdKmUKMA6JDv/r9M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=uJrG526K; arc=none smtp.client-ip=213.167.242.64 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.b="uJrG526K" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EBE5026AB; Fri, 13 Feb 2026 15:01:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991280; bh=78T0LnvdtFFAIIJ76DTX3FnmfK0GiECbM3UInTJHW6k=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uJrG526Kecp6EwNlLldMFPe8w3p2Ll4OaSybboJMHtTSeWU41Pk8mbxiTmHqqayqO IMNwbkb2Vd6By3aANC/ojAT0ydMvLcS8ohrW8a4bVxH7TrM88Q3U/v9wyXWs7OvxZ6 LWQT4uG38fRgBEXo2n0aGen1VvcUnxHOfjLmVY+k= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:47 +0000 Subject: [PATCH v2 08/25] media: i2c: imx283: Vertical offset corrections Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-8-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1732; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=78T0LnvdtFFAIIJ76DTX3FnmfK0GiECbM3UInTJHW6k=; b=w1mBCiTuVlkcEvJ4bPG9AUuv7v4cQ+MoLQ/vOyYg6iR1VHXJDSDJUR+tW/NFAoJLOMbm/cEhX Ai67ZNTCI1BAS5PZ88RNGQzqgvwN9WJom4Il7EraZ7j5klGQXcE3Cb7 X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The IMX283 has different vertical offsets when applying binning modes. To provide consistent framing in each mode - ensure that the offsets measured are accounted for. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 0abfeeb89425..95f93ee0747f 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -272,7 +272,7 @@ struct imx283_scanout { u8 vertical_ob; =20 /* Vertical Arbitrary Cropping Function */ - u16 vst; + s16 vst; u16 vct; u16 veff; }; @@ -283,7 +283,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x04, 0x03, 0x10, 0x00 }, .vertical_ob =3D 16, - .vst =3D 0, + .vst =3D -1, /* Align to Mode 2/3 */ .vct =3D 0, .veff =3D 3694, }, @@ -291,7 +291,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 10, .readout =3D { 0x04, 0x01, 0x00, 0x00 }, .vertical_ob =3D 16, - .vst =3D 0, + .vst =3D -1, /* Align to Mode 2/3 */ .vct =3D 0, .veff =3D 3694, }, @@ -317,7 +317,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x0d, 0x11, 0x50, 0x00 }, .vertical_ob =3D 4, - .vst =3D 0, + .vst =3D -2, /* Provides alignment to Mode 0/1 */ .vct =3D 0, .veff =3D 1824, }, @@ -335,7 +335,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x1e, 0x18, 0x10, 0x00 }, .vertical_ob =3D 4, - .vst =3D 0, + .vst =3D 1, /* Provides alignment to Mode 0/1 */ .vct =3D 0, .veff =3D 1234, }, --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D54D23624A3; Fri, 13 Feb 2026 14:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991348; cv=none; b=ojgt5fn/1McL8oN00whWthFEaSOvB+2PxPezd62uQ+RZozXayvPYmo+6tlkniReXN4sk+4XRC8BX0+FSr5rvaSABphCeFPwUOry0oUk9vpU+gWMYJ9qM0dpn6mohX5CUMT5pbpdm286hVapeMKu9sSFF350BKo9Xq1bS4Iurlx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991348; c=relaxed/simple; bh=sB8Itc28fEfjUIVxNRQYfIOTT0ffhtlQFZ4N6tgI0kc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AVXJeKwh27uv8m7mb4YAQz2fS3JSEsOgCastCOPeL4B9e+i5dLTdQRw5Z7wDfTicYBkewco45sZoo6QQpbzSkHTX9QMsCs7VZleSCIOQL6EypNNKfmo3jdtY/hc+Xm0GagExFr6i3HRUBrrIQAhGC8i9VPmTy/9nokYlKjFehU8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=VcBK1QWI; arc=none smtp.client-ip=213.167.242.64 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.b="VcBK1QWI" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5084C26C4; Fri, 13 Feb 2026 15:01:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991280; bh=sB8Itc28fEfjUIVxNRQYfIOTT0ffhtlQFZ4N6tgI0kc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VcBK1QWIWhFmtCh7xs2o9+AgcPewN1Vr3O5HeLK6qW6QbrqSsG6Oqx19FvyOuI44d qLISJZtbt94Y17nGWeIGl4WSmfS+5k+8pr4ke6MGf7UtKf2JJe4D+MuC6XINxQ96YX yTRMd8ckXlqcVLeX79/go/qEpHflxraS7IWK5j44= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:48 +0000 Subject: [PATCH v2 09/25] media: i2c: imx283: Define recommended area Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-9-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=2448; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=sB8Itc28fEfjUIVxNRQYfIOTT0ffhtlQFZ4N6tgI0kc=; b=rb3U0C690n7vRSMJjjEENVTgex+KjmSzvFg3VJOwpOAggUCVwrfB7OgSsjes02CDxHm4Gb1cI QJsilRae41JBMdaRTqvvjJKOaCzwrBCod+C/EYk/zAfYcYUL5bMIdxk X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Provide a common reference for the recommended recording area to use in each of the binning modes. No functional change intended in this commit. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 44 +++++++++++++++++-------------------------= -- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 95f93ee0747f..32b8070756f0 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -175,7 +175,7 @@ #define IMX283_XCLR_MIN_DELAY_US (1 * USEC_PER_MSEC) #define IMX283_XCLR_DELAY_RANGE_US (1 * USEC_PER_MSEC) =20 -/* IMX283 native and active pixel array size. */ +/* IMX283 crop regions and positions */ static const struct v4l2_rect imx283_native_area =3D { .top =3D 0, .left =3D 0, @@ -184,8 +184,16 @@ static const struct v4l2_rect imx283_native_area =3D { }; =20 static const struct v4l2_rect imx283_active_area =3D { - .top =3D 40, - .left =3D 108, + .top =3D 16, + .left =3D 96, + .width =3D 5496, + .height =3D 3694, +}; + +/* Datasheet recommended recording pixels */ +static const struct v4l2_rect imx283_recommended_area =3D { + .top =3D 16 + 12 + 12, /* Clamp, Ignored area, Color margin */ + .left =3D 96 + 12, /* Horizontal black, Color margin */ .width =3D 5472, .height =3D 3648, }; @@ -498,12 +506,8 @@ static const struct imx283_mode supported_modes_12bit[= ] =3D { .default_vmax =3D 4000, =20 .min_shr =3D 11, - .crop =3D { - .top =3D 40, - .left =3D 108, - .width =3D 5472, - .height =3D 3648, - }, + + .crop =3D imx283_recommended_area, }, { /* @@ -524,12 +528,7 @@ static const struct imx283_mode supported_modes_12bit[= ] =3D { =20 .min_shr =3D 12, =20 - .crop =3D { - .top =3D 40, - .left =3D 108, - .width =3D 5472, - .height =3D 3648, - }, + .crop =3D imx283_recommended_area, }, { /* @@ -550,12 +549,7 @@ static const struct imx283_mode supported_modes_12bit[= ] =3D { =20 .min_shr =3D 16, =20 - .crop =3D { - .top =3D 40, - .left =3D 108, - .width =3D 5472, - .height =3D 3648, - }, + .crop =3D imx283_recommended_area, }, }; =20 @@ -573,12 +567,8 @@ static const struct imx283_mode supported_modes_10bit[= ] =3D { .default_vmax =3D 3840, =20 .min_shr =3D 10, - .crop =3D { - .top =3D 40, - .left =3D 108, - .width =3D 5472, - .height =3D 3648, - }, + + .crop =3D imx283_recommended_area, }, }; =20 --=20 2.52.0 From nobody Fri Apr 17 21:54:40 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E79A36165A; Fri, 13 Feb 2026 14:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991347; cv=none; b=g0325CzfboJVSIuETrO9zx3Y8RrY8WvWrLSUqQjfsCQD0xiaaqPAQu9WM4SMA8mQytDG1sI3IByUg4TJKbvviN6fhm19iSzx/OQHIQ9hlgerSv39UnZjddFVzduASbGLi+U8+w8oEO/k0TlQP1vcJIVPUdmBqqzMF0qNBUTgkB0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991347; c=relaxed/simple; bh=xNZjOVWHoFb2Y69Wyoo6hq9ClPD5Ha/Xtk0lMGTTphk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kFozKV+VcEI6FwnOXyOoMbI8AXOh4o1TEv/4D7/nWsbtTE42pVqW6bPfam4fG9fNq5wt4J6pqQOAm+DaH6/Nf9BDUhTxhKuC+9+QZw9cqxost4X1gE/vDOrk356f5RJHylztGZMzn6AwoWSFSMp/lHAruOngqrrnDy8V6H/STbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=VB3CiNOd; arc=none smtp.client-ip=213.167.242.64 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.b="VB3CiNOd" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A756926D1; Fri, 13 Feb 2026 15:01:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991280; bh=xNZjOVWHoFb2Y69Wyoo6hq9ClPD5Ha/Xtk0lMGTTphk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VB3CiNOdF+YAgIUOtPgl7R0d0c/VbZbSU+eg+YJeQLEr4T7vGpCYbhdsnr4gLdrRK 0unPyQRXNvtKVd389ed/xUfzljS2BC0EkF/JRLXwdWkP768pIBRXDokpQTiQ0nLA2u fG7agD21UYvyOl815htsPkd64x7l/l4xfAg3flU4= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:49 +0000 Subject: [PATCH v2 10/25] media: i2c: imx283: Move Horizontal configuration block Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-10-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1490; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=xNZjOVWHoFb2Y69Wyoo6hq9ClPD5Ha/Xtk0lMGTTphk=; b=+GPowK9not4gbVozsibvKOW/5L3aXeMIUXC4Cbp54WSOxhQP3u7/AOyGFQplJl2FaEQJN0Uy3 R095vzjpzlkALJNbI25ZKzjV7YJ8lJr6AyOgoPMvQOOKz2b9pliOuI6 X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Adapt the Horiztonal configuration into its own scope to improve readability of these two associated register configurations. No functional change intended in this commit. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 32b8070756f0..6d551a26cfa6 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -1160,10 +1160,19 @@ static int imx283_start_streaming(struct imx283 *im= x283, =20 cci_write(imx283->cci, IMX283_REG_OB_SIZE_V, mode->scan->vertical_ob, &re= t); =20 - /* TODO: Validate mode->crop is fully contained within imx283_native_area= */ - cci_write(imx283->cci, IMX283_REG_HTRIMMING_START, mode->crop.left, &ret); - cci_write(imx283->cci, IMX283_REG_HTRIMMING_END, - mode->crop.left + mode->crop.width, &ret); + /* Horizontal Configuration */ + { + /* + * While Vertical OB is excluded from the sensor positions, + * the Horizontal OB is included within the whole HTRIMMING + * calculation. + */ + u32 left =3D mode->crop.left; + u32 right =3D left + mode->crop.width; + + cci_write(imx283->cci, IMX283_REG_HTRIMMING_START, left, &ret); + cci_write(imx283->cci, IMX283_REG_HTRIMMING_END, right, &ret); + } =20 /* Disable embedded data */ cci_write(imx283->cci, IMX283_REG_EBD_X_OUT_SIZE, 0, &ret); --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59BB635FF49; Fri, 13 Feb 2026 14:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991353; cv=none; b=sN3o3VjxHEKHZN0EirgZbsCnZFKuuoJQ5D03tU6vDC3cGGSgxLLC62x0MCR1bqMSB9ClSnL0w/HKTJ05tij1sNt153yJoLIs2LtPjWQ19WmVlfw3N8I2qvDOks/gbqbKAelHlnDWVgeuZoN6lrLS56ceaw33d644PDS2Ve8Ggy8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991353; c=relaxed/simple; bh=s+KUR5jF5nSLHidI7PHEpfH18Z5QECf10D7XGlPboB0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VX42DvUL+kMLCnB2/uCNYBpNQ5KcnOsI4ED+fFSsYxvOPQ1u/jb2ZQaYiQCaNb4J9kefXOOwIqVwfdhfG/zDV0/xpgYQO9ZlDR+/X19WM3xxbK0CUpCCiHPG9ZHwfBaNDx9ttJ9ppOnFqHQnGe6Uw1a/tVBJ4Rekfo8i5CIUqfg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=u4jByHze; arc=none smtp.client-ip=213.167.242.64 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.b="u4jByHze" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0DFD026D2; Fri, 13 Feb 2026 15:01:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991281; bh=s+KUR5jF5nSLHidI7PHEpfH18Z5QECf10D7XGlPboB0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=u4jByHzeuqzpjhDn4Nt0iPy2W5LMoBxF4OYuocfWchKVkJjD6/Mm3edMLL/6HRarI 1u6xKMbB3gsA36YaH+pbSHyzEvcCmw8cKy9HY5YzBjOOAatXjtALaZj52lg8GHzbAU D7cQDSVHyTBCSjkjaX7kbWWmKaf2/YlaAcyxchK4= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:50 +0000 Subject: [PATCH v2 11/25] media: i2c: imx283: Constrain scope of vertical calculations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-11-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=2862; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=s+KUR5jF5nSLHidI7PHEpfH18Z5QECf10D7XGlPboB0=; b=DaA7hbEhtDcBmDTnUp356SuDFJ1GrXU2sA6uUt/mHi67w3e2EWTTcaQnxW8ll5xSAfqWkCzDi t8AzRKhinu/BHePWEzB23A8PxsPvVCIF/LMgaOG+3UmNGwuNhitfq0i X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Reduce the scope of the 5 registers used for vertical positioning to make it easier to maintain and calculate the exact vertical configuration. No functional changes intended in this patch, which simplifies later development. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 6d551a26cfa6..f115a6df7b31 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -1092,10 +1092,7 @@ static int imx283_start_streaming(struct imx283 *imx= 283, const struct v4l2_mbus_framefmt *fmt; const struct imx283_mode *mode_list; unsigned int num_modes; - u32 v_widcut; - s32 v_pos; - u32 write_v_size; - u32 y_out_size; + int ret =3D 0; =20 fmt =3D v4l2_subdev_state_get_format(state, 0); @@ -1142,23 +1139,29 @@ static int imx283_start_streaming(struct imx283 *im= x283, mode->crop.width, mode->crop.height); =20 - y_out_size =3D mode->crop.height / mode->vbin_ratio; - write_v_size =3D y_out_size + mode->scan->vertical_ob; - /* - * cropping start position =3D (VWINPOS =E2=80=93 Vst) =C3=97 2 - * cropping width =3D Veff =E2=80=93 (VWIDCUT =E2=80=93 Vct) =C3=97 2 - */ - v_pos =3D imx283->vflip->val ? - ((-mode->crop.top / mode->vbin_ratio) / 2) + mode->scan->vst : - ((mode->crop.top / mode->vbin_ratio) / 2) + mode->scan->vst; - v_widcut =3D ((mode->scan->veff - y_out_size) / 2) + mode->scan->vct; + /* Vertical Configuration */ + { + u32 y_out_size =3D mode->crop.height / mode->vbin_ratio; + u32 write_v_size =3D y_out_size + mode->scan->vertical_ob; + u32 v_widcut; + s32 v_pos; =20 - cci_write(imx283->cci, IMX283_REG_Y_OUT_SIZE, y_out_size, &ret); - cci_write(imx283->cci, IMX283_REG_WRITE_VSIZE, write_v_size, &ret); - cci_write(imx283->cci, IMX283_REG_VWIDCUT, v_widcut, &ret); - cci_write(imx283->cci, IMX283_REG_VWINPOS, v_pos, &ret); + /* + * cropping start position =3D (VWINPOS =E2=80=93 Vst) =C3=97 2 + * cropping width =3D Veff =E2=80=93 (VWIDCUT =E2=80=93 Vct) =C3=97 2 + */ + v_pos =3D imx283->vflip->val ? + ((-mode->crop.top / mode->vbin_ratio) / 2) + mode->scan->vst : + ((mode->crop.top / mode->vbin_ratio) / 2) + mode->scan->vst; + v_widcut =3D ((mode->scan->veff - y_out_size) / 2) + mode->scan->vct; =20 - cci_write(imx283->cci, IMX283_REG_OB_SIZE_V, mode->scan->vertical_ob, &re= t); + cci_write(imx283->cci, IMX283_REG_Y_OUT_SIZE, y_out_size, &ret); + cci_write(imx283->cci, IMX283_REG_WRITE_VSIZE, write_v_size, &ret); + cci_write(imx283->cci, IMX283_REG_VWIDCUT, v_widcut, &ret); + cci_write(imx283->cci, IMX283_REG_VWINPOS, v_pos, &ret); + + cci_write(imx283->cci, IMX283_REG_OB_SIZE_V, mode->scan->vertical_ob, &r= et); + } =20 /* Horizontal Configuration */ { --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59C3B362136; Fri, 13 Feb 2026 14:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991356; cv=none; b=nXYs11CGagS66tODLGTWnfLCx9o9qVZzzzQa4JYMKx1bqq9469Yu0Qi4/lAMi0kZH4h7a9HOmrw8X9/z877xPsQu1Lf3cDm9uESw/dWfoEcIpQLa0RUcZE7ff9iJFdQg55MMiBAQ4CCR5VBxtPp7kWBwic49IfzmyhmnuyOKJOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991356; c=relaxed/simple; bh=ZtvCdLXKH0xCm3KsKiK5I+ap6byNDfS/xiw525xrPnA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aaGnBJUFaH4/U116JVX3IGF364UAXNF4R+vFqHVkMX8IcANThd2TRGIbJn2Kn3tQP4BOL/+wH7IjNEMxucObmjNm4HUrX/cC6ckHW0qJJBsYLhocedpfYcYfaQXxNkSOh6QDU5Fu1jCXcig6bUl3Sy7z2Iw8jvPW+NYKV9WS1H8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=WnEodnX4; arc=none smtp.client-ip=213.167.242.64 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.b="WnEodnX4" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 68BA326D6; Fri, 13 Feb 2026 15:01:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991281; bh=ZtvCdLXKH0xCm3KsKiK5I+ap6byNDfS/xiw525xrPnA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=WnEodnX4dV6UKzpbny30GT/QiTvMrzZ93FJEV1XKNE7T+uNlGAiUppNRzp4iBT+T8 2s3RFcONfu61O+LuAyfbuHSVDm+CuBbjl+2C9Dzff9thqHMtuXTNnQXqxcZxlmz/Il ryKDi8LviVCmY568hWAJcKH2Khu+gh73vOw/3Qnw= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:51 +0000 Subject: [PATCH v2 12/25] media: i2c: imx283: Simplify v_pos determination Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-12-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1313; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=ZtvCdLXKH0xCm3KsKiK5I+ap6byNDfS/xiw525xrPnA=; b=WinTCBBeb/J0Nc/0tRlU6B1OfSJzFn4dzgKcUUMyOxFWxHoaF11UaUBcXSAYorZ1IPtjewYTm FStaEzowQNlB34gmNKmgjRSy+GeJm8tfJz4j+cUgXdJCuDaW+rZajX8 X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Refactor the v_pos to separate out the vflip handling from the top coordinate. No functional change is intended in this commit. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index f115a6df7b31..315c050c4fd0 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -1143,16 +1143,18 @@ static int imx283_start_streaming(struct imx283 *im= x283, { u32 y_out_size =3D mode->crop.height / mode->vbin_ratio; u32 write_v_size =3D y_out_size + mode->scan->vertical_ob; + s16 top =3D mode->crop.top; u32 v_widcut; s32 v_pos; =20 + if (imx283->vflip->val) + top =3D -top; + /* * cropping start position =3D (VWINPOS =E2=80=93 Vst) =C3=97 2 * cropping width =3D Veff =E2=80=93 (VWIDCUT =E2=80=93 Vct) =C3=97 2 */ - v_pos =3D imx283->vflip->val ? - ((-mode->crop.top / mode->vbin_ratio) / 2) + mode->scan->vst : - ((mode->crop.top / mode->vbin_ratio) / 2) + mode->scan->vst; + v_pos =3D (top / mode->vbin_ratio / 2) + mode->scan->vst; v_widcut =3D ((mode->scan->veff - y_out_size) / 2) + mode->scan->vct; =20 cci_write(imx283->cci, IMX283_REG_Y_OUT_SIZE, y_out_size, &ret); --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12DEE361DCB; Fri, 13 Feb 2026 14:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991360; cv=none; b=k7CyTAKfRYhr5Psdrj8UmkiuohgEP7GOCA0KGwfEaD9TDBzshdfrwMWxMUyQUL/xe3AqdRibQHXkiPLCk5Zd46XtHxluFbA6FRSEyGTS+xcrV/wmRX5+xhdQiIBmN11ErV/xNaTICdhmu8HtgmPUoQZ/HQse7fAtA4fVSCCQp+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991360; c=relaxed/simple; bh=1fJehNgR9AP4Hz4vI57ZNjlZUsjrjJpB+iMudQZmCWA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JRtactWG1gZqHypPQFkb4RU+/5G45HYORMyrxp16CjLwqh2pid/9XYVoR5yvZVWsMnio0tq+/g85uXPFf1eYF5avMU4D8d/SY7xmiqPePftU2Bm3F0QFwbuxitprm1Lr52BxoB2w4AWjB3viyz7lBpcJuvYzkGFpOAhcadw7Fgo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=O9X40Hu2; arc=none smtp.client-ip=213.167.242.64 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.b="O9X40Hu2" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C316F26D7; Fri, 13 Feb 2026 15:01:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991282; bh=1fJehNgR9AP4Hz4vI57ZNjlZUsjrjJpB+iMudQZmCWA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=O9X40Hu2ZqsYyxb8uO4VGIR4LDZJzmxN1up+tfE/Fv+XJ4jtQIxToursOViv7RZBs Qoyl7Q0ePitiMDC+h4FRKZuRvH5mw91mPuX74IZWwY3kCxdHKqbfTMxoz38iXu1Qu7 URi+cu+O1CunfdiuR5gpcWBDBoPq5ypd24pf/Psk= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:52 +0000 Subject: [PATCH v2 13/25] media: i2c: imx283: Move binning to scan modes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-13-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=5543; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=1fJehNgR9AP4Hz4vI57ZNjlZUsjrjJpB+iMudQZmCWA=; b=FHj7toex3LVko2emBk2u5pO2qkqC/OOuOGX5Kzzuns8KhwIsh0HPfWhZfVFgYnYqYEXNfH4Rv A7sniSY+DZKDeBjnRMenWEEEoZ/vBnx4QluEMNBh8G5bhndFPmEY+qE X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The binning factors are determined by the chosen scan mode. Move the definition of the binning ratio to the scan mode strutures and remove from the v4l2 output mode definitions. The horizontal binning ratio is not used and therefore is dropped. This also fixes the 10-bit mode handling which previously had an undefined vbin_ratio for MODE1. V4L2 does not currently expose an API to support the differences between binning and skipping, so while the mode capabilities are kept for the skipping modes - there is no definition to use them yet. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 315c050c4fd0..d333be4e66d7 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -279,6 +279,9 @@ struct imx283_scanout { /* Optical Blanking */ u8 vertical_ob; =20 + /* vertical binning ratio */ + u8 vbin_ratio; + /* Vertical Arbitrary Cropping Function */ s16 vst; u16 vct; @@ -291,6 +294,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x04, 0x03, 0x10, 0x00 }, .vertical_ob =3D 16, + .vbin_ratio =3D 1, .vst =3D -1, /* Align to Mode 2/3 */ .vct =3D 0, .veff =3D 3694, @@ -299,6 +303,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 10, .readout =3D { 0x04, 0x01, 0x00, 0x00 }, .vertical_ob =3D 16, + .vbin_ratio =3D 1, .vst =3D -1, /* Align to Mode 2/3 */ .vct =3D 0, .veff =3D 3694, @@ -307,6 +312,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 10, .readout =3D { 0x04, 0x01, 0x20, 0x50 }, .vertical_ob =3D 16, + .vbin_ratio =3D 1, .vst =3D 146, .vct =3D 291, .veff =3D 3112, @@ -315,6 +321,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 10, .readout =3D { 0x04, 0x41, 0x20, 0x50 }, .vertical_ob =3D 16, + .vbin_ratio =3D 1, .vst =3D 162, .vct =3D 324, .veff =3D 3046, @@ -325,6 +332,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x0d, 0x11, 0x50, 0x00 }, .vertical_ob =3D 4, + .vbin_ratio =3D 2, .vst =3D -2, /* Provides alignment to Mode 0/1 */ .vct =3D 0, .veff =3D 1824, @@ -333,6 +341,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x0d, 0x11, 0x70, 0x50 }, .vertical_ob =3D 4, + .vbin_ratio =3D 2, .vst =3D 71, .vct =3D 143, .veff =3D 1556, @@ -343,6 +352,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x1e, 0x18, 0x10, 0x00 }, .vertical_ob =3D 4, + .vbin_ratio =3D 3, .vst =3D 1, /* Provides alignment to Mode 0/1 */ .vct =3D 0, .veff =3D 1234, @@ -353,6 +363,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x29, 0x18, 0x30, 0x50 }, .vertical_ob =3D 4, + .vbin_ratio =3D 1, /* SUBSAMPLING UNDEFINED */ .vst =3D 9, .vct =3D 17, .veff =3D 378, @@ -363,6 +374,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 12, .readout =3D { 0x2d, 0x18, 0x10, 0x00 }, .vertical_ob =3D 4, + .vbin_ratio =3D 1, /* SUBSAMPLING UNDEFINED */ .vst =3D 0, .vct =3D 0, .veff =3D 198, @@ -373,6 +385,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .bpp =3D 10, .readout =3D { 0x18, 0x21, 0x00, 0x09 }, .vertical_ob =3D 4, + .vbin_ratio =3D 2, /* SUBSAMPLING UNDEFINED */ .vst =3D 0, .vct =3D 0, .veff =3D 1556, @@ -425,10 +438,6 @@ struct imx283_mode { /* minimum SHR */ u32 min_shr; =20 - /* Horizontal and vertical binning ratio */ - u8 hbin_ratio; - u8 vbin_ratio; - /* Analog crop rectangle. */ struct v4l2_rect crop; }; @@ -498,9 +507,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .min_hmax =3D 5914, /* 887 @ 480MHz/72MHz */ .min_vmax =3D 3793, /* Lines */ =20 - .hbin_ratio =3D 1, - .vbin_ratio =3D 1, - /* 20.00 FPS */ .default_hmax =3D 6000, /* 900 @ 480MHz/72MHz */ .default_vmax =3D 4000, @@ -523,9 +529,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .default_hmax =3D 2500, /* 375 @ 480MHz/72Mhz */ .default_vmax =3D 3840, =20 - .hbin_ratio =3D 2, - .vbin_ratio =3D 2, - .min_shr =3D 12, =20 .crop =3D imx283_recommended_area, @@ -544,9 +547,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .default_hmax =3D 1900, /* 285 @ 480MHz/72Mhz */ .default_vmax =3D 4200, =20 - .hbin_ratio =3D 3, - .vbin_ratio =3D 3, - .min_shr =3D 16, =20 .crop =3D imx283_recommended_area, @@ -1141,7 +1141,7 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, =20 /* Vertical Configuration */ { - u32 y_out_size =3D mode->crop.height / mode->vbin_ratio; + u32 y_out_size =3D mode->crop.height / mode->scan->vbin_ratio; u32 write_v_size =3D y_out_size + mode->scan->vertical_ob; s16 top =3D mode->crop.top; u32 v_widcut; @@ -1154,7 +1154,7 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, * cropping start position =3D (VWINPOS =E2=80=93 Vst) =C3=97 2 * cropping width =3D Veff =E2=80=93 (VWIDCUT =E2=80=93 Vct) =C3=97 2 */ - v_pos =3D (top / mode->vbin_ratio / 2) + mode->scan->vst; + v_pos =3D (top / mode->scan->vbin_ratio / 2) + mode->scan->vst; v_widcut =3D ((mode->scan->veff - y_out_size) / 2) + mode->scan->vct; =20 cci_write(imx283->cci, IMX283_REG_Y_OUT_SIZE, y_out_size, &ret); --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82C2F361676; Fri, 13 Feb 2026 14:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991362; cv=none; b=pg6LoemkysbhIVyDdNchRfcqj6W5lNhVX9Zucxjvt5Hhx/smyvT4MDH7pvSfcQC2NN6oRscEevj7sQFGlf+1IBaf/3tSFerufBptRj5BlJpTvGoheIuDbvVZIf6xbYEm8wm4tdcCBhrxZKwKsQKd99oKd/rbdLPb2b7P3TZzn/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991362; c=relaxed/simple; bh=eHhrdPEgO5CSfV7eghEybV6KvOAKJ2nsvsWWwSSnwQU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X1bs/ZHWRMVsRWob3VdmH/WJECW3pMlL5e5UON10PyEsZZvtih7ERIRu7D/oW4OcPjHhQTRTo/zWk4LgNjMHOHpfA6rTogQXBDfZNyTWd9icj4mf+crGGZpvAkAgEEMDeOC7zMj6GAKwDo1gcyWk6WzTqfqhlRIll62VVSe+IAo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Rj3lJC1w; arc=none smtp.client-ip=213.167.242.64 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.b="Rj3lJC1w" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 34B912704; Fri, 13 Feb 2026 15:01:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991282; bh=eHhrdPEgO5CSfV7eghEybV6KvOAKJ2nsvsWWwSSnwQU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Rj3lJC1wHmFr0+ggIHssAZqS9+qJQp4LeM4d1kJX+pO1gDQty7ebArKykAJfZXoYG SOcxRLLXFB3hbi+muMUh+sDiuCfxbZZcXqEs6IQSb1hnBaOXizHGVEuHzj0+4fe0WN adhSGIYboeruxVEZpHtxhacdNmqzfF6zOX71C50k= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:53 +0000 Subject: [PATCH v2 14/25] media: i2c: imx283: Move minimum exposure handling to scan modes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-14-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=4365; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=eHhrdPEgO5CSfV7eghEybV6KvOAKJ2nsvsWWwSSnwQU=; b=Z8rjX0zf+5QyLaak7zXBB9NY5fhTNcIgxn2rzGMuJUTJRMoP5tVe0H5w42WlU6E6MLHa4vvKT mQztDLSPEpOCtT1PQ5T0zpD3CqryBjhnDfdQ/u+onb+pppOa7sBZCMH X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The minimum exposure is a factor of the scan mode. Move the definitions of the minimum exposure timeto the scan mode structures and clean up the duplication from the v4l2 output mode definitions. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index d333be4e66d7..6c2be9195cba 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -286,6 +286,9 @@ struct imx283_scanout { s16 vst; u16 vct; u16 veff; + + /* minimum SHR */ + u32 min_shr; }; =20 static const struct imx283_scanout imx283_scan_modes[] =3D { @@ -298,6 +301,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D -1, /* Align to Mode 2/3 */ .vct =3D 0, .veff =3D 3694, + .min_shr =3D 11, }, [IMX283_MODE_1] =3D { .bpp =3D 10, @@ -307,6 +311,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D -1, /* Align to Mode 2/3 */ .vct =3D 0, .veff =3D 3694, + .min_shr =3D 10, }, [IMX283_MODE_1A] =3D { .bpp =3D 10, @@ -316,6 +321,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D 146, .vct =3D 291, .veff =3D 3112, + .min_shr =3D 10, }, [IMX283_MODE_1S] =3D { .bpp =3D 10, @@ -325,6 +331,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D 162, .vct =3D 324, .veff =3D 3046, + .min_shr =3D 10, }, =20 /* Horizontal / Vertical 2/2-line binning */ @@ -336,6 +343,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D -2, /* Provides alignment to Mode 0/1 */ .vct =3D 0, .veff =3D 1824, + .min_shr =3D 12, }, [IMX283_MODE_2A] =3D { .bpp =3D 12, @@ -345,6 +353,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D 71, .vct =3D 143, .veff =3D 1556, + .min_shr =3D 12, }, =20 /* Horizontal / Vertical 3/3-line binning */ @@ -356,6 +365,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D 1, /* Provides alignment to Mode 0/1 */ .vct =3D 0, .veff =3D 1234, + .min_shr =3D 16, }, =20 /* Vertical 2/9 subsampling, horizontal 3 binning cropping */ @@ -367,6 +377,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D 9, .vct =3D 17, .veff =3D 378, + .min_shr =3D 4, }, =20 /* Vertical 2/19 subsampling binning, horizontal 3 binning */ @@ -378,6 +389,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D 0, .vct =3D 0, .veff =3D 198, + .min_shr =3D 4, }, =20 /* Vertical 2 binning horizontal 2/4, subsampling 16:9 cropping */ @@ -389,6 +401,7 @@ static const struct imx283_scanout imx283_scan_modes[] = =3D { .vst =3D 0, .vct =3D 0, .veff =3D 1556, + .min_shr =3D 12, }, =20 /* @@ -435,9 +448,6 @@ struct imx283_mode { /* default V-timing */ u32 default_vmax; =20 - /* minimum SHR */ - u32 min_shr; - /* Analog crop rectangle. */ struct v4l2_rect crop; }; @@ -511,8 +521,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .default_hmax =3D 6000, /* 900 @ 480MHz/72MHz */ .default_vmax =3D 4000, =20 - .min_shr =3D 11, - .crop =3D imx283_recommended_area, }, { @@ -529,8 +537,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .default_hmax =3D 2500, /* 375 @ 480MHz/72Mhz */ .default_vmax =3D 3840, =20 - .min_shr =3D 12, - .crop =3D imx283_recommended_area, }, { @@ -547,8 +553,6 @@ static const struct imx283_mode supported_modes_12bit[]= =3D { .default_hmax =3D 1900, /* 285 @ 480MHz/72Mhz */ .default_vmax =3D 4200, =20 - .min_shr =3D 16, - .crop =3D imx283_recommended_area, }, }; @@ -566,8 +570,6 @@ static const struct imx283_mode supported_modes_10bit[]= =3D { .default_hmax =3D 6000, /* 750 @ 576MHz / 72MHz */ .default_vmax =3D 3840, =20 - .min_shr =3D 10, - .crop =3D imx283_recommended_area, }, }; @@ -726,7 +728,7 @@ static void imx283_exposure_limits(struct imx283 *imx28= 3, s64 *min_exposure, s64 *max_exposure) { u32 svr =3D 0; /* SVR feature is not currently supported */ - u64 min_shr =3D mode->min_shr; + u64 min_shr =3D mode->scan->min_shr; /* Global Shutter is not supported */ u64 max_shr =3D (svr + 1) * imx283->vmax - 4; =20 --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA55D36165A; Fri, 13 Feb 2026 14:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991363; cv=none; b=FXW7IONavOQnkpG6Y55UwbfC5Shvs9HPV1g+7R+ScINLjCxBeeEdhpuVcXccXq0G2GcJQjUtILvvIAQLdr/Tff6QOw6g075QrzUCMEM80nFHCG3alUq2vUJKiqIuc028tit0Xx+2UQiUm7Mny0XbzD8ELwRz94bhSrekEm62uc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991363; c=relaxed/simple; bh=awyvcL9zMDZdNR4Tc/jZ/sf7CjfFH0FtEDJ3re1DuvY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KtjQ6gartfxyEkJ9YI1B37jqM//A8CWMAedtvHaY+C3UMDI4NS9vJpzyDLKSdutP2tJYu5DaKiCGhIQi7GJv55+04lYkacSRNVmzD2pfGgl1B/d30cQ4bpXu6tpjmGMs5PUUKx1Z3RXs6bLsyd1OeD/FsuTVKqEttdhFpf9ZDxU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=S5H/IufR; arc=none smtp.client-ip=213.167.242.64 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.b="S5H/IufR" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8B55E2769; Fri, 13 Feb 2026 15:01:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991282; bh=awyvcL9zMDZdNR4Tc/jZ/sf7CjfFH0FtEDJ3re1DuvY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=S5H/IufRPjms/bYphNabuMrQ42M6M5HaFTdl9RqmLTKAbn2fryYCBIOkQiJWlfrZo 3oyPmT6HVdVYssy5uXgcAnpSRTjQt85LYyl6Z7k9t/rnGfn/rHuwZze7q2UDngdlab j3r2D+uciQ7x3cSkmDep+eKKU0GdtINXIw1GWg9E= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:54 +0000 Subject: [PATCH v2 15/25] media: i2c: imx283: Simplify and clamp widcut calculation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-15-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1457; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=awyvcL9zMDZdNR4Tc/jZ/sf7CjfFH0FtEDJ3re1DuvY=; b=RKs9GpI3+B6x5MPUV4NM9Ras+q4jDuBFDkFUSnnbwjNuTs+dNIIl1YZKlkN4qvCLCPrQazZmp YJQGlm2ELnDAPSx/s63ky5mL+J+uqNoU2p65Uk1UUYElT9fC+b5Ctxz X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The vertical handling cuts unused lines to restrict the output to the desired height. It can be valid to set y_outsize larger than the veff to include optical black regions in the visible image. Ensure that the cut is clamped to the veff to prevent underflow. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 6c2be9195cba..f9cf2bb0e10d 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -1145,7 +1145,11 @@ static int imx283_start_streaming(struct imx283 *imx= 283, { u32 y_out_size =3D mode->crop.height / mode->scan->vbin_ratio; u32 write_v_size =3D y_out_size + mode->scan->vertical_ob; + s16 top =3D mode->crop.top; + u16 veff =3D mode->scan->veff; + u16 cut =3D veff - min(veff, y_out_size); + u32 v_widcut; s32 v_pos; =20 @@ -1157,7 +1161,7 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, * cropping width =3D Veff =E2=80=93 (VWIDCUT =E2=80=93 Vct) =C3=97 2 */ v_pos =3D (top / mode->scan->vbin_ratio / 2) + mode->scan->vst; - v_widcut =3D ((mode->scan->veff - y_out_size) / 2) + mode->scan->vct; + v_widcut =3D (cut / 2) + mode->scan->vct; =20 cci_write(imx283->cci, IMX283_REG_Y_OUT_SIZE, y_out_size, &ret); cci_write(imx283->cci, IMX283_REG_WRITE_VSIZE, write_v_size, &ret); --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 236043612F4; Fri, 13 Feb 2026 14:02:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991365; cv=none; b=gfRKeq1+FjTaTeyExZSji76usxXN1vmpu6N+ykc+sF2cQLlsfUVO34DE0xrTyHSJZJeWDqY+NvmcKa+VXEs4WKzq3Y+4s/QeU5oQzjGUkgWkFeV6hSAx46HhhplHTFf9iFaVWBI4/MRm7q8oYiiXy98IYOFnHbYbhLG1XB3GwE4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991365; c=relaxed/simple; bh=FmcEYHQ1IfaibJAwBHqF/Cbl4nH/qotAV8i2TDcsS8E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GiQr9XJvgZjtjOqm8IMf+HrNeknO2v/W81sfJ3iou6mmNKul4CwZNMo7548w552eLgbXGfFZNEUp9M5U8wF6Krb94TPZC+6TuzugE1eIR8FMTPawRtY40F8jwpIYon3T64Rj8n0WBo22RovcvbVcY5VqKxXk9roQOGWk0YLCwps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=DpyjcpI1; arc=none smtp.client-ip=213.167.242.64 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.b="DpyjcpI1" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E8EF1276A; Fri, 13 Feb 2026 15:01:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991283; bh=FmcEYHQ1IfaibJAwBHqF/Cbl4nH/qotAV8i2TDcsS8E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=DpyjcpI1dhyX01PtXye2W9/PP05Iaxd60yU+YFFrfMxtT9IFMyWBogcM55oe2DUdO H7GodRUet9k9YB894Edk288QfBkzbtKXDBF1NzBu8OK3tQW8UnXeDur1CHwT9UGWgF F0BMRaahUOSL6grGNtIWAHoCXuxcfobyF9vH7Am8= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:55 +0000 Subject: [PATCH v2 16/25] media: i2c: imx283: Account for clamp region coordinates Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-16-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=2260; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=FmcEYHQ1IfaibJAwBHqF/Cbl4nH/qotAV8i2TDcsS8E=; b=dYJ/cIb8LQhuQUTFejw5z5vytjg8XtKiKbSVc3APC7gMZ1lGiH38NqBWMI3aD/nSjhIpjXkca ctB14NwI6oIBzl99IEoBOz5poz9ptoJr/6yJuwzJXeJKQBXaFyIgL7J X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The user clamp region is included in the pixel native area coordinates but is not included in the sensor vertical coordinates when configuring the VWINPOS. Remove the 16 line offset from the top position to account for this and in the event that a crop position requested vertical optical black, reduce the OB_SIZE_V register which causes those lines to be output in the main image data type instead. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index f9cf2bb0e10d..c3a44d2c6508 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -1144,15 +1144,31 @@ static int imx283_start_streaming(struct imx283 *im= x283, /* Vertical Configuration */ { u32 y_out_size =3D mode->crop.height / mode->scan->vbin_ratio; - u32 write_v_size =3D y_out_size + mode->scan->vertical_ob; =20 - s16 top =3D mode->crop.top; + /* + * The CLAMP region contains the Vertical Optical Black (VOB) + * lines, which are not included in the effective image height + * and 0 of the VWIDPOS corresponds to the first line after. + * + * This puts any request to view VOB as negative positions. + */ + s16 top =3D mode->crop.top - 16; u16 veff =3D mode->scan->veff; u16 cut =3D veff - min(veff, y_out_size); =20 u32 v_widcut; s32 v_pos; =20 + /* + * Reduce the v_ob when the requested crop position is below + * zero to output the VOB on image data. + */ + u8 v_ob =3D mode->scan->vertical_ob + min_t(s16, 0, top); + u32 write_v_size =3D y_out_size + v_ob; + + /* Clamp our top position now that VOB is handled */ + top =3D max_t(s16, 0, top); + if (imx283->vflip->val) top =3D -top; =20 @@ -1168,7 +1184,7 @@ static int imx283_start_streaming(struct imx283 *imx2= 83, cci_write(imx283->cci, IMX283_REG_VWIDCUT, v_widcut, &ret); cci_write(imx283->cci, IMX283_REG_VWINPOS, v_pos, &ret); =20 - cci_write(imx283->cci, IMX283_REG_OB_SIZE_V, mode->scan->vertical_ob, &r= et); + cci_write(imx283->cci, IMX283_REG_OB_SIZE_V, v_ob, &ret); } =20 /* Horizontal Configuration */ --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A0D036166F; Fri, 13 Feb 2026 14:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991365; cv=none; b=t2TSjJWJXnbMoWw8QSBX51VKbl72VtX0xPaWye6YOY730P7yGpU0pwrR7A8WXYIe5ngQiyJGEFNOkEUWbllRypHPb85IuEbfNSkmGsFgvlWdY2dgwIaVrtWy7MQ71dWrsoxdWHtVGH9fPYq3ERmxGHjWCtGBH9SzXsYYKBq6NDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991365; c=relaxed/simple; bh=P8a1SLszacb9BbOHbpLbKJIYNfiXLjxCTLO8qGQtWW4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VAtrOe4wF0sVvmj7aofWooftQKkOhyYiXONL7YhZz2rQZa6Hc/IE55z77qQt+DygPTVS0kYFRgnaYnI8kbHGeDvRquWiZyalle2ZaDLfJ9NpjGAUJHvXY8RjxW8KBwC+76JottQ5DxJYktO9Z82Ce0XmBo4xJIRmalgHuRw2ILI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=OR1Kl9fV; arc=none smtp.client-ip=213.167.242.64 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.b="OR1Kl9fV" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4EB85276B; Fri, 13 Feb 2026 15:01:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991283; bh=P8a1SLszacb9BbOHbpLbKJIYNfiXLjxCTLO8qGQtWW4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OR1Kl9fVXIhDi1WxR4Lp7FFQDtEn2GJU3QSrRQbRxObhzN1IEDs0U7ApzbYltP2nk qKuPVOfLHY2N0KoWR0SEpvkE16x3CFmzGLJ57bQCBI3sVsjzR3c590VMF2wMCTetGV 9trkIXBs4VVPjm55n2o4kRFRT5KPlqtITq+QpYvY= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:56 +0000 Subject: [PATCH v2 17/25] media: i2c: imx283: Crop leading lines with user clamp Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-17-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=2034; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=P8a1SLszacb9BbOHbpLbKJIYNfiXLjxCTLO8qGQtWW4=; b=gF5RdG93ja+kMVZW/x0PE6VYLLP3fqIaoO0zN5FK+MF7rzFM8pIOtjeilfXSKKFS0L+d1WfYA dAfr3CITjkJDMB5YnSmeFpBYUaIYFIxv11m5HrTb9bS9mfPciyXtnFI X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The IMX283 introduces an extra line on the all-pixel scan out modes to prevent bayer re-ordering on flip handling. This is undesireable as it introduces the line in all crop configurations when the image is not flipped. The OB_SIZE_V register determines how many lines from the output will be directed into the custom data type for optical black region. To overcome the extra line which is forcefully added, utilise the vertical optical black region to redirect the extra line. An additional line also needs to be redirected to once again retain the bayer order. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index c3a44d2c6508..07958cd1889e 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -1169,6 +1169,29 @@ static int imx283_start_streaming(struct imx283 *imx= 283, /* Clamp our top position now that VOB is handled */ top =3D max_t(s16, 0, top); =20 + /* + * The all-pixel scan modes introduce an 'extra line' at the + * start of the image when not flipped. This is understood to be + * a mechanism to preserve bayer ordering regardless of vflip + * however it introduces an undesirable line of black pixels. + * + * Crop this by adding two extra lines and moving them into the + * OB data type without impacting the effective image height or + * positioning. + * + * It's ok for top to go negative here as the sensor does in + * fact have extra 'hidden' lines in this region and the sensor + * supports negative vertical cropping positions. (estimated + * about 48 extra lines) + */ + if ((scan_mode(mode->scan, IMX283_MODE_0) || + scan_mode(mode->scan, IMX283_MODE_1)) && + imx283->vflip->val =3D=3D 0) { + top -=3D 2; + v_ob +=3D 2; + write_v_size +=3D 2; + } + if (imx283->vflip->val) top =3D -top; =20 --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A156F363C4E; Fri, 13 Feb 2026 14:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991367; cv=none; b=dd2vQqwgX5/imOLNcwYEwIytNt+137oL0WJttPD5E57bk6m0H0nrw7oAdql80I1IqEG4lkA4Xxfs6m8bavGUqgKZw6yNikZ8+cW9u1kq9dptUK/BWmMzCLwV9ihW1fVUjUXD/ApGDv/hQYN+OuWL7iUqlhucngS+sIVzk/Qyk6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991367; c=relaxed/simple; bh=wi2tcDwDnfbgeUOKoPs3aaLiCLXC032zvoFk/I/sCsg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ab8FvuN/BGPrqQsYBSCiVYkcFoj7RJRnGa5YszSctzsy2NPkSFYiYh4WZUHLK5Ns8dEFe3kBRzNuBXPcRoGudQsm8cU+cJOm61vXldYMxbGmAGOiGDmdrQ/htruPXK7u0SaQe1MwUQBKA0a7BGahSjOU9QN7mS0ziYoKSRVBR8Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Sdq1NGMK; arc=none smtp.client-ip=213.167.242.64 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.b="Sdq1NGMK" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AA4AA27F4; Fri, 13 Feb 2026 15:01:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991283; bh=wi2tcDwDnfbgeUOKoPs3aaLiCLXC032zvoFk/I/sCsg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Sdq1NGMK1Alyhfmw/H0Hldc9PwH7yQN6ow3qPJK0fWRpm1RLj1fbKBliytbl8kV5X rkNTczDP7VJWGQyfO8hpkdkHK1GAr+4ZL2aC6u1OwzgIIbY3HohLg3Z16khUGLGm+N tMyA6A48E6vi4Kzev8tjnTQzoivg1DLpHQz4swDo= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:57 +0000 Subject: [PATCH v2 18/25] media: i2c: imx283: Reduce vertical cutting Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-18-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1113; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=wi2tcDwDnfbgeUOKoPs3aaLiCLXC032zvoFk/I/sCsg=; b=krz3VgLnBbd33y4IqY31cwNy9iDTCUYi7VbeoJ7Gm62XdtpzUvDFN8x0hNCqcjez0FhhQQQOQ ou/Fu4tw+IuC1JAzLUibKt3ldly5j08GB1siS630GZMPP+7LAIeNd3Y X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The size should represent the amount of lines to cut vertically and exclude from the pixel array for the image data. Keeping this at the expected value causes corruption on the last line. Reduce by increasing the defined size of the image by a single line to ensure that the data is valid for the final output. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 07958cd1889e..df48793835fd 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -1154,7 +1154,12 @@ static int imx283_start_streaming(struct imx283 *imx= 283, */ s16 top =3D mode->crop.top - 16; u16 veff =3D mode->scan->veff; - u16 cut =3D veff - min(veff, y_out_size); + + /* + * Lots of empirical testing shows that we need to cut one less + * line than expected or we get corruption in the last line. + */ + u16 cut =3D veff - min(veff, y_out_size + 1); =20 u32 v_widcut; s32 v_pos; --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D9C1363C62; Fri, 13 Feb 2026 14:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991368; cv=none; b=SilEp5RasYrzP+0gS32q7AUnSj/xtTw+zNUEvTmOcm7p+qsau5RxHskMT/edYmwoixtTWNR48F3xpEENdpi7Qq5ut6IVEp9gH/sOxR8JGuJfPEef1S+Iv+t+aItZ7D7kezAJ3eOGyaVU4+WDR3dLbx0PQNj74LkULcXXDRp7T4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991368; c=relaxed/simple; bh=2WgGoX5anWO8ec8ptn6Vz02ywqnBiOH3zospwkSrUyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Xy8XukLY6wqozqSLYogPokHrsZotzJ9g7l5zLMWnjZEuhtBUw9a9qF2DzNKQpPPqQgYKOttonxkGuJAQFjuDSkO45OsaqPFV8pX/zkREYHcA2+GvRu846xB5GVcYGNypj36qHXM07upLO1lK5X5/Zgp8c/+TtOxo6jJonw2EeyA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=eidpHQw1; arc=none smtp.client-ip=213.167.242.64 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.b="eidpHQw1" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 12B1427F6; Fri, 13 Feb 2026 15:01:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991284; bh=2WgGoX5anWO8ec8ptn6Vz02ywqnBiOH3zospwkSrUyY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eidpHQw1DID1MU6NQXUB11jA4XVIgJoNPNmKyWRY8WnWUUlwiRO6zHO+1yEvwTtjh hxh5AilgwpudVUI9KP4jS67Rs79ZhDOSrL/Zn0c26UU6+yQwLd+UUgZIWPApe2fAY8 ndxgm6Hz0snqt0m+5fEoeNMnbj2HSIr4dTQQzW4c= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:58 +0000 Subject: [PATCH v2 19/25] media: i2c: imx283: Provide Native pixel array capture mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-19-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1104; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=2WgGoX5anWO8ec8ptn6Vz02ywqnBiOH3zospwkSrUyY=; b=JvFS7SVDjOF+DDNn0f/82yMDi6j88Y6+mbOZPnSm1kG23TxmmUi9qd2dUuHqggjBsGOxmWE2S T4YKJsS4MlxB5+lTlWbXbTiDh53ihUyAsEW3uCW3RABt5VWwlRPPbhO X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Provide a mode that outputs all pixels from the full native array. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index df48793835fd..4976c08c6832 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -508,6 +508,21 @@ static const struct imx283_reg_list link_freq_reglist[= ] =3D { =20 /* Mode configs */ static const struct imx283_mode supported_modes_12bit[] =3D { + { + /* Full Native pixel array, including HOB/VOB. 5592x3710 */ + .scan =3D &imx283_scan_modes[IMX283_MODE_0], + + .width =3D 5592, + .height =3D 3710, /* 3694 + 16 additional lines for VOB */ + .min_hmax =3D 5914, /* 887 @ 480MHz/72MHz */ + .min_vmax =3D 3793, /* Lines */ + + /* 20.00 FPS */ + .default_hmax =3D 6000, /* 900 @ 480MHz/72MHz */ + .default_vmax =3D 4000, + + .crop =3D imx283_native_area, + }, { /* 20MPix 21.40 fps readout mode 0 */ .scan =3D &imx283_scan_modes[IMX283_MODE_0], --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 225BE364056; Fri, 13 Feb 2026 14:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991370; cv=none; b=S7ozkfmkHZk6/DYDhAtGArNQhfJp+FUTq7jhPpkpbEtjgLhQcIj9yhTOR+bV8sYWoIuMdrUgkXwivvi69MVzFpymJO9RKioEy5y5/QHb68/ZB8xwcAzDUm6FX8HcADy4tinV1sYat8WmJhAZJPGWFZ2mIKX+/QRITB67QR+qkmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991370; c=relaxed/simple; bh=ODRvYl55xOvyg3YT7fWS0qNsfskkpV8/hqXwHSDAk7s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L7NVIEVuI32n1nJFIhaWJLww0+kgQ125go+5Oq8WKecQUSY8/AfBNDFAB73qlfe66o6QxhzvbuzfkBJpQLlF0fTXmVZZ39cVMQ056o6lFI7ieTJSc8FdzDbBTKFp7QMsJ/L+aR07i9qZrg7gFtoQbNzmtqp3sY/+xWGv+K6VCys= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=W60Wvtpp; arc=none smtp.client-ip=213.167.242.64 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.b="W60Wvtpp" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 68ADB27F7; Fri, 13 Feb 2026 15:01:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991284; bh=ODRvYl55xOvyg3YT7fWS0qNsfskkpV8/hqXwHSDAk7s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=W60Wvtpp2qsFjYIrDUF3a/WFa2eKQD7wyoPje6R4qcMsls+aG1B/o176be49khtGg D36TBizJRT9qtMD5743drNINZ+xBOQAVPS1ydYPbrVVAaAl56x77WaC9+XxRIrBV8t zpc5maD16UzNY/Y6hgL0PKgQjW8YL/dbRNxxPLPU= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:01:59 +0000 Subject: [PATCH v2 20/25] media: i2c: imx283: Provide a full active pixels mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-20-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1011; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=ODRvYl55xOvyg3YT7fWS0qNsfskkpV8/hqXwHSDAk7s=; b=hvQPx0Io6IkV0/vkScxabiEn1LLdcgnt6ScQMrMXAnJVeI37z5vqTvDB2GxSGk++rvm/ZvCBP jKU+Xl8rHmlCmWBBd7b0jyKlUD1QikW70OyaflPJeOmhO+qprVIE9Nu X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Add a mode to support output of the full illuminated area of the pixel array. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 4976c08c6832..d001bfb5e241 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -523,6 +523,21 @@ static const struct imx283_mode supported_modes_12bit[= ] =3D { =20 .crop =3D imx283_native_area, }, + { + /* All illuminated pixels : 5496x3694 */ + .scan =3D &imx283_scan_modes[IMX283_MODE_0], + + .width =3D 5496, + .height =3D 3694, + .min_hmax =3D 5914, /* 887 @ 480MHz/72MHz */ + .min_vmax =3D 3793, /* Lines */ + + /* 20.00 FPS */ + .default_hmax =3D 6000, /* 900 @ 480MHz/72MHz */ + .default_vmax =3D 4000, + + .crop =3D imx283_active_area, + }, { /* 20MPix 21.40 fps readout mode 0 */ .scan =3D &imx283_scan_modes[IMX283_MODE_0], --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8988B361664; Fri, 13 Feb 2026 14:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991370; cv=none; b=FQJBrRnrhFZNIxkk5PAn0SisWqpf5tfYqsrDvbRc3i/ekuOosO2FKz3UCxnIrKTHl6ocfbd8oLc01NM7TWBx60Q8QWGCtacTt41w7MLpLojZgD6XcFWtIsX/q0aCank7cD32BA7lr6RHvWzmDBdAwcEPbk46pfH7nZPT+pPfXi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991370; c=relaxed/simple; bh=sH0xELGy1y71O6b2pDz7NAvALUD100qDgGv6kdU87A0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PuFu05rHIX/056vZNkmCXFpGqx4HYOv9YR9LFu/w+RmpX+NfIkAKmG5e22nKao73iyiacg9he/NR8CH5jVBijl6XAx4QV2wMNhr8Br+Y+Kr8madsgxc380xXned/FZXp+43E7lQm+APxS3H7zRqHX8YlnVjft5TPo1FyjLoGiLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=I6fWhHiZ; arc=none smtp.client-ip=213.167.242.64 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.b="I6fWhHiZ" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BED6827F8; Fri, 13 Feb 2026 15:01:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991285; bh=sH0xELGy1y71O6b2pDz7NAvALUD100qDgGv6kdU87A0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I6fWhHiZR1jDj2V44YAmHaDe7kBIZ03muuft9G7FDPqaXzU64fOElef+TrTgGZfC1 He+j0RLXaTQ9DQT/7tozc4MQ2C42eK2Uc6dmKcQ08PARlj2UMM0HU8yk8+rLJ9RW+n m793Izf5F2pcM0+HtDQXfE3+QPuDCYiopTxPxC+A= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:02:00 +0000 Subject: [PATCH v2 21/25] media: i2c: imx283: Provide an effective pixel array mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-21-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1409; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=sH0xELGy1y71O6b2pDz7NAvALUD100qDgGv6kdU87A0=; b=RPtataIdNgpmAIKLFo1Vfsro5BxwFKLAXL1ARjXi65ixtoFPb3im8BKKDakcln6ctdb/2oJzs 8itrjfKCVnEB0bdJM33b8n6tAOFw5q7SN98YB10qN7v1fgDv0eMEAnb X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= Provide a mode that includes all effective pixels which includes a 12 pixel margin for colour processing on all edges. Signed-off-by: Kieran Bingham Reviewed-by: Jai Luthra --- drivers/media/i2c/imx283.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index d001bfb5e241..75a35d9db05d 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -183,6 +183,13 @@ static const struct v4l2_rect imx283_native_area =3D { .height =3D 3710, }; =20 +static const struct v4l2_rect imx283_effective_area =3D { + .top =3D 16 + 12, /* Clamp + Ignored area*/ + .left =3D 96, + .width =3D 5496, + .height =3D 3672, +}; + static const struct v4l2_rect imx283_active_area =3D { .top =3D 16, .left =3D 96, @@ -538,6 +545,21 @@ static const struct imx283_mode supported_modes_12bit[= ] =3D { =20 .crop =3D imx283_active_area, }, + { + /* Effective Pixel Mode : 5496x3672 */ + .scan =3D &imx283_scan_modes[IMX283_MODE_0], + + .width =3D 5496, + .height =3D 3672, + .min_hmax =3D 5914, /* 887 @ 480MHz/72MHz */ + .min_vmax =3D 3793, /* Lines */ + + /* 20.00 FPS */ + .default_hmax =3D 6000, /* 900 @ 480MHz/72MHz */ + .default_vmax =3D 4000, + + .crop =3D imx283_effective_area, + }, { /* 20MPix 21.40 fps readout mode 0 */ .scan =3D &imx283_scan_modes[IMX283_MODE_0], --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FB9D364E9D; Fri, 13 Feb 2026 14:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991373; cv=none; b=c9csZOAa/jFctDoFngmaZS3065QeIi7b4U9RhM30HdeT+5VzwuOnmLqSV7tkxuv0tt7/VNwVUOCoZQyyFToQUvotp6QnS33o532MiEmtv95BJUk98jYY/mkQSco5ZuJ0ejab4ZBEN/98N1WS2iSVN/9wNta7VBu4yFMuqOvMYqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991373; c=relaxed/simple; bh=5E+i6OeSBSm+YNxRnxiGTUFafcPI4TSJvS5gEf+Dl6E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Pkav2sF8RGHfTEScMu5odov/wvp5tUzWLviWQ2Gdph3Habc4V1vsI3XSWx+JRJxz9X5gEV629JmoyxM16nPp3/LBXZa9CG15fSZcCQxjqDU3Ix7hErY8VRIwp9u9a+zX7i/GbqZdihk06Ct4+QT6nSJGnTH2wQEQfpAu5i9ya5c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=kCdQ7E39; arc=none smtp.client-ip=213.167.242.64 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.b="kCdQ7E39" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 255D3324; Fri, 13 Feb 2026 15:01:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991285; bh=5E+i6OeSBSm+YNxRnxiGTUFafcPI4TSJvS5gEf+Dl6E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kCdQ7E39opwUuK+sFIzgq1sO1kI0+hJaEJgCzngmPHiv1mXHEsvV1Kisnl0u3DcPN KyWJ8G72mEvDf2U+7aoKE+TzVhHbeLlPpfNB3IXf/oQrJzWVzk1TXEkITusmYkugc4 PJXkdChA0dzLwTX4LaXeaWb6WRi4N4tRbE2qCdY4= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:02:01 +0000 Subject: [PATCH v2 22/25] media: i2c: imx283: Recalculate SHR on blanking changes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-22-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1599; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=5E+i6OeSBSm+YNxRnxiGTUFafcPI4TSJvS5gEf+Dl6E=; b=d99PGnrRQaFpC7wzWdLpvtZbg3Sir6wf0071UlTKs4QgM5/S/vWpYR1H7y8NEUQHuRXIbS/RV zEYNHATpKnlAvlTUgCMUphyGTiPjwYxTxag/d1/GLJAglZo80X17RNK X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The exposure control on the imx283 is handled through the SHR register. This value is calculated based upon the hmax and vmax registers as a property of the total line and frame length. Ensure that the SHR is updated whenever the blankings update and adjust the frame intervals to ensure the correct exposure is configured on the sensor. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 75a35d9db05d..7fb654512c20 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -909,6 +909,11 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) dev_dbg(imx283->dev, "V4L2_CID_HBLANK : %d HMAX : %u\n", ctrl->val, imx283->hmax); ret =3D cci_write(imx283->cci, IMX283_REG_HMAX, imx283->hmax, NULL); + + /* Recompute the SHR based on the new timings */ + shr =3D imx283_shr(imx283, mode, imx283->exposure->val); + cci_write(imx283->cci, IMX283_REG_SHR, shr, &ret); + break; =20 case V4L2_CID_VBLANK: @@ -916,6 +921,11 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) dev_dbg(imx283->dev, "V4L2_CID_VBLANK : %d VMAX : %u\n", ctrl->val, imx283->vmax); ret =3D cci_write(imx283->cci, IMX283_REG_VMAX, imx283->vmax, NULL); + + /* Recompute the SHR based on the new timings */ + shr =3D imx283_shr(imx283, mode, imx283->exposure->val); + cci_write(imx283->cci, IMX283_REG_SHR, shr, &ret); + break; =20 case V4L2_CID_ANALOGUE_GAIN: --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39D4B364EA1; Fri, 13 Feb 2026 14:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991373; cv=none; b=uVz2n5dCiwFyIyMxLccoO+ezc15UPLV1CJD4Qx7/rnuGylMZsscm1c/yiR394+TaQj1IyEc4LaN+Y1YDKkSlSsHBgrjGNz8wFJr2NIFUrM4lyMETyGIbnRmCBM7ceH2tzlhfODK3EmLdb3oR+BlObZgbIthzSfBzxLX8uhtxnRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991373; c=relaxed/simple; bh=IlOKgiURXew91kVX0/CTX4xZDsCiJBqNvhyK9bk4hDw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XjhV6jD+LykzGWNRdxz8hyecRJ/4yYTQuGJs9NwugjsF8YXOTW9fNHHeDHfMD6NnVD/zgECk+b3xg6O3eR//shyo4tF7nTCPXyGbmMwU/Vxz4AXYcHxsqSC3vsTca4FrDaKVwFUFlrHozytPPajavRQ01XZIu/3wZ3gj/IjXWnM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=FyNTlQrl; arc=none smtp.client-ip=213.167.242.64 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.b="FyNTlQrl" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7F7BECF5; Fri, 13 Feb 2026 15:01:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991285; bh=IlOKgiURXew91kVX0/CTX4xZDsCiJBqNvhyK9bk4hDw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FyNTlQrl4udUx/A/a9SrluVvS5wzFR+e47hsWYGRpaJh5ohnfdmUo2Kjv70aLfnin O58itpIlawA8IXRmfTqfzUVbQBoJ5amiCqVz5abMDDmORUNaWaJi+qKZaBKbt51+5R nFw+5s9byNAk9ro9qKwA7DijBY1pm4B89raG+ITw= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:02:02 +0000 Subject: [PATCH v2 23/25] media: i2c: imx283: Fix binned mode blanking timings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-23-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=4685; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=IlOKgiURXew91kVX0/CTX4xZDsCiJBqNvhyK9bk4hDw=; b=AOmPX89eV6UX9s0uRju1KLoauw3W/h4G34ZldWUyMuKEkv4dzZ7ZDXiKDn7NEZz5EpWD2j14K uwNUKhWy5U2A6j+0ssKmq5FxQNHOkmRnL2KBtRdBJwX8fuggncNMj0R X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The IMX283 supports binning modes which combine multiple measured pixels into a single output pixel. The minimum timings for this must account for the operations on all measured pixels, not the output pixel sizes. Determine and calculate all hmax and vmax values in respect of the HBLANK and VBLANK controls against the native resolution of the mode as specified in the mode crop rectangle as opposed to the output mode width and height. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 7fb654512c20..25e669370751 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -875,7 +875,7 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) /* Honour the VBLANK limits when setting exposure. */ s64 current_exposure, max_exposure, min_exposure; =20 - imx283->vmax =3D mode->height + ctrl->val; + imx283->vmax =3D mode->crop.height + ctrl->val; =20 imx283_exposure_limits(imx283, mode, &min_exposure, &max_exposure); @@ -905,7 +905,7 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) =20 case V4L2_CID_HBLANK: pixel_rate =3D imx283_pixel_rate(imx283, mode); - imx283->hmax =3D imx283_internal_clock(pixel_rate, mode->width + ctrl->v= al); + imx283->hmax =3D imx283_internal_clock(pixel_rate, mode->crop.width + ct= rl->val); dev_dbg(imx283->dev, "V4L2_CID_HBLANK : %d HMAX : %u\n", ctrl->val, imx283->hmax); ret =3D cci_write(imx283->cci, IMX283_REG_HMAX, imx283->hmax, NULL); @@ -917,7 +917,7 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) break; =20 case V4L2_CID_VBLANK: - imx283->vmax =3D mode->height + ctrl->val; + imx283->vmax =3D mode->crop.height + ctrl->val; dev_dbg(imx283->dev, "V4L2_CID_VBLANK : %d VMAX : %u\n", ctrl->val, imx283->vmax); ret =3D cci_write(imx283->cci, IMX283_REG_VMAX, imx283->vmax, NULL); @@ -1042,6 +1042,9 @@ static void imx283_set_framing_limits(struct imx283 *= imx283, u64 pixel_rate =3D imx283_pixel_rate(imx283, mode); u64 min_hblank, max_hblank, def_hblank; =20 + /* Use crop for timings from native sensor units */ + const struct v4l2_rect *crop =3D &mode->crop; + /* Initialise hmax and vmax for exposure calculations */ imx283->hmax =3D imx283_internal_clock(pixel_rate, mode->default_hmax); imx283->vmax =3D mode->default_vmax; @@ -1050,18 +1053,18 @@ static void imx283_set_framing_limits(struct imx283= *imx283, * Horizontal Blanking * Convert the HMAX_MAX (72MHz) to Pixel rate values for HBLANK_MAX */ - min_hblank =3D mode->min_hmax - mode->width; - max_hblank =3D imx283_iclk_to_pix(pixel_rate, IMX283_HMAX_MAX) - mode->wi= dth; - def_hblank =3D mode->default_hmax - mode->width; + min_hblank =3D mode->min_hmax - crop->width; + max_hblank =3D imx283_iclk_to_pix(pixel_rate, IMX283_HMAX_MAX) - crop->wi= dth; + def_hblank =3D mode->default_hmax - crop->width; __v4l2_ctrl_modify_range(imx283->hblank, min_hblank, max_hblank, 1, def_hblank); __v4l2_ctrl_s_ctrl(imx283->hblank, def_hblank); =20 /* Vertical Blanking */ - __v4l2_ctrl_modify_range(imx283->vblank, mode->min_vmax - mode->height, - IMX283_VMAX_MAX - mode->height, 1, + __v4l2_ctrl_modify_range(imx283->vblank, mode->min_vmax - crop->height, + IMX283_VMAX_MAX - crop->height, 1, mode->default_vmax - mode->height); - __v4l2_ctrl_s_ctrl(imx283->vblank, mode->default_vmax - mode->height); + __v4l2_ctrl_s_ctrl(imx283->vblank, mode->default_vmax - crop->height); } =20 static int imx283_set_pad_format(struct v4l2_subdev *sd, @@ -1509,13 +1512,13 @@ static int imx283_init_controls(struct imx283 *imx2= 83) /* Initialise vblank/hblank/exposure based on the current mode. */ imx283->vblank =3D v4l2_ctrl_new_std(ctrl_hdlr, &imx283_ctrl_ops, V4L2_CID_VBLANK, - mode->min_vmax - mode->height, + mode->min_vmax - mode->crop.height, IMX283_VMAX_MAX, 1, - mode->default_vmax - mode->height); + mode->default_vmax - mode->crop.height); =20 - min_hblank =3D mode->min_hmax - mode->width; - max_hblank =3D imx283_iclk_to_pix(pixel_rate, IMX283_HMAX_MAX) - mode->wi= dth; - def_hblank =3D mode->default_hmax - mode->width; + min_hblank =3D mode->min_hmax - mode->crop.width; + max_hblank =3D imx283_iclk_to_pix(pixel_rate, IMX283_HMAX_MAX) - mode->cr= op.width; + def_hblank =3D mode->default_hmax - mode->crop.width; imx283->hblank =3D v4l2_ctrl_new_std(ctrl_hdlr, &imx283_ctrl_ops, V4L2_CID_HBLANK, min_hblank, max_hblank, 1, def_hblank); --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C636F365A1A; Fri, 13 Feb 2026 14:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991376; cv=none; b=J7XHHDv6ZFeZKk4wU720wiZoj6etHoIP1af0H+g9axL3Ht2l9uyiKNq/X1ox0VFEHyglwo1OcObJAKOxFJxReHQQNpvdBdZeVv2i3nTSCehowv63oyKOVCXDopVuI5smr5wOzqdKlGBUTxZQezRWGMyooDOY+acsq7C79MbMNeE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991376; c=relaxed/simple; bh=Cggui14yqD+YsFkwc9xNRMRBNxVEcJohPeJ3RQ6/uVg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=erlCgNbeI8Ysx1otKh4xDlgUnaKM5H9qjoHcik4sL0BVmsiifdHh+qcLyWWPeRCDDa94o7syFApi5ooAJLP5CrfZCwqWmMibXmnj45M6HErcN9mn+wapSoE0n58u1tZLNxfHi/zQd/syh6AGZNaZh2L2fu4vuqnFL4Y2q0sljHU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=QUBOcjey; arc=none smtp.client-ip=213.167.242.64 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.b="QUBOcjey" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DCA2D27F9; Fri, 13 Feb 2026 15:01:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991286; bh=Cggui14yqD+YsFkwc9xNRMRBNxVEcJohPeJ3RQ6/uVg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QUBOcjey6Tt+nu/8KnCZPunWtVvslrAVCd5oEE3istL4MJWVFPGP+Shb8+gW3DXXi ACCyocRi1GT13HgwLwYhhP1mEYc8KWGBzohutm1vtrZ+vTLHhlmDRBRQCQUAXaZMnS jOEyd9DHUnAY9EaoqOSpcG6X0o6G5ocRMnmWB+M4= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:02:03 +0000 Subject: [PATCH v2 24/25] media: i2c: imx283: Update exposure range on blanking changes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-24-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=2419; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=Cggui14yqD+YsFkwc9xNRMRBNxVEcJohPeJ3RQ6/uVg=; b=ZrhvsvwScr7lJbn31vR2sEsg1cwwujiJHB/L2Q359dthRaunD14NJBqR5+03ZFXjpDfW1i4bt L/lWBnI3Kh6AstgGUOWjvT6fBCvyanS3oBAUklsMpSUJF4SESOB71rA X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The exposure ranges are updated currently whenever the VBLANK control is updated. However, the total exposure limits are a factor of both the HBLANK and the VBLANK durations. Determine the hmax value any time the control is set, including if the device is not yet streaming and update the limits accordingly. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index 25e669370751..f0ede67921d9 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -857,7 +857,7 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) const struct imx283_mode *mode_list; struct v4l2_subdev_state *state; unsigned int num_modes; - u64 shr, pixel_rate; + u64 shr; int ret =3D 0; =20 state =3D v4l2_subdev_get_locked_active_state(&imx283->sd); @@ -868,15 +868,24 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) fmt->width, fmt->height); =20 /* - * The VBLANK control may change the limits of usable exposure, so check - * and adjust if necessary. + * The VBLANK/HBLANK controls change the limits of usable exposure, + * so check and adjust if necessary. */ - if (ctrl->id =3D=3D V4L2_CID_VBLANK) { + if (ctrl->id =3D=3D V4L2_CID_HBLANK) { + u64 pixel_rate =3D imx283_pixel_rate(imx283, mode); + u32 max_width =3D mode->crop.width + ctrl->val; + + imx283->hmax =3D imx283_internal_clock(pixel_rate, max_width); + } + + if (ctrl->id =3D=3D V4L2_CID_VBLANK) + imx283->vmax =3D mode->crop.height + ctrl->val; + + if (ctrl->id =3D=3D V4L2_CID_HBLANK || + ctrl->id =3D=3D V4L2_CID_VBLANK) { /* Honour the VBLANK limits when setting exposure. */ s64 current_exposure, max_exposure, min_exposure; =20 - imx283->vmax =3D mode->crop.height + ctrl->val; - imx283_exposure_limits(imx283, mode, &min_exposure, &max_exposure); =20 @@ -904,8 +913,6 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) break; =20 case V4L2_CID_HBLANK: - pixel_rate =3D imx283_pixel_rate(imx283, mode); - imx283->hmax =3D imx283_internal_clock(pixel_rate, mode->crop.width + ct= rl->val); dev_dbg(imx283->dev, "V4L2_CID_HBLANK : %d HMAX : %u\n", ctrl->val, imx283->hmax); ret =3D cci_write(imx283->cci, IMX283_REG_HMAX, imx283->hmax, NULL); --=20 2.52.0 From nobody Fri Apr 17 21:54:41 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDB17365A1D; Fri, 13 Feb 2026 14:02:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991376; cv=none; b=r2XfSzi59wxxSuZUfFbFbLy+nDORQwN0YtqU1+veSlExlGw2bQwekyxpwgBA119wuCIQj1Lzyv+Jd/cm7nXqzCr7laN4lf9WtEYq2bQBsV8HZTLLjtQp7oghOBtFDY0K7lRUVTBujoVE78qanRnZ7mm8mmZ0zbEVHhUD0dPMowo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770991376; c=relaxed/simple; bh=B2+mnY4v53oT04OEjZEhPLs9RbHaRADSTAazzCmBfFU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=crZJpmYC73kzenkUYBlTGSWOYmJEDT/irkUdV/Dm+B300y1IvFX+j0V/TBJdfSxZ9138gFYc/4ueiw+SLuGNj5cZ8cW16zMjlJ9nJxYEiylTJL0APIHPCfI3wnud+TZjEeKL3mVHEtqf0LT8iiOlEcki4ku2qh9tx4ljkbeITJ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=BRt1BHAk; arc=none smtp.client-ip=213.167.242.64 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.b="BRt1BHAk" Received: from ping.linuxembedded.co.uk (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 42F6927FA; Fri, 13 Feb 2026 15:01:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1770991286; bh=B2+mnY4v53oT04OEjZEhPLs9RbHaRADSTAazzCmBfFU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BRt1BHAkPqfg5Fgrz+LL1Z5WCr8zBCiNHUId1C1fynizUYu98g740WLTducdDt5zV pYpkWw1m4kWBwnM8VKyKjxKIaCXaiVNT163cjCTyMFeaeUX7EZMkhSpv1ZvrnIhf7n sN3yB/iKJGO9GifR+AHModqIRUfIhyMRb6VYH/tQ= From: Kieran Bingham Date: Fri, 13 Feb 2026 14:02:04 +0000 Subject: [PATCH v2 25/25] media: i2c: imx283: Simplify VFLIP control setting Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-mainline-imx283-v2-v2-25-be40a3770ebf@ideasonboard.com> References: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> In-Reply-To: <20260213-mainline-imx283-v2-v2-0-be40a3770ebf@ideasonboard.com> To: Umang Jain , Sakari Ailus , Mauro Carvalho Chehab , Hans Verkuil Cc: Jai Luthra , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Kieran Bingham X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1770991325; l=1276; i=kieran.bingham@ideasonboard.com; s=20260207; h=from:subject:message-id; bh=B2+mnY4v53oT04OEjZEhPLs9RbHaRADSTAazzCmBfFU=; b=hgWjzzS2f0ZNLX9MnlCT6m2SKJO1lF96PRLDXurSzSYcNJuZgPc5HOs/11W1l7cUNetSn2/RO FNmutEtPFpIALzmfQtRmZLwKpxSKEp60o4rH1KKWhJJbm8GWAykLTBW X-Developer-Key: i=kieran.bingham@ideasonboard.com; a=ed25519; pk=FVXKN7YuwHc6UtbRUeTMAmranfsQomA+vnilfglWdaY= The VFLIP control is configured through the MDVREV bit of the HTRIMMING register. Simplify the conditional branch from 5 lines to 3 by determining the trim value which must always include setting the HTRIMMING_EN bit, and conditionally set the MDVREV before applying it to the hardware. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx283.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/imx283.c b/drivers/media/i2c/imx283.c index f0ede67921d9..1698754ea059 100644 --- a/drivers/media/i2c/imx283.c +++ b/drivers/media/i2c/imx283.c @@ -948,13 +948,11 @@ static int imx283_set_ctrl(struct v4l2_ctrl *ctrl) * VFLIP is managed by BIT(0) of IMX283_REG_HTRIMMING address, hence * both need to be set simultaneously. */ - if (ctrl->val) { - cci_write(imx283->cci, IMX283_REG_HTRIMMING, - IMX283_HTRIMMING_EN | IMX283_MDVREV, &ret); - } else { - cci_write(imx283->cci, IMX283_REG_HTRIMMING, - IMX283_HTRIMMING_EN, &ret); - } + u8 trim =3D IMX283_HTRIMMING_EN; + + trim |=3D ctrl->val ? IMX283_MDVREV : 0; + cci_write(imx283->cci, IMX283_REG_HTRIMMING, trim, &ret); + break; =20 case V4L2_CID_TEST_PATTERN: --=20 2.52.0