diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h index a83e78d9b0beb..8b898ce05b847 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-cru.h @@ -69,6 +69,7 @@ struct rzg2l_cru_ip { * @format: 4CC format identifier (V4L2_PIX_FMT_*) * @icndmr: ICnDMR register value * @bpp: bytes per pixel + * @yuv: Flag to indicate whether the format is YUV-based. */ struct rzg2l_cru_ip_format { u32 code; @@ -76,6 +77,7 @@ struct rzg2l_cru_ip_format { u32 format; u32 icndmr; u8 bpp; + bool yuv; }; /** diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c index d935d981f9d3e..76a2b451f1daf 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c @@ -18,6 +18,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .format = V4L2_PIX_FMT_UYVY, .bpp = 2, .icndmr = ICnDMR_YCMODE_UYVY, + .yuv = true, }, { .code = MEDIA_BUS_FMT_SBGGR8_1X8, @@ -25,6 +26,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_RAW8, .bpp = 1, .icndmr = 0, + .yuv = false, }, { .code = MEDIA_BUS_FMT_SGBRG8_1X8, @@ -32,6 +34,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_RAW8, .bpp = 1, .icndmr = 0, + .yuv = false, }, { .code = MEDIA_BUS_FMT_SGRBG8_1X8, @@ -39,6 +42,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_RAW8, .bpp = 1, .icndmr = 0, + .yuv = false, }, { .code = MEDIA_BUS_FMT_SRGGB8_1X8, @@ -46,6 +50,7 @@ static const struct rzg2l_cru_ip_format rzg2l_cru_ip_formats[] = { .datatype = MIPI_CSI2_DT_RAW8, .bpp = 1, .icndmr = 0, + .yuv = false, }, }; diff --git a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c index a4dc3689599c3..e980afc32504e 100644 --- a/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +++ b/drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c @@ -210,7 +210,6 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, struct v4l2_mbus_framefmt *ip_sd_fmt, u8 csi_vc) { - const struct v4l2_format_info *src_finfo, *dst_finfo; const struct rzg2l_cru_ip_format *cru_video_fmt; const struct rzg2l_cru_ip_format *cru_ip_fmt; @@ -225,11 +224,8 @@ static int rzg2l_cru_initialize_image_conv(struct rzg2l_cru_dev *cru, return -EINVAL; } - src_finfo = v4l2_format_info(cru_ip_fmt->format); - dst_finfo = v4l2_format_info(cru->format.pixelformat); - /* If input and output use same colorspace, do bypass mode */ - if (v4l2_is_format_yuv(src_finfo) == v4l2_is_format_yuv(dst_finfo)) + if (cru_ip_fmt->yuv == cru_video_fmt->yuv) rzg2l_cru_write(cru, ICnMC, rzg2l_cru_read(cru, ICnMC) | ICnMC_CSCTHR); else