]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: renesas: vsp1: Store size limits in vsp1_entity
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Wed, 18 Mar 2026 23:58:56 +0000 (01:58 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 25 Mar 2026 09:25:48 +0000 (10:25 +0100)
Most entities use the vsp1_subdev_enum_frame_size() and
vsp1_subdev_set_pad_format() helper functions to implement the
corresponding subdev operations. Both helpers are given the minimum and
maximum sizes supported by the entity as arguments, requiring each
entity to implement a wrapper.

Replace the function arguments with storing the size limits in the
vsp1_entity structure. This allows dropping most of the
.enum_frame_size() and .set_fmt() wrappers in entities.

Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # HiHope RZ/G2M
Link: https://patch.msgid.link/20260318235907.831556-3-laurent.pinchart+renesas@ideasonboard.com
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
16 files changed:
drivers/media/platform/renesas/vsp1/vsp1_brx.c
drivers/media/platform/renesas/vsp1/vsp1_clu.c
drivers/media/platform/renesas/vsp1/vsp1_entity.c
drivers/media/platform/renesas/vsp1/vsp1_entity.h
drivers/media/platform/renesas/vsp1/vsp1_histo.c
drivers/media/platform/renesas/vsp1/vsp1_hsit.c
drivers/media/platform/renesas/vsp1/vsp1_iif.c
drivers/media/platform/renesas/vsp1/vsp1_lif.c
drivers/media/platform/renesas/vsp1/vsp1_lut.c
drivers/media/platform/renesas/vsp1/vsp1_rpf.c
drivers/media/platform/renesas/vsp1/vsp1_rwpf.c
drivers/media/platform/renesas/vsp1/vsp1_rwpf.h
drivers/media/platform/renesas/vsp1/vsp1_sru.c
drivers/media/platform/renesas/vsp1/vsp1_uds.c
drivers/media/platform/renesas/vsp1/vsp1_uif.c
drivers/media/platform/renesas/vsp1/vsp1_wpf.c

index 3890adc8073edc8e4553de72079948974fd4d987..dd651cef93e4e452afdcf396427f33bd678b50af 100644 (file)
@@ -410,6 +410,10 @@ struct vsp1_brx *vsp1_brx_create(struct vsp1_device *vsp1,
        brx->entity.type = type;
        brx->entity.codes = brx_codes;
        brx->entity.num_codes = ARRAY_SIZE(brx_codes);
+       brx->entity.min_width = BRX_MIN_SIZE;
+       brx->entity.max_width = BRX_MAX_SIZE;
+       brx->entity.min_height = BRX_MIN_SIZE;
+       brx->entity.max_height = BRX_MAX_SIZE;
 
        if (type == VSP1_ENTITY_BRU) {
                num_pads = vsp1->info->num_bru_inputs + 1;
index a16c9c941512e4e8eb9b147bd43bd9faadbb2fe4..a56c038a2c71a68b87ab1f8c51964a50a0cfc48a 100644 (file)
@@ -113,7 +113,7 @@ static const struct v4l2_ctrl_config clu_mode_control = {
 };
 
 /* -----------------------------------------------------------------------------
- * V4L2 Subdevice Pad Operations
+ * V4L2 Subdevice Operations
  */
 
 static const unsigned int clu_codes[] = {
@@ -122,33 +122,11 @@ static const unsigned int clu_codes[] = {
        MEDIA_BUS_FMT_AYUV8_1X32,
 };
 
-static int clu_enum_frame_size(struct v4l2_subdev *subdev,
-                              struct v4l2_subdev_state *sd_state,
-                              struct v4l2_subdev_frame_size_enum *fse)
-{
-       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse,
-                                          CLU_MIN_SIZE, CLU_MIN_SIZE,
-                                          CLU_MAX_SIZE, CLU_MAX_SIZE);
-}
-
-static int clu_set_format(struct v4l2_subdev *subdev,
-                         struct v4l2_subdev_state *sd_state,
-                         struct v4l2_subdev_format *fmt)
-{
-       return vsp1_subdev_set_pad_format(subdev, sd_state, fmt,
-                                         CLU_MIN_SIZE, CLU_MIN_SIZE,
-                                         CLU_MAX_SIZE, CLU_MAX_SIZE);
-}
-
-/* -----------------------------------------------------------------------------
- * V4L2 Subdevice Operations
- */
-
 static const struct v4l2_subdev_pad_ops clu_pad_ops = {
        .enum_mbus_code = vsp1_subdev_enum_mbus_code,
-       .enum_frame_size = clu_enum_frame_size,
+       .enum_frame_size = vsp1_subdev_enum_frame_size,
        .get_fmt = vsp1_subdev_get_pad_format,
-       .set_fmt = clu_set_format,
+       .set_fmt = vsp1_subdev_set_pad_format,
 };
 
 static const struct v4l2_subdev_ops clu_ops = {
@@ -239,6 +217,10 @@ struct vsp1_clu *vsp1_clu_create(struct vsp1_device *vsp1)
        clu->entity.type = VSP1_ENTITY_CLU;
        clu->entity.codes = clu_codes;
        clu->entity.num_codes = ARRAY_SIZE(clu_codes);
+       clu->entity.min_width = CLU_MIN_SIZE;
+       clu->entity.min_height = CLU_MIN_SIZE;
+       clu->entity.max_width = CLU_MAX_SIZE;
+       clu->entity.max_height = CLU_MAX_SIZE;
 
        ret = vsp1_entity_init(vsp1, &clu->entity, "clu", 2, &clu_ops,
                               MEDIA_ENT_F_PROC_VIDEO_LUT);
index 7ae1e5ab1af6ee61cfa363c32a9d242f6c802ff9..04b7ae6fb93554904b67439a0c0d8021202636c5 100644 (file)
@@ -227,10 +227,6 @@ int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev,
  * @subdev: V4L2 subdevice
  * @sd_state: V4L2 subdev state
  * @fse: Frame size enumeration
- * @min_width: Minimum image width
- * @min_height: Minimum image height
- * @max_width: Maximum image width
- * @max_height: Maximum image height
  *
  * This function implements the subdev enum_frame_size pad operation for
  * entities that do not support scaling or cropping. It reports the given
@@ -239,9 +235,7 @@ int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev,
  */
 int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev,
                                struct v4l2_subdev_state *sd_state,
-                               struct v4l2_subdev_frame_size_enum *fse,
-                               unsigned int min_width, unsigned int min_height,
-                               unsigned int max_width, unsigned int max_height)
+                               struct v4l2_subdev_frame_size_enum *fse)
 {
        struct vsp1_entity *entity = to_vsp1_entity(subdev);
        struct v4l2_subdev_state *state;
@@ -262,10 +256,10 @@ int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev,
        }
 
        if (fse->pad == 0) {
-               fse->min_width = min_width;
-               fse->max_width = max_width;
-               fse->min_height = min_height;
-               fse->max_height = max_height;
+               fse->min_width = entity->min_width;
+               fse->max_width = entity->max_width;
+               fse->min_height = entity->min_height;
+               fse->max_height = entity->max_height;
        } else {
                /*
                 * The size on the source pad are fixed and always identical to
@@ -287,22 +281,15 @@ done:
  * @subdev: V4L2 subdevice
  * @sd_state: V4L2 subdev state
  * @fmt: V4L2 subdev format
- * @min_width: Minimum image width
- * @min_height: Minimum image height
- * @max_width: Maximum image width
- * @max_height: Maximum image height
  *
  * This function implements the subdev set_fmt pad operation for entities that
  * do not support scaling or cropping. It defaults to the first supported media
  * bus code if the requested code isn't supported, clamps the size to the
- * supplied minimum and maximum, and propagates the sink pad format to the
- * source pad.
+ * entity's limits, and propagates the sink pad format to the source pad.
  */
 int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
                               struct v4l2_subdev_state *sd_state,
-                              struct v4l2_subdev_format *fmt,
-                              unsigned int min_width, unsigned int min_height,
-                              unsigned int max_width, unsigned int max_height)
+                              struct v4l2_subdev_format *fmt)
 {
        struct vsp1_entity *entity = to_vsp1_entity(subdev);
        struct v4l2_subdev_state *state;
@@ -339,9 +326,9 @@ int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
        format->code = i < entity->num_codes
                     ? entity->codes[i] : entity->codes[0];
        format->width = clamp_t(unsigned int, fmt->format.width,
-                               min_width, max_width);
+                               entity->min_width, entity->max_width);
        format->height = clamp_t(unsigned int, fmt->format.height,
-                                min_height, max_height);
+                                entity->min_height, entity->max_height);
        format->field = V4L2_FIELD_NONE;
 
        format->colorspace = fmt->format.colorspace;
index 13ee95402234e12dee5f2704f83b373aac9f64d9..88daf83cd1ab7d6dbd16c98eaaf6cf9300423d68 100644 (file)
@@ -115,6 +115,10 @@ struct vsp1_entity {
 
        const u32 *codes;
        unsigned int num_codes;
+       unsigned int min_width;
+       unsigned int min_height;
+       unsigned int max_width;
+       unsigned int max_height;
 
        struct vsp1_pipeline *pipe;
 
@@ -183,16 +187,12 @@ int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev,
                               struct v4l2_subdev_format *fmt);
 int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev,
                               struct v4l2_subdev_state *sd_state,
-                              struct v4l2_subdev_format *fmt,
-                              unsigned int min_width, unsigned int min_height,
-                              unsigned int max_width, unsigned int max_height);
+                              struct v4l2_subdev_format *fmt);
 int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev,
                               struct v4l2_subdev_state *sd_state,
                               struct v4l2_subdev_mbus_code_enum *code);
 int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev,
                                struct v4l2_subdev_state *sd_state,
-                               struct v4l2_subdev_frame_size_enum *fse,
-                               unsigned int min_w, unsigned int min_h,
-                               unsigned int max_w, unsigned int max_h);
+                               struct v4l2_subdev_frame_size_enum *fse);
 
 #endif /* __VSP1_ENTITY_H__ */
index 26621bfe4f47c5d41e70903d9655dd62984788aa..d7843c170f944df00bef836815d1823f0d25d2b5 100644 (file)
@@ -182,9 +182,7 @@ static int histo_enum_frame_size(struct v4l2_subdev *subdev,
        if (fse->pad != HISTO_PAD_SINK)
                return -EINVAL;
 
-       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse,
-                                          HISTO_MIN_SIZE, HISTO_MIN_SIZE,
-                                          HISTO_MAX_SIZE, HISTO_MAX_SIZE);
+       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse);
 }
 
 static int histo_get_selection(struct v4l2_subdev *subdev,
@@ -359,9 +357,7 @@ static int histo_set_format(struct v4l2_subdev *subdev,
                return 0;
        }
 
-       return vsp1_subdev_set_pad_format(subdev, sd_state, fmt,
-                                         HISTO_MIN_SIZE, HISTO_MIN_SIZE,
-                                         HISTO_MAX_SIZE, HISTO_MAX_SIZE);
+       return vsp1_subdev_set_pad_format(subdev, sd_state, fmt);
 }
 
 static const struct v4l2_subdev_pad_ops histo_pad_ops = {
@@ -498,6 +494,10 @@ int vsp1_histogram_init(struct vsp1_device *vsp1, struct vsp1_histogram *histo,
        histo->entity.type = type;
        histo->entity.codes = formats;
        histo->entity.num_codes = num_formats;
+       histo->entity.min_width = HISTO_MIN_SIZE;
+       histo->entity.min_height = HISTO_MIN_SIZE;
+       histo->entity.max_width = HISTO_MAX_SIZE;
+       histo->entity.max_height = HISTO_MAX_SIZE;
 
        ret = vsp1_entity_init(vsp1, &histo->entity, name, 2, &histo_ops,
                               MEDIA_ENT_F_PROC_VIDEO_STATISTICS);
index 927dc185b8f772e0f5e2a4e3d859328cd2b17c34..8260934db7892340a7ccd7b0504690d145902401 100644 (file)
@@ -57,15 +57,6 @@ static int hsit_enum_mbus_code(struct v4l2_subdev *subdev,
        return 0;
 }
 
-static int hsit_enum_frame_size(struct v4l2_subdev *subdev,
-                               struct v4l2_subdev_state *sd_state,
-                               struct v4l2_subdev_frame_size_enum *fse)
-{
-       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse,
-                                          HSIT_MIN_SIZE, HSIT_MIN_SIZE,
-                                          HSIT_MAX_SIZE, HSIT_MAX_SIZE);
-}
-
 static int hsit_set_format(struct v4l2_subdev *subdev,
                           struct v4l2_subdev_state *sd_state,
                           struct v4l2_subdev_format *fmt)
@@ -126,7 +117,7 @@ done:
 
 static const struct v4l2_subdev_pad_ops hsit_pad_ops = {
        .enum_mbus_code = hsit_enum_mbus_code,
-       .enum_frame_size = hsit_enum_frame_size,
+       .enum_frame_size = vsp1_subdev_enum_frame_size,
        .get_fmt = vsp1_subdev_get_pad_format,
        .set_fmt = hsit_set_format,
 };
@@ -181,6 +172,10 @@ struct vsp1_hsit *vsp1_hsit_create(struct vsp1_device *vsp1, bool inverse)
 
        hsit->entity.codes = hsit_codes;
        hsit->entity.num_codes = ARRAY_SIZE(hsit_codes);
+       hsit->entity.min_width = HSIT_MIN_SIZE;
+       hsit->entity.min_height = HSIT_MIN_SIZE;
+       hsit->entity.max_width = HSIT_MAX_SIZE;
+       hsit->entity.max_height = HSIT_MAX_SIZE;
 
        ret = vsp1_entity_init(vsp1, &hsit->entity, inverse ? "hsi" : "hst",
                               2, &hsit_ops,
index 7ba792892373787d8e9984f4db30e2bef08b42af..d44c04e140bcb577164b20e376929c327b34fa18 100644 (file)
@@ -36,29 +36,11 @@ static const unsigned int iif_codes[] = {
        MEDIA_BUS_FMT_METADATA_FIXED
 };
 
-static int iif_enum_frame_size(struct v4l2_subdev *subdev,
-                              struct v4l2_subdev_state *sd_state,
-                              struct v4l2_subdev_frame_size_enum *fse)
-{
-       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse,
-                                          IIF_MIN_WIDTH, IIF_MIN_HEIGHT,
-                                          IIF_MAX_WIDTH, IIF_MAX_HEIGHT);
-}
-
-static int iif_set_format(struct v4l2_subdev *subdev,
-                         struct v4l2_subdev_state *sd_state,
-                         struct v4l2_subdev_format *fmt)
-{
-       return vsp1_subdev_set_pad_format(subdev, sd_state, fmt,
-                                         IIF_MIN_WIDTH, IIF_MIN_HEIGHT,
-                                         IIF_MAX_WIDTH, IIF_MAX_HEIGHT);
-}
-
 static const struct v4l2_subdev_pad_ops iif_pad_ops = {
        .enum_mbus_code = vsp1_subdev_enum_mbus_code,
-       .enum_frame_size = iif_enum_frame_size,
+       .enum_frame_size = vsp1_subdev_enum_frame_size,
        .get_fmt = vsp1_subdev_get_pad_format,
-       .set_fmt = iif_set_format,
+       .set_fmt = vsp1_subdev_set_pad_format,
 };
 
 static const struct v4l2_subdev_ops iif_ops = {
@@ -99,6 +81,10 @@ struct vsp1_iif *vsp1_iif_create(struct vsp1_device *vsp1)
        iif->entity.type = VSP1_ENTITY_IIF;
        iif->entity.codes = iif_codes;
        iif->entity.num_codes = ARRAY_SIZE(iif_codes);
+       iif->entity.min_width = IIF_MIN_WIDTH;
+       iif->entity.min_height = IIF_MIN_HEIGHT;
+       iif->entity.max_width = IIF_MAX_WIDTH;
+       iif->entity.max_height = IIF_MAX_HEIGHT;
 
        /*
         * The IIF is never exposed to userspace, but media entity registration
index 6c1cbe2d852413624251a3f90b03cccec4d44e14..1ebb88b3e4c90e7f3e739a47d24c7186491cd5c5 100644 (file)
@@ -39,29 +39,11 @@ static const unsigned int lif_codes[] = {
        MEDIA_BUS_FMT_AYUV8_1X32,
 };
 
-static int lif_enum_frame_size(struct v4l2_subdev *subdev,
-                              struct v4l2_subdev_state *sd_state,
-                              struct v4l2_subdev_frame_size_enum *fse)
-{
-       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse,
-                                          LIF_MIN_SIZE, LIF_MIN_SIZE,
-                                          LIF_MAX_SIZE, LIF_MAX_SIZE);
-}
-
-static int lif_set_format(struct v4l2_subdev *subdev,
-                         struct v4l2_subdev_state *sd_state,
-                         struct v4l2_subdev_format *fmt)
-{
-       return vsp1_subdev_set_pad_format(subdev, sd_state, fmt,
-                                         LIF_MIN_SIZE, LIF_MIN_SIZE,
-                                         LIF_MAX_SIZE, LIF_MAX_SIZE);
-}
-
 static const struct v4l2_subdev_pad_ops lif_pad_ops = {
        .enum_mbus_code = vsp1_subdev_enum_mbus_code,
-       .enum_frame_size = lif_enum_frame_size,
+       .enum_frame_size = vsp1_subdev_enum_frame_size,
        .get_fmt = vsp1_subdev_get_pad_format,
-       .set_fmt = lif_set_format,
+       .set_fmt = vsp1_subdev_set_pad_format,
 };
 
 static const struct v4l2_subdev_ops lif_ops = {
@@ -154,6 +136,10 @@ struct vsp1_lif *vsp1_lif_create(struct vsp1_device *vsp1, unsigned int index)
        lif->entity.index = index;
        lif->entity.codes = lif_codes;
        lif->entity.num_codes = ARRAY_SIZE(lif_codes);
+       lif->entity.min_width = LIF_MIN_SIZE;
+       lif->entity.min_height = LIF_MIN_SIZE;
+       lif->entity.max_width = LIF_MAX_SIZE;
+       lif->entity.max_height = LIF_MAX_SIZE;
 
        /*
         * The LIF is never exposed to userspace, but media entity registration
index 46c79cdccd699a578d3439c9ebcc0c66c51e9539..2ec4d596465d67d73320b046a9b93039051ec040 100644 (file)
@@ -89,7 +89,7 @@ static const struct v4l2_ctrl_config lut_table_control = {
 };
 
 /* -----------------------------------------------------------------------------
- * V4L2 Subdevice Pad Operations
+ * V4L2 Subdevice Operations
  */
 
 static const unsigned int lut_codes[] = {
@@ -98,33 +98,11 @@ static const unsigned int lut_codes[] = {
        MEDIA_BUS_FMT_AYUV8_1X32,
 };
 
-static int lut_enum_frame_size(struct v4l2_subdev *subdev,
-                              struct v4l2_subdev_state *sd_state,
-                              struct v4l2_subdev_frame_size_enum *fse)
-{
-       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse,
-                                          LUT_MIN_SIZE, LUT_MIN_SIZE,
-                                          LUT_MAX_SIZE, LUT_MAX_SIZE);
-}
-
-static int lut_set_format(struct v4l2_subdev *subdev,
-                         struct v4l2_subdev_state *sd_state,
-                         struct v4l2_subdev_format *fmt)
-{
-       return vsp1_subdev_set_pad_format(subdev, sd_state, fmt,
-                                         LUT_MIN_SIZE, LUT_MIN_SIZE,
-                                         LUT_MAX_SIZE, LUT_MAX_SIZE);
-}
-
-/* -----------------------------------------------------------------------------
- * V4L2 Subdevice Operations
- */
-
 static const struct v4l2_subdev_pad_ops lut_pad_ops = {
        .enum_mbus_code = vsp1_subdev_enum_mbus_code,
-       .enum_frame_size = lut_enum_frame_size,
+       .enum_frame_size = vsp1_subdev_enum_frame_size,
        .get_fmt = vsp1_subdev_get_pad_format,
-       .set_fmt = lut_set_format,
+       .set_fmt = vsp1_subdev_set_pad_format,
 };
 
 static const struct v4l2_subdev_ops lut_ops = {
@@ -200,6 +178,10 @@ struct vsp1_lut *vsp1_lut_create(struct vsp1_device *vsp1)
        lut->entity.type = VSP1_ENTITY_LUT;
        lut->entity.codes = lut_codes;
        lut->entity.num_codes = ARRAY_SIZE(lut_codes);
+       lut->entity.min_width = LUT_MIN_SIZE;
+       lut->entity.min_height = LUT_MIN_SIZE;
+       lut->entity.max_width = LUT_MAX_SIZE;
+       lut->entity.max_height = LUT_MAX_SIZE;
 
        ret = vsp1_entity_init(vsp1, &lut->entity, "lut", 2, &lut_ops,
                               MEDIA_ENT_F_PROC_VIDEO_LUT);
index 811f2b7c5cc5dbfbe08b6c06cd8ad1157fef4a89..34b9095c901182f4ef206b1b1e36f28add312296 100644 (file)
@@ -425,12 +425,13 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index)
        if (rpf == NULL)
                return ERR_PTR(-ENOMEM);
 
-       rpf->max_width = RPF_MAX_WIDTH;
-       rpf->max_height = RPF_MAX_HEIGHT;
-
        rpf->entity.ops = &rpf_entity_ops;
        rpf->entity.type = VSP1_ENTITY_RPF;
        rpf->entity.index = index;
+       rpf->entity.min_width = RWPF_MIN_WIDTH;
+       rpf->entity.min_height = RWPF_MIN_HEIGHT;
+       rpf->entity.max_width = RPF_MAX_WIDTH;
+       rpf->entity.max_height = RPF_MAX_HEIGHT;
 
        sprintf(name, "rpf.%u", index);
        ret = vsp1_entity_init(vsp1, &rpf->entity, name, 2, &vsp1_rwpf_subdev_ops,
index 304a2f6187776b9fca51e3847d832113f9645d2d..56464875a6c5e3b6e56e4ca6022a38bbee3ff22b 100644 (file)
@@ -14,9 +14,6 @@
 #include "vsp1_rwpf.h"
 #include "vsp1_video.h"
 
-#define RWPF_MIN_WIDTH                         1
-#define RWPF_MIN_HEIGHT                                1
-
 /* -----------------------------------------------------------------------------
  * V4L2 Subdevice Operations
  */
@@ -44,17 +41,6 @@ static int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev,
        return 0;
 }
 
-static int vsp1_rwpf_enum_frame_size(struct v4l2_subdev *subdev,
-                                    struct v4l2_subdev_state *sd_state,
-                                    struct v4l2_subdev_frame_size_enum *fse)
-{
-       struct vsp1_rwpf *rwpf = to_rwpf(subdev);
-
-       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse,
-                                          RWPF_MIN_WIDTH, RWPF_MIN_HEIGHT,
-                                          rwpf->max_width, rwpf->max_height);
-}
-
 static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
                                struct v4l2_subdev_state *sd_state,
                                struct v4l2_subdev_format *fmt)
@@ -125,9 +111,9 @@ static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev,
 
        format->code = fmt->format.code;
        format->width = clamp_t(unsigned int, fmt->format.width,
-                               RWPF_MIN_WIDTH, rwpf->max_width);
+                               RWPF_MIN_WIDTH, rwpf->entity.max_width);
        format->height = clamp_t(unsigned int, fmt->format.height,
-                                RWPF_MIN_HEIGHT, rwpf->max_height);
+                                RWPF_MIN_HEIGHT, rwpf->entity.max_height);
        format->field = V4L2_FIELD_NONE;
 
        format->colorspace = fmt->format.colorspace;
@@ -275,7 +261,7 @@ done:
 
 static const struct v4l2_subdev_pad_ops vsp1_rwpf_pad_ops = {
        .enum_mbus_code = vsp1_rwpf_enum_mbus_code,
-       .enum_frame_size = vsp1_rwpf_enum_frame_size,
+       .enum_frame_size = vsp1_subdev_enum_frame_size,
        .get_fmt = vsp1_subdev_get_pad_format,
        .set_fmt = vsp1_rwpf_set_format,
        .get_selection = vsp1_rwpf_get_selection,
index 5ac9f0a6fafcee955f32d768aafe8a87516908ae..89c1c8e8bb6d2fe467a2de84e015222bd2fb9dad 100644 (file)
@@ -21,6 +21,9 @@
 #define RWPF_PAD_SINK                          0
 #define RWPF_PAD_SOURCE                                1
 
+#define RWPF_MIN_WIDTH                         1
+#define RWPF_MIN_HEIGHT                                1
+
 struct v4l2_ctrl;
 struct vsp1_dl_manager;
 struct vsp1_rwpf;
@@ -36,9 +39,6 @@ struct vsp1_rwpf {
 
        struct vsp1_video *video;
 
-       unsigned int max_width;
-       unsigned int max_height;
-
        struct v4l2_pix_format_mplane format;
        const struct vsp1_format_info *fmtinfo;
        unsigned int brx_input;
index 8e587efc0dc2a48a8957b79e29bc5de909cfeceb..1dc34e6a510d24e0ebaca41da018e8785f9725b3 100644 (file)
@@ -364,6 +364,10 @@ struct vsp1_sru *vsp1_sru_create(struct vsp1_device *vsp1)
        sru->entity.type = VSP1_ENTITY_SRU;
        sru->entity.codes = sru_codes;
        sru->entity.num_codes = ARRAY_SIZE(sru_codes);
+       sru->entity.min_width = SRU_MIN_SIZE;
+       sru->entity.max_width = SRU_MAX_SIZE;
+       sru->entity.min_height = SRU_MIN_SIZE;
+       sru->entity.max_height = SRU_MAX_SIZE;
 
        ret = vsp1_entity_init(vsp1, &sru->entity, "sru", 2, &sru_ops,
                               MEDIA_ENT_F_PROC_VIDEO_SCALER);
index 928b09e20add009ae9bc4daacc8c8dbb77a4b61a..8006d49ffbea5e301edd3d7bcf24978671347b69 100644 (file)
@@ -404,6 +404,10 @@ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index)
        uds->entity.index = index;
        uds->entity.codes = uds_codes;
        uds->entity.num_codes = ARRAY_SIZE(uds_codes);
+       uds->entity.min_width = UDS_MIN_SIZE;
+       uds->entity.max_width = UDS_MAX_SIZE;
+       uds->entity.min_height = UDS_MIN_SIZE;
+       uds->entity.max_height = UDS_MAX_SIZE;
 
        sprintf(name, "uds.%u", index);
        ret = vsp1_entity_init(vsp1, &uds->entity, name, 2, &uds_ops,
index e1bb6c70972103cc6208760f7013b6d64e1aef96..3aefe5c9d421a77ac27dde2fb7ba2ba77c822c76 100644 (file)
@@ -53,24 +53,6 @@ static const unsigned int uif_codes[] = {
        MEDIA_BUS_FMT_AYUV8_1X32,
 };
 
-static int uif_enum_frame_size(struct v4l2_subdev *subdev,
-                              struct v4l2_subdev_state *sd_state,
-                              struct v4l2_subdev_frame_size_enum *fse)
-{
-       return vsp1_subdev_enum_frame_size(subdev, sd_state, fse,
-                                          UIF_MIN_SIZE, UIF_MIN_SIZE,
-                                          UIF_MAX_SIZE, UIF_MAX_SIZE);
-}
-
-static int uif_set_format(struct v4l2_subdev *subdev,
-                           struct v4l2_subdev_state *sd_state,
-                           struct v4l2_subdev_format *fmt)
-{
-       return vsp1_subdev_set_pad_format(subdev, sd_state, fmt,
-                                         UIF_MIN_SIZE, UIF_MIN_SIZE,
-                                         UIF_MAX_SIZE, UIF_MAX_SIZE);
-}
-
 static int uif_get_selection(struct v4l2_subdev *subdev,
                             struct v4l2_subdev_state *sd_state,
                             struct v4l2_subdev_selection *sel)
@@ -162,9 +144,9 @@ done:
 
 static const struct v4l2_subdev_pad_ops uif_pad_ops = {
        .enum_mbus_code = vsp1_subdev_enum_mbus_code,
-       .enum_frame_size = uif_enum_frame_size,
+       .enum_frame_size = vsp1_subdev_enum_frame_size,
        .get_fmt = vsp1_subdev_get_pad_format,
-       .set_fmt = uif_set_format,
+       .set_fmt = vsp1_subdev_set_pad_format,
        .get_selection = uif_get_selection,
        .set_selection = uif_set_selection,
 };
@@ -242,6 +224,10 @@ struct vsp1_uif *vsp1_uif_create(struct vsp1_device *vsp1, unsigned int index)
        uif->entity.index = index;
        uif->entity.codes = uif_codes;
        uif->entity.num_codes = ARRAY_SIZE(uif_codes);
+       uif->entity.min_width = UIF_MIN_SIZE;
+       uif->entity.min_height = UIF_MIN_SIZE;
+       uif->entity.max_width = UIF_MAX_SIZE;
+       uif->entity.max_height = UIF_MAX_SIZE;
 
        /* The datasheet names the two UIF instances UIF4 and UIF5. */
        sprintf(name, "uif.%u", index + 4);
index 30662cfdf83792cb1dba8f904c4290083c3c8b65..cd6c5592221b6ec2af0dae54cdcc268aff14f05d 100644 (file)
@@ -531,7 +531,7 @@ static unsigned int wpf_max_width(struct vsp1_entity *entity,
 {
        struct vsp1_rwpf *wpf = to_rwpf(&entity->subdev);
 
-       return wpf->flip.rotate ? 256 : wpf->max_width;
+       return wpf->flip.rotate ? 256 : wpf->entity.max_width;
 }
 
 static void wpf_partition(struct vsp1_entity *entity,
@@ -567,12 +567,15 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index)
        if (wpf == NULL)
                return ERR_PTR(-ENOMEM);
 
+       wpf->entity.min_width = RWPF_MIN_WIDTH;
+       wpf->entity.min_height = RWPF_MIN_HEIGHT;
+
        if (vsp1->info->gen == 2) {
-               wpf->max_width = WPF_GEN2_MAX_WIDTH;
-               wpf->max_height = WPF_GEN2_MAX_HEIGHT;
+               wpf->entity.max_width = WPF_GEN2_MAX_WIDTH;
+               wpf->entity.max_height = WPF_GEN2_MAX_HEIGHT;
        } else {
-               wpf->max_width = WPF_GEN3_MAX_WIDTH;
-               wpf->max_height = WPF_GEN3_MAX_HEIGHT;
+               wpf->entity.max_width = WPF_GEN3_MAX_WIDTH;
+               wpf->entity.max_height = WPF_GEN3_MAX_HEIGHT;
        }
 
        wpf->entity.ops = &wpf_entity_ops;