]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: atmel: atmel-isc-base: fix enum calls default format
authorEugen Hristev <eugen.hristev@microchip.com>
Mon, 25 Nov 2019 08:32:53 +0000 (09:32 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 16 Dec 2019 09:16:01 +0000 (10:16 +0100)
With some sensors, the mbus code must match the one that sensor supports.
In this case we should initialize the mbus_code of the fse/fie before
calling the subdev, and not after.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/atmel/atmel-isc-base.c

index 337499d75e69515de6d0a4d8a6397e6849aa84d4..1843c1d5635056dbf635e8b3d22dffa009789c07 100644 (file)
@@ -1437,6 +1437,7 @@ static int isc_enum_framesizes(struct file *file, void *fh,
 {
        struct isc_device *isc = video_drvdata(file);
        struct v4l2_subdev_frame_size_enum fse = {
+               .code = isc->config.sd_format->mbus_code,
                .index = fsize->index,
                .which = V4L2_SUBDEV_FORMAT_ACTIVE,
        };
@@ -1459,8 +1460,6 @@ static int isc_enum_framesizes(struct file *file, void *fh,
        if (ret)
                return ret;
 
-       fse.code = isc->config.sd_format->mbus_code;
-
        fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
        fsize->discrete.width = fse.max_width;
        fsize->discrete.height = fse.max_height;
@@ -1473,6 +1472,7 @@ static int isc_enum_frameintervals(struct file *file, void *fh,
 {
        struct isc_device *isc = video_drvdata(file);
        struct v4l2_subdev_frame_interval_enum fie = {
+               .code = isc->config.sd_format->mbus_code,
                .index = fival->index,
                .width = fival->width,
                .height = fival->height,
@@ -1497,7 +1497,6 @@ static int isc_enum_frameintervals(struct file *file, void *fh,
        if (ret)
                return ret;
 
-       fie.code = isc->config.sd_format->mbus_code;
        fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
        fival->discrete = fie.interval;