From: Tommaso Merciai <tomm.merciai@gmail.com>
Cc: martin.hecht@avnet.eu, michael.roeder@avnet.eu,
tomm.merciai@gmail.com,
Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] media: i2c: alvium: implement enum_frame_size
Date: Tue, 16 Apr 2024 16:19:04 +0200 [thread overview]
Message-ID: <20240416141905.454253-5-tomm.merciai@gmail.com> (raw)
In-Reply-To: <20240416141905.454253-1-tomm.merciai@gmail.com>
Implement the enum_frame_size pad operation.
The sensor supports a continuous size range of resolutions.
Signed-off-by: Tommaso Merciai <tomm.merciai@gmail.com>
---
drivers/media/i2c/alvium-csi2.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c
index 2ab4c7e563d2..30ef9b905211 100644
--- a/drivers/media/i2c/alvium-csi2.c
+++ b/drivers/media/i2c/alvium-csi2.c
@@ -1717,6 +1717,27 @@ alvium_code_to_pixfmt(struct alvium_dev *alvium, u32 code)
return &alvium->alvium_csi2_fmt[0];
}
+static int alvium_enum_frame_size(struct v4l2_subdev *sd,
+ struct v4l2_subdev_state *state,
+ struct v4l2_subdev_frame_size_enum *fse)
+{
+ struct alvium_dev *alvium = sd_to_alvium(sd);
+ const struct alvium_pixfmt *alvium_csi2_fmt;
+
+ if (fse->index)
+ return -EINVAL;
+
+ alvium_csi2_fmt = alvium_code_to_pixfmt(alvium, fse->code);
+ if (fse->code != alvium_csi2_fmt->code)
+ return -EINVAL;
+
+ fse->min_width = alvium->img_min_width;
+ fse->max_width = alvium->img_max_width;
+ fse->min_height = alvium->img_min_height;
+ fse->max_height = alvium->img_max_height;
+ return 0;
+}
+
static int alvium_set_mode(struct alvium_dev *alvium,
struct v4l2_subdev_state *state)
{
@@ -2224,6 +2245,7 @@ static const struct v4l2_subdev_video_ops alvium_video_ops = {
static const struct v4l2_subdev_pad_ops alvium_pad_ops = {
.enum_mbus_code = alvium_enum_mbus_code,
+ .enum_frame_size = alvium_enum_frame_size,
.get_fmt = v4l2_subdev_get_fmt,
.set_fmt = alvium_set_fmt,
.get_selection = alvium_get_selection,
--
2.34.1
next prev parent reply other threads:[~2024-04-16 14:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 14:19 [PATCH 0/5] Alvium improvements Tommaso Merciai
2024-04-16 14:19 ` [PATCH 1/5] media: i2c: alvium: fix alvium_get_fw_version() Tommaso Merciai
2024-04-24 18:10 ` Sakari Ailus
2024-04-16 14:19 ` [PATCH 2/5] media: i2c: alvium: rename acquisition frame rate enable reg Tommaso Merciai
2024-04-16 14:19 ` [PATCH 3/5] media: i2c: alvium: enable acquisition frame rate Tommaso Merciai
2024-04-16 14:19 ` Tommaso Merciai [this message]
2024-04-16 14:19 ` [PATCH 5/5] media: i2c: alvium: Move V4L2_CID_GAIN to V4L2_CID_ANALOG_GAIN Tommaso Merciai
2024-04-24 18:11 ` Sakari Ailus
2024-04-26 7:09 ` Tommaso Merciai
2024-04-26 7:13 ` Sakari Ailus
2024-04-26 8:41 ` Tommaso Merciai
2024-04-26 10:49 ` Sakari Ailus
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=20240416141905.454253-5-tomm.merciai@gmail.com \
--to=tomm.merciai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=martin.hecht@avnet.eu \
--cc=mchehab@kernel.org \
--cc=michael.roeder@avnet.eu \
/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
all inboxes | Powered by JetHome®