linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] media: i2c: ov5670: Report native size and crop bounds
@ 2019-08-17 10:44 Jacopo Mondi
  2019-08-17 10:44 ` [PATCH 2/2] media: i2c: ov13858: " Jacopo Mondi
  0 siblings, 1 reply; 2+ messages in thread
From: Jacopo Mondi @ 2019-08-17 10:44 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus, Laurent Pinchart
  Cc: Jacopo Mondi, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)

Report the native pixel array size and the crop bounds for the ov5670
sensor driver.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 drivers/media/i2c/ov5670.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
index 2bc57e85f721..3e22fe9ccad1 100644
--- a/drivers/media/i2c/ov5670.c
+++ b/drivers/media/i2c/ov5670.c
@@ -2258,6 +2258,25 @@ static int ov5670_set_pad_format(struct v4l2_subdev *sd,
 	return 0;
 }

+static int ov5670_get_selection(struct v4l2_subdev *sd,
+				struct v4l2_subdev_pad_config *cfg,
+				struct v4l2_subdev_selection *sel)
+{
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+	case V4L2_SEL_TGT_NATIVE_SIZE:
+		sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.width = 2592;
+		sel->r.height = 1944;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int ov5670_get_skip_frames(struct v4l2_subdev *sd, u32 *frames)
 {
 	*frames = OV5670_NUM_OF_SKIP_FRAMES;
@@ -2425,6 +2444,7 @@ static const struct v4l2_subdev_pad_ops ov5670_pad_ops = {
 	.enum_mbus_code = ov5670_enum_mbus_code,
 	.get_fmt = ov5670_get_pad_format,
 	.set_fmt = ov5670_set_pad_format,
+	.get_selection = ov5670_get_selection,
 	.enum_frame_size = ov5670_enum_frame_size,
 };

--
2.22.0


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

* [PATCH 2/2] media: i2c: ov13858: Report native size and crop bounds
  2019-08-17 10:44 [PATCH 1/2] media: i2c: ov5670: Report native size and crop bounds Jacopo Mondi
@ 2019-08-17 10:44 ` Jacopo Mondi
  0 siblings, 0 replies; 2+ messages in thread
From: Jacopo Mondi @ 2019-08-17 10:44 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Hans Verkuil, Sakari Ailus, Laurent Pinchart
  Cc: Jacopo Mondi, open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)

Report the native pixel array size and the crop bounds for the ov13858
sensor driver.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 drivers/media/i2c/ov13858.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
index 838a6c6136a8..32f46c1395eb 100644
--- a/drivers/media/i2c/ov13858.c
+++ b/drivers/media/i2c/ov13858.c
@@ -1402,6 +1402,30 @@ ov13858_set_pad_format(struct v4l2_subdev *sd,
 	return 0;
 }

+static int ov13858_get_selection(struct v4l2_subdev *sd,
+				 struct v4l2_subdev_pad_config *cfg,
+				 struct v4l2_subdev_selection *sel)
+{
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+		sel->r.left = 16;
+		sel->r.top = 16;
+		sel->r.width = 4224;
+		sel->r.height = 3136;
+		break;
+	case V4L2_SEL_TGT_NATIVE_SIZE:
+		sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.width = 4256;
+		sel->r.height = 3168;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int ov13858_get_skip_frames(struct v4l2_subdev *sd, u32 *frames)
 {
 	*frames = OV13858_NUM_OF_SKIP_FRAMES;
@@ -1565,6 +1589,7 @@ static const struct v4l2_subdev_pad_ops ov13858_pad_ops = {
 	.enum_mbus_code = ov13858_enum_mbus_code,
 	.get_fmt = ov13858_get_pad_format,
 	.set_fmt = ov13858_set_pad_format,
+	.get_selection = ov13858_get_selection,
 	.enum_frame_size = ov13858_enum_frame_size,
 };

--
2.22.0


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

end of thread, other threads:[~2019-08-17 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-17 10:44 [PATCH 1/2] media: i2c: ov5670: Report native size and crop bounds Jacopo Mondi
2019-08-17 10:44 ` [PATCH 2/2] media: i2c: ov13858: " Jacopo Mondi

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).