]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: mt9m114: Don't allow changing the IFP crop/compose selections when bypassing...
authorHans de Goede <johannes.goede@oss.qualcomm.com>
Tue, 30 Dec 2025 17:03:08 +0000 (18:03 +0100)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 14 Jan 2026 22:33:04 +0000 (23:33 +0100)
The scaler is bypassed when the ISP source/output pad's pixel-format is
set to MEDIA_BUS_FMT_SGRBG10_1X10. Don't allow changing the IFP crop and/or
compose selections when in this mode.

Instead of returning -EINVAL simply return the current (noop) crop and
compose rectangles.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/i2c/mt9m114.c

index c107e9f26618d6b0dd398065fc28789055190fe6..9743d83e9d0d6d425f63ec9b896f4414501a81a7 100644 (file)
@@ -1984,7 +1984,7 @@ static int mt9m114_ifp_set_selection(struct v4l2_subdev *sd,
                                     struct v4l2_subdev_state *state,
                                     struct v4l2_subdev_selection *sel)
 {
-       struct v4l2_mbus_framefmt *format;
+       struct v4l2_mbus_framefmt *format, *src_format;
        struct v4l2_rect *crop;
        struct v4l2_rect *compose;
        unsigned int border;
@@ -1997,8 +1997,16 @@ static int mt9m114_ifp_set_selection(struct v4l2_subdev *sd,
        if (sel->pad != 0)
                return -EINVAL;
 
-       format = v4l2_subdev_state_get_format(state, 0);
        crop = v4l2_subdev_state_get_crop(state, 0);
+
+       /* Crop and compose cannot be changed when bypassing the scaler. */
+       src_format = v4l2_subdev_state_get_format(state, 1);
+       if (src_format->code == MEDIA_BUS_FMT_SGRBG10_1X10) {
+               sel->r = *crop;
+               return 0;
+       }
+
+       format = v4l2_subdev_state_get_format(state, 0);
        compose = v4l2_subdev_state_get_compose(state, 0);
 
        if (sel->target == V4L2_SEL_TGT_CROP) {
@@ -2043,9 +2051,8 @@ static int mt9m114_ifp_set_selection(struct v4l2_subdev *sd,
        }
 
        /* Propagate the compose rectangle to the source format. */
-       format = v4l2_subdev_state_get_format(state, 1);
-       format->width = compose->width;
-       format->height = compose->height;
+       src_format->width = compose->width;
+       src_format->height = compose->height;
 
        return 0;
 }