linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] davinci/vpfe_capture.c: drop unused format descriptions
@ 2019-07-23 12:58 Hans Verkuil
  2019-07-24 14:44 ` Lad, Prabhakar
  0 siblings, 1 reply; 2+ messages in thread
From: Hans Verkuil @ 2019-07-23 12:58 UTC (permalink / raw)
  To: Linux Media Mailing List, Prabhakar Lad

Simplify vpfe_pixel_format to just contain the pixelformat and bpp fields.
All others are unused.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c
index 852fc357e19d..916ed743d716 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -119,57 +119,27 @@ static const struct vpfe_standard vpfe_standards[] = {
 /* Used when raw Bayer image from ccdc is directly captured to SDRAM */
 static const struct vpfe_pixel_format vpfe_pix_fmts[] = {
 	{
-		.fmtdesc = {
-			.index = 0,
-			.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
-			.description = "Bayer GrRBGb 8bit A-Law compr.",
-			.pixelformat = V4L2_PIX_FMT_SBGGR8,
-		},
+		.pixelformat = V4L2_PIX_FMT_SBGGR8,
 		.bpp = 1,
 	},
 	{
-		.fmtdesc = {
-			.index = 1,
-			.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
-			.description = "Bayer GrRBGb - 16bit",
-			.pixelformat = V4L2_PIX_FMT_SBGGR16,
-		},
+		.pixelformat = V4L2_PIX_FMT_SBGGR16,
 		.bpp = 2,
 	},
 	{
-		.fmtdesc = {
-			.index = 2,
-			.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
-			.description = "Bayer GrRBGb 8bit DPCM compr.",
-			.pixelformat = V4L2_PIX_FMT_SGRBG10DPCM8,
-		},
+		.pixelformat = V4L2_PIX_FMT_SGRBG10DPCM8,
 		.bpp = 1,
 	},
 	{
-		.fmtdesc = {
-			.index = 3,
-			.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
-			.description = "YCbCr 4:2:2 Interleaved UYVY",
-			.pixelformat = V4L2_PIX_FMT_UYVY,
-		},
+		.pixelformat = V4L2_PIX_FMT_UYVY,
 		.bpp = 2,
 	},
 	{
-		.fmtdesc = {
-			.index = 4,
-			.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
-			.description = "YCbCr 4:2:2 Interleaved YUYV",
-			.pixelformat = V4L2_PIX_FMT_YUYV,
-		},
+		.pixelformat = V4L2_PIX_FMT_YUYV,
 		.bpp = 2,
 	},
 	{
-		.fmtdesc = {
-			.index = 5,
-			.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
-			.description = "Y/CbCr 4:2:0 - Semi planar",
-			.pixelformat = V4L2_PIX_FMT_NV12,
-		},
+		.pixelformat = V4L2_PIX_FMT_NV12,
 		.bpp = 1,
 	},
 };
@@ -183,7 +153,7 @@ static const struct vpfe_pixel_format *vpfe_lookup_pix_format(u32 pix_format)
 	int i;

 	for (i = 0; i < ARRAY_SIZE(vpfe_pix_fmts); i++) {
-		if (pix_format == vpfe_pix_fmts[i].fmtdesc.pixelformat)
+		if (pix_format == vpfe_pix_fmts[i].pixelformat)
 			return &vpfe_pix_fmts[i];
 	}
 	return NULL;
@@ -782,7 +752,7 @@ static const struct vpfe_pixel_format *
 	temp = 0;
 	found = 0;
 	while (ccdc_dev->hw_ops.enum_pix(&pix, temp) >= 0) {
-		if (vpfe_pix_fmt->fmtdesc.pixelformat == pix) {
+		if (vpfe_pix_fmt->pixelformat == pix) {
 			found = 1;
 			break;
 		}
@@ -899,7 +869,6 @@ static int vpfe_enum_fmt_vid_cap(struct file *file, void  *priv,
 {
 	struct vpfe_device *vpfe_dev = video_drvdata(file);
 	const struct vpfe_pixel_format *pix_fmt;
-	int temp_index;
 	u32 pix;

 	v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_enum_fmt_vid_cap\n");
@@ -910,9 +879,7 @@ static int vpfe_enum_fmt_vid_cap(struct file *file, void  *priv,
 	/* Fill in the information about format */
 	pix_fmt = vpfe_lookup_pix_format(pix);
 	if (pix_fmt) {
-		temp_index = fmt->index;
-		*fmt = pix_fmt->fmtdesc;
-		fmt->index = temp_index;
+		fmt->pixelformat = fmt->pixelformat;
 		return 0;
 	}
 	return -EINVAL;
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
index 2c5b3eacf527..4ad53031e2f7 100644
--- a/include/media/davinci/vpfe_capture.h
+++ b/include/media/davinci/vpfe_capture.h
@@ -32,7 +32,7 @@
 #define CAPTURE_DRV_NAME		"vpfe-capture"

 struct vpfe_pixel_format {
-	struct v4l2_fmtdesc fmtdesc;
+	u32 pixelformat;
 	/* bytes per pixel */
 	int bpp;
 };


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] davinci/vpfe_capture.c: drop unused format descriptions
  2019-07-23 12:58 [PATCH] davinci/vpfe_capture.c: drop unused format descriptions Hans Verkuil
@ 2019-07-24 14:44 ` Lad, Prabhakar
  0 siblings, 0 replies; 2+ messages in thread
From: Lad, Prabhakar @ 2019-07-24 14:44 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Linux Media Mailing List

Hi Hans,

Thank you for the patch.

On Tue, Jul 23, 2019 at 1:58 PM Hans Verkuil <hverkuil@xs4all.nl> wrote:
>
> Simplify vpfe_pixel_format to just contain the pixelformat and bpp fields.
> All others are unused.
>
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> ---
> diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c

Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>

Regards,
--Prabhakar Lad

> index 852fc357e19d..916ed743d716 100644
> --- a/drivers/media/platform/davinci/vpfe_capture.c
> +++ b/drivers/media/platform/davinci/vpfe_capture.c
> @@ -119,57 +119,27 @@ static const struct vpfe_standard vpfe_standards[] = {
>  /* Used when raw Bayer image from ccdc is directly captured to SDRAM */
>  static const struct vpfe_pixel_format vpfe_pix_fmts[] = {
>         {
> -               .fmtdesc = {
> -                       .index = 0,
> -                       .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
> -                       .description = "Bayer GrRBGb 8bit A-Law compr.",
> -                       .pixelformat = V4L2_PIX_FMT_SBGGR8,
> -               },
> +               .pixelformat = V4L2_PIX_FMT_SBGGR8,
>                 .bpp = 1,
>         },
>         {
> -               .fmtdesc = {
> -                       .index = 1,
> -                       .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
> -                       .description = "Bayer GrRBGb - 16bit",
> -                       .pixelformat = V4L2_PIX_FMT_SBGGR16,
> -               },
> +               .pixelformat = V4L2_PIX_FMT_SBGGR16,
>                 .bpp = 2,
>         },
>         {
> -               .fmtdesc = {
> -                       .index = 2,
> -                       .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
> -                       .description = "Bayer GrRBGb 8bit DPCM compr.",
> -                       .pixelformat = V4L2_PIX_FMT_SGRBG10DPCM8,
> -               },
> +               .pixelformat = V4L2_PIX_FMT_SGRBG10DPCM8,
>                 .bpp = 1,
>         },
>         {
> -               .fmtdesc = {
> -                       .index = 3,
> -                       .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
> -                       .description = "YCbCr 4:2:2 Interleaved UYVY",
> -                       .pixelformat = V4L2_PIX_FMT_UYVY,
> -               },
> +               .pixelformat = V4L2_PIX_FMT_UYVY,
>                 .bpp = 2,
>         },
>         {
> -               .fmtdesc = {
> -                       .index = 4,
> -                       .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
> -                       .description = "YCbCr 4:2:2 Interleaved YUYV",
> -                       .pixelformat = V4L2_PIX_FMT_YUYV,
> -               },
> +               .pixelformat = V4L2_PIX_FMT_YUYV,
>                 .bpp = 2,
>         },
>         {
> -               .fmtdesc = {
> -                       .index = 5,
> -                       .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
> -                       .description = "Y/CbCr 4:2:0 - Semi planar",
> -                       .pixelformat = V4L2_PIX_FMT_NV12,
> -               },
> +               .pixelformat = V4L2_PIX_FMT_NV12,
>                 .bpp = 1,
>         },
>  };
> @@ -183,7 +153,7 @@ static const struct vpfe_pixel_format *vpfe_lookup_pix_format(u32 pix_format)
>         int i;
>
>         for (i = 0; i < ARRAY_SIZE(vpfe_pix_fmts); i++) {
> -               if (pix_format == vpfe_pix_fmts[i].fmtdesc.pixelformat)
> +               if (pix_format == vpfe_pix_fmts[i].pixelformat)
>                         return &vpfe_pix_fmts[i];
>         }
>         return NULL;
> @@ -782,7 +752,7 @@ static const struct vpfe_pixel_format *
>         temp = 0;
>         found = 0;
>         while (ccdc_dev->hw_ops.enum_pix(&pix, temp) >= 0) {
> -               if (vpfe_pix_fmt->fmtdesc.pixelformat == pix) {
> +               if (vpfe_pix_fmt->pixelformat == pix) {
>                         found = 1;
>                         break;
>                 }
> @@ -899,7 +869,6 @@ static int vpfe_enum_fmt_vid_cap(struct file *file, void  *priv,
>  {
>         struct vpfe_device *vpfe_dev = video_drvdata(file);
>         const struct vpfe_pixel_format *pix_fmt;
> -       int temp_index;
>         u32 pix;
>
>         v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_enum_fmt_vid_cap\n");
> @@ -910,9 +879,7 @@ static int vpfe_enum_fmt_vid_cap(struct file *file, void  *priv,
>         /* Fill in the information about format */
>         pix_fmt = vpfe_lookup_pix_format(pix);
>         if (pix_fmt) {
> -               temp_index = fmt->index;
> -               *fmt = pix_fmt->fmtdesc;
> -               fmt->index = temp_index;
> +               fmt->pixelformat = fmt->pixelformat;
>                 return 0;
>         }
>         return -EINVAL;
> diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h
> index 2c5b3eacf527..4ad53031e2f7 100644
> --- a/include/media/davinci/vpfe_capture.h
> +++ b/include/media/davinci/vpfe_capture.h
> @@ -32,7 +32,7 @@
>  #define CAPTURE_DRV_NAME               "vpfe-capture"
>
>  struct vpfe_pixel_format {
> -       struct v4l2_fmtdesc fmtdesc;
> +       u32 pixelformat;
>         /* bytes per pixel */
>         int bpp;
>  };
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-24 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23 12:58 [PATCH] davinci/vpfe_capture.c: drop unused format descriptions Hans Verkuil
2019-07-24 14:44 ` Lad, Prabhakar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).