diff mbox series

[40/50] staging: media: imx: imx7-media-csi: Simplify default mbus code in try_fmt

Message ID 20220510115859.19777-41-laurent.pinchart@ideasonboard.com
State Accepted
Commit 539a9859768dffec27623644268c232895bc7bc0
Headers show
Series [01/50] staging: media: imx: imx7-media-csi: Initialize locks early on | expand

Commit Message

Laurent Pinchart May 10, 2022, 11:58 a.m. UTC
When trying a format on the subdev sink pad, if the requested media bus
code isn't supported, fallback to the default with a simpler logic.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/staging/media/imx/imx7-media-csi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
index f2e85e9851e4..f3b9ce03318f 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -1972,11 +1972,10 @@  static int imx7_csi_try_fmt(struct imx7_csi *csi,
 		*cc = imx7_csi_find_mbus_format(sdformat->format.code,
 						IMX7_CSI_PIXFMT_SEL_ANY);
 		if (!*cc) {
-			imx7_csi_enum_mbus_formats(&code, 0,
-						   IMX7_CSI_PIXFMT_SEL_YUV_RGB);
+			code = IMX7_CSI_DEF_MBUS_CODE;
 			*cc = imx7_csi_find_mbus_format(code,
-							IMX7_CSI_PIXFMT_SEL_YUV_RGB);
-			sdformat->format.code = (*cc)->codes[0];
+							IMX7_CSI_PIXFMT_SEL_ANY);
+			sdformat->format.code = code;
 		}
 
 		if (sdformat->format.field != V4L2_FIELD_INTERLACED)