diff mbox series

[v2,1/4] media: ti: cal: Clean up mbus formats uses

Message ID 20230228171620.330978-2-tomi.valkeinen@ideasonboard.com (mailing list archive)
State New, archived
Headers show
Series media: ti: cal: Streams support | expand

Commit Message

Tomi Valkeinen Feb. 28, 2023, 5:16 p.m. UTC
Clean up the CAL drivers uses of mbus formats:

- Switch all YUV formats from 2X8 formats to 1X16, as those are what
  should be used for CSI-2 bus.

- Drop 24 and 32 bit formats, as the driver doesn't support them (see
  cal_ctx_pix_proc_config()).

- Switch RGB565_2X8_LE to RGB565_1X16 (for the same reason as for the
  YUV formats) and drop RGB565_2X8_BE as it cannot be supported with
  CSI-2.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/platform/ti/cal/cal-camerarx.c |  2 +-
 drivers/media/platform/ti/cal/cal-video.c    |  2 +-
 drivers/media/platform/ti/cal/cal.c          | 34 +++-----------------
 3 files changed, 7 insertions(+), 31 deletions(-)

Comments

Jacopo Mondi March 1, 2023, 9:17 a.m. UTC | #1
Hi Tomi

On Tue, Feb 28, 2023 at 07:16:17PM +0200, Tomi Valkeinen wrote:
> Clean up the CAL drivers uses of mbus formats:
>
> - Switch all YUV formats from 2X8 formats to 1X16, as those are what
>   should be used for CSI-2 bus.
>
> - Drop 24 and 32 bit formats, as the driver doesn't support them (see
>   cal_ctx_pix_proc_config()).
>
> - Switch RGB565_2X8_LE to RGB565_1X16 (for the same reason as for the
>   YUV formats) and drop RGB565_2X8_BE as it cannot be supported with
>   CSI-2.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> ---
>  drivers/media/platform/ti/cal/cal-camerarx.c |  2 +-
>  drivers/media/platform/ti/cal/cal-video.c    |  2 +-
>  drivers/media/platform/ti/cal/cal.c          | 34 +++-----------------
>  3 files changed, 7 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/media/platform/ti/cal/cal-camerarx.c b/drivers/media/platform/ti/cal/cal-camerarx.c
> index 16ae52879a79..267089b0fea0 100644
> --- a/drivers/media/platform/ti/cal/cal-camerarx.c
> +++ b/drivers/media/platform/ti/cal/cal-camerarx.c
> @@ -817,7 +817,7 @@ static int cal_camerarx_sd_init_cfg(struct v4l2_subdev *sd,
>  		.format = {
>  			.width = 640,
>  			.height = 480,
> -			.code = MEDIA_BUS_FMT_UYVY8_2X8,
> +			.code = MEDIA_BUS_FMT_UYVY8_1X16,
>  			.field = V4L2_FIELD_NONE,
>  			.colorspace = V4L2_COLORSPACE_SRGB,
>  			.ycbcr_enc = V4L2_YCBCR_ENC_601,
> diff --git a/drivers/media/platform/ti/cal/cal-video.c b/drivers/media/platform/ti/cal/cal-video.c
> index ca906a9e4222..ed92e23d4b16 100644
> --- a/drivers/media/platform/ti/cal/cal-video.c
> +++ b/drivers/media/platform/ti/cal/cal-video.c
> @@ -894,7 +894,7 @@ static int cal_ctx_v4l2_init_mc_format(struct cal_ctx *ctx)
>  	const struct cal_format_info *fmtinfo;
>  	struct v4l2_pix_format *pix_fmt = &ctx->v_fmt.fmt.pix;
>
> -	fmtinfo = cal_format_by_code(MEDIA_BUS_FMT_UYVY8_2X8);
> +	fmtinfo = cal_format_by_code(MEDIA_BUS_FMT_UYVY8_1X16);
>  	if (!fmtinfo)
>  		return -EINVAL;
>
> diff --git a/drivers/media/platform/ti/cal/cal.c b/drivers/media/platform/ti/cal/cal.c
> index 1236215ec70e..760c58cb3b3e 100644
> --- a/drivers/media/platform/ti/cal/cal.c
> +++ b/drivers/media/platform/ti/cal/cal.c
> @@ -61,48 +61,24 @@ MODULE_PARM_DESC(mc_api, "activates the MC API");
>  const struct cal_format_info cal_formats[] = {
>  	{
>  		.fourcc		= V4L2_PIX_FMT_YUYV,
> -		.code		= MEDIA_BUS_FMT_YUYV8_2X8,
> +		.code		= MEDIA_BUS_FMT_YUYV8_1X16,
>  		.bpp		= 16,
>  	}, {
>  		.fourcc		= V4L2_PIX_FMT_UYVY,
> -		.code		= MEDIA_BUS_FMT_UYVY8_2X8,
> +		.code		= MEDIA_BUS_FMT_UYVY8_1X16,
>  		.bpp		= 16,
>  	}, {
>  		.fourcc		= V4L2_PIX_FMT_YVYU,
> -		.code		= MEDIA_BUS_FMT_YVYU8_2X8,
> +		.code		= MEDIA_BUS_FMT_YVYU8_1X16,
>  		.bpp		= 16,
>  	}, {
>  		.fourcc		= V4L2_PIX_FMT_VYUY,
> -		.code		= MEDIA_BUS_FMT_VYUY8_2X8,
> +		.code		= MEDIA_BUS_FMT_VYUY8_1X16,
>  		.bpp		= 16,
>  	}, {
>  		.fourcc		= V4L2_PIX_FMT_RGB565, /* gggbbbbb rrrrrggg */

I would drop the comment as it's confusing. As far as I understand it
the RGB565 transmission/reception mode is define uniquely by the CSI-2
specification and the comment here does not match "Figure 112 RGB565
Data Format Reception"

Otherwise
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

> -		.code		= MEDIA_BUS_FMT_RGB565_2X8_LE,
> +		.code		= MEDIA_BUS_FMT_RGB565_1X16,
>  		.bpp		= 16,
> -	}, {
> -		.fourcc		= V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */
> -		.code		= MEDIA_BUS_FMT_RGB565_2X8_BE,
> -		.bpp		= 16,
> -	}, {
> -		.fourcc		= V4L2_PIX_FMT_RGB555, /* gggbbbbb arrrrrgg */
> -		.code		= MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE,
> -		.bpp		= 16,
> -	}, {
> -		.fourcc		= V4L2_PIX_FMT_RGB555X, /* arrrrrgg gggbbbbb */
> -		.code		= MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE,
> -		.bpp		= 16,
> -	}, {
> -		.fourcc		= V4L2_PIX_FMT_RGB24, /* rgb */
> -		.code		= MEDIA_BUS_FMT_RGB888_2X12_LE,
> -		.bpp		= 24,
> -	}, {
> -		.fourcc		= V4L2_PIX_FMT_BGR24, /* bgr */
> -		.code		= MEDIA_BUS_FMT_RGB888_2X12_BE,
> -		.bpp		= 24,
> -	}, {
> -		.fourcc		= V4L2_PIX_FMT_RGB32, /* argb */
> -		.code		= MEDIA_BUS_FMT_ARGB8888_1X32,
> -		.bpp		= 32,
>  	}, {
>  		.fourcc		= V4L2_PIX_FMT_SBGGR8,
>  		.code		= MEDIA_BUS_FMT_SBGGR8_1X8,
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/media/platform/ti/cal/cal-camerarx.c b/drivers/media/platform/ti/cal/cal-camerarx.c
index 16ae52879a79..267089b0fea0 100644
--- a/drivers/media/platform/ti/cal/cal-camerarx.c
+++ b/drivers/media/platform/ti/cal/cal-camerarx.c
@@ -817,7 +817,7 @@  static int cal_camerarx_sd_init_cfg(struct v4l2_subdev *sd,
 		.format = {
 			.width = 640,
 			.height = 480,
-			.code = MEDIA_BUS_FMT_UYVY8_2X8,
+			.code = MEDIA_BUS_FMT_UYVY8_1X16,
 			.field = V4L2_FIELD_NONE,
 			.colorspace = V4L2_COLORSPACE_SRGB,
 			.ycbcr_enc = V4L2_YCBCR_ENC_601,
diff --git a/drivers/media/platform/ti/cal/cal-video.c b/drivers/media/platform/ti/cal/cal-video.c
index ca906a9e4222..ed92e23d4b16 100644
--- a/drivers/media/platform/ti/cal/cal-video.c
+++ b/drivers/media/platform/ti/cal/cal-video.c
@@ -894,7 +894,7 @@  static int cal_ctx_v4l2_init_mc_format(struct cal_ctx *ctx)
 	const struct cal_format_info *fmtinfo;
 	struct v4l2_pix_format *pix_fmt = &ctx->v_fmt.fmt.pix;
 
-	fmtinfo = cal_format_by_code(MEDIA_BUS_FMT_UYVY8_2X8);
+	fmtinfo = cal_format_by_code(MEDIA_BUS_FMT_UYVY8_1X16);
 	if (!fmtinfo)
 		return -EINVAL;
 
diff --git a/drivers/media/platform/ti/cal/cal.c b/drivers/media/platform/ti/cal/cal.c
index 1236215ec70e..760c58cb3b3e 100644
--- a/drivers/media/platform/ti/cal/cal.c
+++ b/drivers/media/platform/ti/cal/cal.c
@@ -61,48 +61,24 @@  MODULE_PARM_DESC(mc_api, "activates the MC API");
 const struct cal_format_info cal_formats[] = {
 	{
 		.fourcc		= V4L2_PIX_FMT_YUYV,
-		.code		= MEDIA_BUS_FMT_YUYV8_2X8,
+		.code		= MEDIA_BUS_FMT_YUYV8_1X16,
 		.bpp		= 16,
 	}, {
 		.fourcc		= V4L2_PIX_FMT_UYVY,
-		.code		= MEDIA_BUS_FMT_UYVY8_2X8,
+		.code		= MEDIA_BUS_FMT_UYVY8_1X16,
 		.bpp		= 16,
 	}, {
 		.fourcc		= V4L2_PIX_FMT_YVYU,
-		.code		= MEDIA_BUS_FMT_YVYU8_2X8,
+		.code		= MEDIA_BUS_FMT_YVYU8_1X16,
 		.bpp		= 16,
 	}, {
 		.fourcc		= V4L2_PIX_FMT_VYUY,
-		.code		= MEDIA_BUS_FMT_VYUY8_2X8,
+		.code		= MEDIA_BUS_FMT_VYUY8_1X16,
 		.bpp		= 16,
 	}, {
 		.fourcc		= V4L2_PIX_FMT_RGB565, /* gggbbbbb rrrrrggg */
-		.code		= MEDIA_BUS_FMT_RGB565_2X8_LE,
+		.code		= MEDIA_BUS_FMT_RGB565_1X16,
 		.bpp		= 16,
-	}, {
-		.fourcc		= V4L2_PIX_FMT_RGB565X, /* rrrrrggg gggbbbbb */
-		.code		= MEDIA_BUS_FMT_RGB565_2X8_BE,
-		.bpp		= 16,
-	}, {
-		.fourcc		= V4L2_PIX_FMT_RGB555, /* gggbbbbb arrrrrgg */
-		.code		= MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE,
-		.bpp		= 16,
-	}, {
-		.fourcc		= V4L2_PIX_FMT_RGB555X, /* arrrrrgg gggbbbbb */
-		.code		= MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE,
-		.bpp		= 16,
-	}, {
-		.fourcc		= V4L2_PIX_FMT_RGB24, /* rgb */
-		.code		= MEDIA_BUS_FMT_RGB888_2X12_LE,
-		.bpp		= 24,
-	}, {
-		.fourcc		= V4L2_PIX_FMT_BGR24, /* bgr */
-		.code		= MEDIA_BUS_FMT_RGB888_2X12_BE,
-		.bpp		= 24,
-	}, {
-		.fourcc		= V4L2_PIX_FMT_RGB32, /* argb */
-		.code		= MEDIA_BUS_FMT_ARGB8888_1X32,
-		.bpp		= 32,
 	}, {
 		.fourcc		= V4L2_PIX_FMT_SBGGR8,
 		.code		= MEDIA_BUS_FMT_SBGGR8_1X8,