media: camss: __video_try_fmt(): don't use hardcoded constants
authorAndrey Konovalov <andrey.konovalov@linaro.org>
Fri, 14 Aug 2020 20:54:03 +0000 (22:54 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 29 Aug 2020 06:18:30 +0000 (08:18 +0200)
Use the definitions introduced by commit "media: camss: add support
for vidioc_enum_framesizes ioctl" instead of the hardcoded values.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/camss/camss-video.c

index 84eb545..114c3ae 100644 (file)
@@ -670,7 +670,7 @@ static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f)
                                                  1, 65528);
                        sizeimage[i] = clamp_t(u32, p->sizeimage,
                                               bytesperline[i],
-                                              bytesperline[i] * 4096);
+                                              bytesperline[i] * CAMSS_FRAME_MAX_HEIGHT_PIX);
                }
 
        for (j = 0; j < video->nformats; j++)
@@ -687,8 +687,8 @@ static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f)
        memset(pix_mp, 0, sizeof(*pix_mp));
 
        pix_mp->pixelformat = fi->pixelformat;
-       pix_mp->width = clamp_t(u32, width, 1, 8191);
-       pix_mp->height = clamp_t(u32, height, 1, 8191);
+       pix_mp->width = clamp_t(u32, width, 1, CAMSS_FRAME_MAX_WIDTH);
+       pix_mp->height = clamp_t(u32, height, 1, CAMSS_FRAME_MAX_HEIGHT_RDI);
        pix_mp->num_planes = fi->planes;
        for (i = 0; i < pix_mp->num_planes; i++) {
                bpl = pix_mp->width / fi->hsub[i].numerator *
@@ -714,7 +714,7 @@ static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f)
                                                  1, 65528);
                        p->sizeimage = clamp_t(u32, p->sizeimage,
                                               p->bytesperline,
-                                              p->bytesperline * 4096);
+                                              p->bytesperline * CAMSS_FRAME_MAX_HEIGHT_PIX);
                        lines = p->sizeimage / p->bytesperline;
 
                        if (p->bytesperline < bytesperline[i])