diff mbox series

[v7,05/11] media: imx: Fix some pixel format selections

Message ID 20200406163905.24475-6-slongerbeam@gmail.com (mailing list archive)
State New, archived
Headers show
Series media: imx: Miscellaneous format-related cleanups | expand

Commit Message

Steve Longerbeam April 6, 2020, 4:38 p.m. UTC
- 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>
---
 drivers/staging/media/imx/imx-media-capture.c | 2 +-
 drivers/staging/media/imx/imx-media-utils.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart April 6, 2020, 5:13 p.m. UTC | #1
Hi Steve,

Thank you for the patch.

On Mon, Apr 06, 2020 at 09:38:59AM -0700, Steve Longerbeam wrote:
> - 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>

> ---
>  drivers/staging/media/imx/imx-media-capture.c | 2 +-
>  drivers/staging/media/imx/imx-media-utils.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
> index fe1c49a33fd9..970f54960cac 100644
> --- a/drivers/staging/media/imx/imx-media-capture.c
> +++ b/drivers/staging/media/imx/imx-media-capture.c
> @@ -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));
> diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
> index 5552039a9d7e..852badd55bd1 100644
> --- a/drivers/staging/media/imx/imx-media-utils.c
> +++ b/drivers/staging/media/imx/imx-media-utils.c
> @@ -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)
diff mbox series

Patch

diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
index fe1c49a33fd9..970f54960cac 100644
--- a/drivers/staging/media/imx/imx-media-capture.c
+++ b/drivers/staging/media/imx/imx-media-capture.c
@@ -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));
diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index 5552039a9d7e..852badd55bd1 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -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)