lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250509-ov8858-crop-v1-1-403a0993c1de@mailoo.org>
Date: Fri, 09 May 2025 09:33:57 +0200
From: Vincent Knecht via B4 Relay <devnull+vincent.knecht.mailoo.org@...nel.org>
To: Jacopo Mondi <jacopo.mondi@...asonboard.com>, 
 Nicholas Roth <nicholas@...hemail.net>, 
 Sakari Ailus <sakari.ailus@...ux.intel.com>, 
 Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org, 
 phone-devel@...r.kernel.org, Vincent Knecht <vincent.knecht@...loo.org>
Subject: [PATCH] media: i2c: ov8858: Add sensor's pixel matrix size

From: Vincent Knecht <vincent.knecht@...loo.org>

The OV8858 pixel array is composed as:
- vertically: 16 dummy columns, 3264 valid ones and 16 dummy columns for
  a total of 3296 columns
- horizontally: 24 optical black lines, 16 dummy ones, 2448 valid, 16
  dummies and 24 optical black lines for a total of 2528 lines

Set native and active sensor pixel sizes.

Signed-off-by: Vincent Knecht <vincent.knecht@...loo.org>
---
 drivers/media/i2c/ov8858.c | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/drivers/media/i2c/ov8858.c b/drivers/media/i2c/ov8858.c
index 95f9ae7948463e95ce0b2cb58195de02ee72c02a..9a86aa46e20b48ef4bae7d70ce485985c1ba886a 100644
--- a/drivers/media/i2c/ov8858.c
+++ b/drivers/media/i2c/ov8858.c
@@ -77,6 +77,14 @@
 
 #define REG_NULL			0xffff
 
+/* OV8858 native and active pixel array size */
+#define OV8858_NATIVE_WIDTH		3296U
+#define OV8858_NATIVE_HEIGHT		2528U
+#define OV8858_PIXEL_ARRAY_LEFT		16U
+#define OV8858_PIXEL_ARRAY_TOP		40U
+#define OV8858_PIXEL_ARRAY_WIDTH	3264U
+#define OV8858_PIXEL_ARRAY_HEIGHT	2448U
+
 static const char * const ov8858_supply_names[] = {
 	"avdd",		/* Analog power */
 	"dovdd",	/* Digital I/O power */
@@ -1492,11 +1500,40 @@ static int ov8858_init_state(struct v4l2_subdev *sd,
 	return 0;
 }
 
+static int ov8858_get_selection(struct v4l2_subdev *sd,
+				struct v4l2_subdev_state *sd_state,
+				struct v4l2_subdev_selection *sel)
+{
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP:
+		sel->r = *v4l2_subdev_state_get_crop(sd_state, 0);
+		return 0;
+
+	case V4L2_SEL_TGT_NATIVE_SIZE:
+		sel->r.top = 0;
+		sel->r.left = 0;
+		sel->r.width = OV8858_NATIVE_WIDTH;
+		sel->r.height = OV8858_NATIVE_HEIGHT;
+		return 0;
+
+	case V4L2_SEL_TGT_CROP_DEFAULT:
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+		sel->r.top = OV8858_PIXEL_ARRAY_TOP;
+		sel->r.left = OV8858_PIXEL_ARRAY_LEFT;
+		sel->r.width = OV8858_PIXEL_ARRAY_WIDTH;
+		sel->r.height = OV8858_PIXEL_ARRAY_HEIGHT;
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
 static const struct v4l2_subdev_pad_ops ov8858_pad_ops = {
 	.enum_mbus_code = ov8858_enum_mbus_code,
 	.enum_frame_size = ov8858_enum_frame_sizes,
 	.get_fmt = v4l2_subdev_get_fmt,
 	.set_fmt = ov8858_set_fmt,
+	.get_selection = ov8858_get_selection,
 };
 
 static const struct v4l2_subdev_ops ov8858_subdev_ops = {

---
base-commit: 37ff6e9a2ce321b7932d3987701757fb4d87b0e6
change-id: 20250509-ov8858-crop-9c307bc9d5b6

Best regards,
-- 
Vincent Knecht <vincent.knecht@...loo.org>



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ