linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: i2c: ov8858: Add sensor's pixel matrix size
@ 2025-05-09  7:33 Vincent Knecht via B4 Relay
  2025-08-11 14:30 ` Vincent Knecht
  0 siblings, 1 reply; 2+ messages in thread
From: Vincent Knecht via B4 Relay @ 2025-05-09  7:33 UTC (permalink / raw)
  To: Jacopo Mondi, Nicholas Roth, Sakari Ailus, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, phone-devel, Vincent Knecht

From: Vincent Knecht <vincent.knecht@mailoo.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@mailoo.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@mailoo.org>



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

* Re: [PATCH] media: i2c: ov8858: Add sensor's pixel matrix size
  2025-05-09  7:33 [PATCH] media: i2c: ov8858: Add sensor's pixel matrix size Vincent Knecht via B4 Relay
@ 2025-08-11 14:30 ` Vincent Knecht
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Knecht @ 2025-08-11 14:30 UTC (permalink / raw)
  To: Jacopo Mondi, Nicholas Roth, Sakari Ailus, Mauro Carvalho Chehab
  Cc: linux-media, linux-kernel, phone-devel

Le vendredi 09 mai 2025 à 09:33 +0200, Vincent Knecht via B4 Relay a écrit :
> From: Vincent Knecht <vincent.knecht@mailoo.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@mailoo.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,

Hi Sakari,

I got no feedback about this patch, is it okay ?

Thank you



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

end of thread, other threads:[~2025-08-11 14:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09  7:33 [PATCH] media: i2c: ov8858: Add sensor's pixel matrix size Vincent Knecht via B4 Relay
2025-08-11 14:30 ` Vincent Knecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).