public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Berger <marbe@gmx.de>
To: Bryan O'Donoghue <bod@kernel.org>,
	Hans de Goede <hansg@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Marcel Berger <marbe@gmx.de>
Subject: [PATCH] media: i2c: ov02e10: Add get_selection support
Date: Sun, 26 Apr 2026 22:01:43 +0200	[thread overview]
Message-ID: <20260426200143.109896-1-marbe@gmx.de> (raw)

Signed-off-by: Marcel Berger <marbe@gmx.de>
---
 drivers/media/i2c/ov02e10.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/media/i2c/ov02e10.c b/drivers/media/i2c/ov02e10.c
index 4a64cba..097188f 100644
--- a/drivers/media/i2c/ov02e10.c
+++ b/drivers/media/i2c/ov02e10.c
@@ -655,6 +655,30 @@ static int ov02e10_get_format(struct v4l2_subdev *sd,
 	return 0;
 }
 
+static int ov02e10_get_selection(struct v4l2_subdev *sd,
+				 struct v4l2_subdev_state *sd_state,
+				 struct v4l2_subdev_selection *sel)
+{
+	struct ov02e10 *ov02e10 = to_ov02e10(sd);
+
+	if (sel->pad != 0)
+		return -EINVAL;
+
+	switch (sel->target) {
+	case V4L2_SEL_TGT_CROP:
+	case V4L2_SEL_TGT_CROP_DEFAULT:
+	case V4L2_SEL_TGT_CROP_BOUNDS:
+	case V4L2_SEL_TGT_NATIVE_SIZE:
+		sel->r.left = 0;
+		sel->r.top = 0;
+		sel->r.width = ov02e10->cur_mode->width;
+		sel->r.height = ov02e10->cur_mode->height;
+		return 0;
+	default:
+		return -EINVAL;
+	}
+}
+
 static int ov02e10_enum_mbus_code(struct v4l2_subdev *sd,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_mbus_code_enum *code)
@@ -703,6 +727,7 @@ static const struct v4l2_subdev_pad_ops ov02e10_pad_ops = {
 	.get_fmt = ov02e10_get_format,
 	.enum_mbus_code = ov02e10_enum_mbus_code,
 	.enum_frame_size = ov02e10_enum_frame_size,
+	.get_selection = ov02e10_get_selection,
 	.enable_streams = ov02e10_enable_streams,
 	.disable_streams = ov02e10_disable_streams,
 };
-- 
2.53.0


             reply	other threads:[~2026-04-26 20:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-26 20:01 Marcel Berger [this message]
2026-04-30 10:57 ` [PATCH] media: i2c: ov02e10: Add get_selection support Kieran Bingham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260426200143.109896-1-marbe@gmx.de \
    --to=marbe@gmx.de \
    --cc=bod@kernel.org \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox