summaryrefslogtreecommitdiff
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorTommaso Merciai <tomm.merciai@gmail.com>2024-06-10 11:10:33 +0300
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2024-06-15 12:16:39 +0300
commitb6167cce2b1c3bc5eae967977964dfdaef971398 (patch)
treea87ad609acde370a7a5a2bca47ecd514fef6aebe /drivers/media/i2c
parent50b631c6ecb33d45fe6919645bf19fdd3ab82f26 (diff)
downloadlinux-b6167cce2b1c3bc5eae967977964dfdaef971398.tar.xz
media: i2c: alvium: implement enum_frame_size
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> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/alvium-csi2.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c
index a88809333e56..c27c6fcaede4 100644
--- a/drivers/media/i2c/alvium-csi2.c
+++ b/drivers/media/i2c/alvium-csi2.c
@@ -1722,6 +1722,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)
{
@@ -2229,6 +2250,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,