diff mbox

media: mx2_camera: Add YUYV output format.

Message ID 1342083373-18245-1-git-send-email-javier.martin@vista-silicon.com (mailing list archive)
State New, archived
Headers show

Commit Message

Javier Martin July 12, 2012, 8:56 a.m. UTC
Add explicit conversions from UYVY and YUYV to YUYV so that
csicr1 configuration can be set properly for each format.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
---
 drivers/media/video/mx2_camera.c |   40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

Comments

Javier Martin July 20, 2012, 7:49 a.m. UTC | #1
On 12 July 2012 10:56, Javier Martin <javier.martin@vista-silicon.com> wrote:
> Add explicit conversions from UYVY and YUYV to YUYV so that
> csicr1 configuration can be set properly for each format.
>
> Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
> ---
>  drivers/media/video/mx2_camera.c |   40 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>
> diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> index 0f01e7b..2a33bcb 100644
> --- a/drivers/media/video/mx2_camera.c
> +++ b/drivers/media/video/mx2_camera.c
> @@ -337,6 +337,34 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = {
>                 }
>         },
>         {
> +               .in_fmt         = V4L2_MBUS_FMT_UYVY8_2X8,
> +               .out_fmt        = V4L2_PIX_FMT_YUYV,
> +               .cfg            = {
> +                       .channel        = 1,
> +                       .in_fmt         = PRP_CNTL_DATA_IN_YUV422,
> +                       .out_fmt        = PRP_CNTL_CH1_OUT_YUV422,
> +                       .src_pixel      = 0x22000888, /* YUV422 (YUYV) */
> +                       .ch1_pixel      = 0x62000888, /* YUV422 (YUYV) */
> +                       .irq_flags      = PRP_INTR_RDERR | PRP_INTR_CH1WERR |
> +                                               PRP_INTR_CH1FC | PRP_INTR_LBOVF,
> +                       .csicr1         = CSICR1_SWAP16_EN,
> +               }
> +       },
> +       {
> +               .in_fmt         = V4L2_MBUS_FMT_YUYV8_2X8,
> +               .out_fmt        = V4L2_PIX_FMT_YUYV,
> +               .cfg            = {
> +                       .channel        = 1,
> +                       .in_fmt         = PRP_CNTL_DATA_IN_YUV422,
> +                       .out_fmt        = PRP_CNTL_CH1_OUT_YUV422,
> +                       .src_pixel      = 0x22000888, /* YUV422 (YUYV) */
> +                       .ch1_pixel      = 0x62000888, /* YUV422 (YUYV) */
> +                       .irq_flags      = PRP_INTR_RDERR | PRP_INTR_CH1WERR |
> +                                               PRP_INTR_CH1FC | PRP_INTR_LBOVF,
> +                       .csicr1         = CSICR1_PACK_DIR,
> +               }
> +       },
> +       {
>                 .in_fmt         = V4L2_MBUS_FMT_YUYV8_2X8,
>                 .out_fmt        = V4L2_PIX_FMT_YUV420,
>                 .cfg            = {
> @@ -1146,6 +1174,18 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd,
>                 }
>         }
>
> +       if (code == V4L2_MBUS_FMT_UYVY8_2X8) {
> +               formats++;
> +               if (xlate) {
> +                       xlate->host_fmt =
> +                               soc_mbus_get_fmtdesc(V4L2_MBUS_FMT_YUYV8_2X8);
> +                       xlate->code     = code;
> +                       dev_dbg(dev, "Providing host format %s for sensor code %d\n",
> +                               xlate->host_fmt->name, code);
> +                       xlate++;
> +               }
> +       }
> +
>         /* Generic pass-trough */
>         formats++;
>         if (xlate) {
> --
> 1.7.9.5
>

Any comments on this one?

Regards.
Guennadi Liakhovetski July 20, 2012, 7:57 a.m. UTC | #2
Hi Javier

On Fri, 20 Jul 2012, javier Martin wrote:

> On 12 July 2012 10:56, Javier Martin <javier.martin@vista-silicon.com> wrote:
> > Add explicit conversions from UYVY and YUYV to YUYV so that
> > csicr1 configuration can be set properly for each format.
> >
> > Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
> > ---
> >  drivers/media/video/mx2_camera.c |   40 ++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 40 insertions(+)
> >
> > diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
> > index 0f01e7b..2a33bcb 100644
> > --- a/drivers/media/video/mx2_camera.c
> > +++ b/drivers/media/video/mx2_camera.c
> > @@ -337,6 +337,34 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = {
> >                 }
> >         },
> >         {
> > +               .in_fmt         = V4L2_MBUS_FMT_UYVY8_2X8,
> > +               .out_fmt        = V4L2_PIX_FMT_YUYV,
> > +               .cfg            = {
> > +                       .channel        = 1,
> > +                       .in_fmt         = PRP_CNTL_DATA_IN_YUV422,
> > +                       .out_fmt        = PRP_CNTL_CH1_OUT_YUV422,
> > +                       .src_pixel      = 0x22000888, /* YUV422 (YUYV) */
> > +                       .ch1_pixel      = 0x62000888, /* YUV422 (YUYV) */
> > +                       .irq_flags      = PRP_INTR_RDERR | PRP_INTR_CH1WERR |
> > +                                               PRP_INTR_CH1FC | PRP_INTR_LBOVF,
> > +                       .csicr1         = CSICR1_SWAP16_EN,
> > +               }
> > +       },
> > +       {
> > +               .in_fmt         = V4L2_MBUS_FMT_YUYV8_2X8,
> > +               .out_fmt        = V4L2_PIX_FMT_YUYV,
> > +               .cfg            = {
> > +                       .channel        = 1,
> > +                       .in_fmt         = PRP_CNTL_DATA_IN_YUV422,
> > +                       .out_fmt        = PRP_CNTL_CH1_OUT_YUV422,
> > +                       .src_pixel      = 0x22000888, /* YUV422 (YUYV) */
> > +                       .ch1_pixel      = 0x62000888, /* YUV422 (YUYV) */
> > +                       .irq_flags      = PRP_INTR_RDERR | PRP_INTR_CH1WERR |
> > +                                               PRP_INTR_CH1FC | PRP_INTR_LBOVF,
> > +                       .csicr1         = CSICR1_PACK_DIR,
> > +               }
> > +       },
> > +       {
> >                 .in_fmt         = V4L2_MBUS_FMT_YUYV8_2X8,
> >                 .out_fmt        = V4L2_PIX_FMT_YUV420,
> >                 .cfg            = {
> > @@ -1146,6 +1174,18 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd,
> >                 }
> >         }
> >
> > +       if (code == V4L2_MBUS_FMT_UYVY8_2X8) {
> > +               formats++;
> > +               if (xlate) {
> > +                       xlate->host_fmt =
> > +                               soc_mbus_get_fmtdesc(V4L2_MBUS_FMT_YUYV8_2X8);
> > +                       xlate->code     = code;
> > +                       dev_dbg(dev, "Providing host format %s for sensor code %d\n",
> > +                               xlate->host_fmt->name, code);
> > +                       xlate++;
> > +               }
> > +       }
> > +
> >         /* Generic pass-trough */
> >         formats++;
> >         if (xlate) {
> > --
> > 1.7.9.5
> >
> 
> Any comments on this one?

Thanks for the reminder, but in this specific case I haven't 
forgottne:-) I'm processing my v4l patch queue ATM, will have a closer 
look at this and other your patches, will write back if I have any 
objections. I hope I won't - I'm leaving for a week-long holiday tomorrow, 
so, I hope to push my queue today.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 0f01e7b..2a33bcb 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -337,6 +337,34 @@  static struct mx2_fmt_cfg mx27_emma_prp_table[] = {
 		}
 	},
 	{
+		.in_fmt		= V4L2_MBUS_FMT_UYVY8_2X8,
+		.out_fmt	= V4L2_PIX_FMT_YUYV,
+		.cfg		= {
+			.channel	= 1,
+			.in_fmt		= PRP_CNTL_DATA_IN_YUV422,
+			.out_fmt	= PRP_CNTL_CH1_OUT_YUV422,
+			.src_pixel	= 0x22000888, /* YUV422 (YUYV) */
+			.ch1_pixel	= 0x62000888, /* YUV422 (YUYV) */
+			.irq_flags	= PRP_INTR_RDERR | PRP_INTR_CH1WERR |
+						PRP_INTR_CH1FC | PRP_INTR_LBOVF,
+			.csicr1		= CSICR1_SWAP16_EN,
+		}
+	},
+	{
+		.in_fmt		= V4L2_MBUS_FMT_YUYV8_2X8,
+		.out_fmt	= V4L2_PIX_FMT_YUYV,
+		.cfg		= {
+			.channel	= 1,
+			.in_fmt		= PRP_CNTL_DATA_IN_YUV422,
+			.out_fmt	= PRP_CNTL_CH1_OUT_YUV422,
+			.src_pixel	= 0x22000888, /* YUV422 (YUYV) */
+			.ch1_pixel	= 0x62000888, /* YUV422 (YUYV) */
+			.irq_flags	= PRP_INTR_RDERR | PRP_INTR_CH1WERR |
+						PRP_INTR_CH1FC | PRP_INTR_LBOVF,
+			.csicr1		= CSICR1_PACK_DIR,
+		}
+	},
+	{
 		.in_fmt		= V4L2_MBUS_FMT_YUYV8_2X8,
 		.out_fmt	= V4L2_PIX_FMT_YUV420,
 		.cfg		= {
@@ -1146,6 +1174,18 @@  static int mx2_camera_get_formats(struct soc_camera_device *icd,
 		}
 	}
 
+	if (code == V4L2_MBUS_FMT_UYVY8_2X8) {
+		formats++;
+		if (xlate) {
+			xlate->host_fmt =
+				soc_mbus_get_fmtdesc(V4L2_MBUS_FMT_YUYV8_2X8);
+			xlate->code	= code;
+			dev_dbg(dev, "Providing host format %s for sensor code %d\n",
+				xlate->host_fmt->name, code);
+			xlate++;
+		}
+	}
+
 	/* Generic pass-trough */
 	formats++;
 	if (xlate) {