OSDN Git Service

media: imx: Fix some pixel format selections
authorSteve Longerbeam <slongerbeam@gmail.com>
Mon, 6 Apr 2020 16:38:59 +0000 (18:38 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 21 Apr 2020 11:16:07 +0000 (13:16 +0200)
- imx_media_capture_device_register() needs to use CS_SEL_ANY when
  finding the format from the attached source subdevice, because the
  source can be a CSI which supports bayer, and the CSI may have selected
  a bayer format when it registered.

- Likewise, imx_media_init_mbus_fmt() is called from the CSI, so the
  function may be passed a bayer code. Use CS_SEL_ANY when locating
  the format.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/imx/imx-media-capture.c
drivers/staging/media/imx/imx-media-utils.c

index fe1c49a..970f549 100644 (file)
@@ -792,7 +792,7 @@ int imx_media_capture_device_register(struct imx_media_video_dev *vdev)
        vdev->compose.width = fmt_src.format.width;
        vdev->compose.height = fmt_src.format.height;
        vdev->cc = imx_media_find_format(vdev->fmt.fmt.pix.pixelformat,
-                                        CS_SEL_YUV_RGB);
+                                        CS_SEL_ANY);
 
        v4l2_info(sd, "Registered %s as /dev/%s\n", vfd->name,
                  video_device_node_name(vfd));
index 5552039..852badd 100644 (file)
@@ -402,7 +402,7 @@ int imx_media_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus,
        mbus->field = field;
        if (code == 0)
                imx_media_enum_mbus_format(&code, 0, CS_SEL_YUV);
-       lcc = imx_media_find_mbus_format(code, CS_SEL_YUV_RGB);
+       lcc = imx_media_find_mbus_format(code, CS_SEL_ANY);
        if (!lcc) {
                lcc = imx_media_find_ipu_format(code, CS_SEL_YUV_RGB);
                if (!lcc)