From: Felipe Calliari <calliarifelipe@gmail.com>
To: linux-media@vger.kernel.org
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
Hans de Goede <hansg@kernel.org>,
Bryan O'Donoghue <bod@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Tomas Moro <tmorolias@gmail.com>,
linux-kernel@vger.kernel.org,
Felipe Calliari <calliarifelipe@gmail.com>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Subject: [PATCH v2 2/3] media: ov02c10: Implement get_selection
Date: Wed, 23 Sep 2026 11:42:56 -0300 [thread overview]
Message-ID: <20260923144257.119076-3-calliarifelipe@gmail.com> (raw)
In-Reply-To: <20260923144257.119076-1-calliarifelipe@gmail.com>
The driver does not implement .get_selection, so userspace cannot query
the sensor's native size or active crop rectangle. libcamera reports
"Unable to get rectangle N on pad 0/0: Inappropriate ioctl for device"
and "The sensor kernel driver needs to be fixed" (see
Documentation/sensor_driver_requirements.rst).
Implement .get_selection returning the fixed geometry of the sensor:
- V4L2_SEL_TGT_NATIVE_SIZE / V4L2_SEL_TGT_CROP_BOUNDS: the full
1928x1092 pixel array.
- V4L2_SEL_TGT_CROP / V4L2_SEL_TGT_CROP_DEFAULT: the 1920x1080 active
area, offset by (4, 6), matching the readout window programmed in
sensor_1928x1092_30fps_setting[] (registers 0x3800-0x3807).
The crop is fixed, so sd_state is not consulted.
Signed-off-by: Felipe Calliari <calliarifelipe@gmail.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Mars-Wave <tmorolias@gmail.com> # Samsung Galaxy Book3 Pro NP960XFG (github.com/MarsWave)
---
Changes in v2:
- Add the const struct v4l2_subdev_client_info * argument that
.get_selection now takes in media next.
- Picked up the Reviewed-by and Tested-by tags.
drivers/media/i2c/ov02c10.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/media/i2c/ov02c10.c b/drivers/media/i2c/ov02c10.c
index 730a40e94..cdccbdef3 100644
--- a/drivers/media/i2c/ov02c10.c
+++ b/drivers/media/i2c/ov02c10.c
@@ -10,6 +10,7 @@
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <media/v4l2-cci.h>
+#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
@@ -18,6 +19,13 @@
#define OV02C10_MCLK 19200000
#define OV02C10_RGB_DEPTH 10
+#define OV02C10_NATIVE_WIDTH 1928
+#define OV02C10_NATIVE_HEIGHT 1092
+#define OV02C10_ACTIVE_WIDTH 1920
+#define OV02C10_ACTIVE_HEIGHT 1080
+#define OV02C10_ACTIVE_LEFT 4
+#define OV02C10_ACTIVE_TOP 6
+
#define OV02C10_REG_CHIP_ID CCI_REG16(0x300a)
#define OV02C10_CHIP_ID 0x5602
@@ -768,11 +776,37 @@ static const struct v4l2_subdev_video_ops ov02c10_video_ops = {
.s_stream = v4l2_subdev_s_stream_helper,
};
+static int ov02c10_get_selection(struct v4l2_subdev *sd,
+ const struct v4l2_subdev_client_info *ci,
+ struct v4l2_subdev_state *sd_state,
+ struct v4l2_subdev_selection *sel)
+{
+ switch (sel->target) {
+ case V4L2_SEL_TGT_NATIVE_SIZE:
+ case V4L2_SEL_TGT_CROP_BOUNDS:
+ sel->r.top = 0;
+ sel->r.left = 0;
+ sel->r.width = OV02C10_NATIVE_WIDTH;
+ sel->r.height = OV02C10_NATIVE_HEIGHT;
+ return 0;
+ case V4L2_SEL_TGT_CROP:
+ case V4L2_SEL_TGT_CROP_DEFAULT:
+ sel->r.top = OV02C10_ACTIVE_TOP;
+ sel->r.left = OV02C10_ACTIVE_LEFT;
+ sel->r.width = OV02C10_ACTIVE_WIDTH;
+ sel->r.height = OV02C10_ACTIVE_HEIGHT;
+ return 0;
+ }
+
+ return -EINVAL;
+}
+
static const struct v4l2_subdev_pad_ops ov02c10_pad_ops = {
.set_fmt = ov02c10_set_format,
.get_fmt = v4l2_subdev_get_fmt,
.enum_mbus_code = ov02c10_enum_mbus_code,
.enum_frame_size = ov02c10_enum_frame_size,
+ .get_selection = ov02c10_get_selection,
.enable_streams = ov02c10_enable_streams,
.disable_streams = ov02c10_disable_streams,
};
--
2.55.0
next prev parent reply other threads:[~2026-09-23 14:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Tms-fUHfw0sPf1-YX_rgSNq7z1MNyvtfCImHXhxAUQAoTq-fwKvZF-p8a3ozCxAJ7kJCo-lKEU_JSkfUJy6oIA==@protonmail.internalid>
2026-09-05 3:07 ` [PATCH 1/3] media: ov02c10: Drop duplicate register write Felipe Calliari
2026-09-05 3:07 ` [PATCH 2/3] media: ov02c10: Implement get_selection Felipe Calliari
2026-09-08 9:07 ` Bryan O'Donoghue
2026-09-05 3:07 ` [PATCH 3/3] media: ov02c10: Accept a 26 MHz external clock Felipe Calliari
2026-09-08 8:06 ` Sakari Ailus
2026-09-09 2:55 ` Felipe Calliari
2026-09-08 9:21 ` Bryan O'Donoghue
2026-09-22 6:35 ` Tomas Moro
2026-09-08 9:04 ` [PATCH 1/3] media: ov02c10: Drop duplicate register write Bryan O'Donoghue
2026-09-23 14:42 ` [PATCH v2 0/3] media: ov02c10: get_selection and 26 MHz clock support Felipe Calliari
2026-09-23 14:42 ` [PATCH v2 1/3] media: ov02c10: Drop duplicate register write Felipe Calliari
2026-09-23 14:42 ` Felipe Calliari [this message]
2026-09-23 14:42 ` [PATCH v2 3/3] media: ov02c10: Accept a 26 MHz external clock Felipe Calliari
2026-09-23 20:54 ` Sakari Ailus
2026-09-23 23:40 ` [PATCH v3 0/5] media: ov02c10: get_selection and 26 MHz clock support Felipe Calliari
2026-09-23 23:40 ` [PATCH v3 1/5] media: ov02c10: Drop duplicate register write Felipe Calliari
2026-09-23 23:40 ` [PATCH v3 2/5] media: ov02c10: Implement get_selection Felipe Calliari
2026-09-23 23:40 ` [PATCH v3 3/5] media: ov02c10: Split the PLL registers off the mode tables Felipe Calliari
2026-10-02 20:46 ` Sakari Ailus
2026-09-23 23:40 ` [PATCH v3 4/5] media: ipu-bridge: Add the OV02C10 26 MHz link frequency Felipe Calliari
2026-09-23 23:41 ` [PATCH v3 5/5] media: ov02c10: Add support for a 26 MHz external clock Felipe Calliari
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=20260923144257.119076-3-calliarifelipe@gmail.com \
--to=calliarifelipe@gmail.com \
--cc=bod@kernel.org \
--cc=bryan.odonoghue@linaro.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 \
--cc=tmorolias@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.