diff mbox series

[6/8] media: imx: imx7_media-csi: Add support for additional Bayer patterns

Message ID 20220204121514.2762676-7-alexander.stein@ew.tq-group.com (mailing list archive)
State New, archived
Headers show
Series imx7/imx8mm media / csi patches | expand

Commit Message

Alexander Stein Feb. 4, 2022, 12:15 p.m. UTC
imx7_csi_configure() allows configuring these Bayer patterns when
starting a stream. So allow these in link_validate() as well.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
I'm wondering if V4L2_PIX_FMT_SBGGR16 (and their variants) is correct in this
function. imx7_csi_configure() does not list MEDIA_BUS_FMT_Sxxxx16_1X16.
Also I can't find a proper a proper setting in CSI_CR18 of CSI Bridge in
IMX8M Mini RM for RAW16. The feature list names a  "16-bit data port for
Bayer data input", but is it actually supported? I do not know anything about
the MIPI CSI data formats though. Maybe someone else can clarify this.

 drivers/staging/media/imx/imx7-media-csi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Laurent Pinchart Feb. 5, 2022, 3:40 a.m. UTC | #1
Hi Alexander,

Thank you for the patch.

On Fri, Feb 04, 2022 at 01:15:12PM +0100, Alexander Stein wrote:
> imx7_csi_configure() allows configuring these Bayer patterns when
> starting a stream. So allow these in link_validate() as well.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
> I'm wondering if V4L2_PIX_FMT_SBGGR16 (and their variants) is correct in this
> function. imx7_csi_configure() does not list MEDIA_BUS_FMT_Sxxxx16_1X16.
> Also I can't find a proper a proper setting in CSI_CR18 of CSI Bridge in
> IMX8M Mini RM for RAW16. The feature list names a  "16-bit data port for
> Bayer data input", but is it actually supported? I do not know anything about
> the MIPI CSI data formats though. Maybe someone else can clarify this.

The CSI bridge has a 16-bit input. The MIPI_DATA_FORMAT field in CR18
maps to the CSI-2 DT value, and it's not clear if it's only used to
filter on the CSI-2 DT, or if it does more than that. If we're lucky,
it's the former and we can just use 0x2e.

>  drivers/staging/media/imx/imx7-media-csi.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
> index 158d2a736c6d..7e737221f187 100644
> --- a/drivers/staging/media/imx/imx7-media-csi.c
> +++ b/drivers/staging/media/imx/imx7-media-csi.c
> @@ -1004,6 +1004,18 @@ static int imx7_csi_pad_link_validate(struct v4l2_subdev *sd,
>  	case V4L2_PIX_FMT_SGBRG8:
>  	case V4L2_PIX_FMT_SGRBG8:
>  	case V4L2_PIX_FMT_SRGGB8:
> +	case V4L2_PIX_FMT_SBGGR10:
> +	case V4L2_PIX_FMT_SGBRG10:
> +	case V4L2_PIX_FMT_SGRBG10:
> +	case V4L2_PIX_FMT_SRGGB10:
> +	case V4L2_PIX_FMT_SBGGR12:
> +	case V4L2_PIX_FMT_SGBRG12:
> +	case V4L2_PIX_FMT_SGRBG12:
> +	case V4L2_PIX_FMT_SRGGB12:
> +	case V4L2_PIX_FMT_SBGGR14:
> +	case V4L2_PIX_FMT_SGBRG14:
> +	case V4L2_PIX_FMT_SGRBG14:
> +	case V4L2_PIX_FMT_SRGGB14:
>  	case V4L2_PIX_FMT_SBGGR16:
>  	case V4L2_PIX_FMT_SGBRG16:
>  	case V4L2_PIX_FMT_SGRBG16:
Alexander Stein Feb. 7, 2022, 10:01 a.m. UTC | #2
Hi Laurent,

Am Samstag, 5. Februar 2022, 04:40:14 CET schrieb Laurent Pinchart:
> Hi Alexander,
> 
> Thank you for the patch.
> 
> On Fri, Feb 04, 2022 at 01:15:12PM +0100, Alexander Stein wrote:
> > imx7_csi_configure() allows configuring these Bayer patterns when
> > starting a stream. So allow these in link_validate() as well.
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> > ---
> > I'm wondering if V4L2_PIX_FMT_SBGGR16 (and their variants) is correct in
> > this function. imx7_csi_configure() does not list
> > MEDIA_BUS_FMT_Sxxxx16_1X16. Also I can't find a proper a proper setting
> > in CSI_CR18 of CSI Bridge in IMX8M Mini RM for RAW16. The feature list
> > names a  "16-bit data port for Bayer data input", but is it actually
> > supported? I do not know anything about the MIPI CSI data formats though.
> > Maybe someone else can clarify this.
> The CSI bridge has a 16-bit input. The MIPI_DATA_FORMAT field in CR18
> maps to the CSI-2 DT value, and it's not clear if it's only used to
> filter on the CSI-2 DT, or if it does more than that. If we're lucky,
> it's the former and we can just use 0x2e.

Well, 0x2e is not listed as a valid value for MIPI_DATA_FORMAT in both i.MX7D 
RM Rev1 and i.MX8M Mini RM Rev 3. So I'm not so sure about that. Maybe this 
holds true for other devices as well. I can not test RAW16 anyway, so I just 
wanted to raise a possible issue here.

Regards,
Alexander

> 
> >  drivers/staging/media/imx/imx7-media-csi.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/drivers/staging/media/imx/imx7-media-csi.c
> > b/drivers/staging/media/imx/imx7-media-csi.c index
> > 158d2a736c6d..7e737221f187 100644
> > --- a/drivers/staging/media/imx/imx7-media-csi.c
> > +++ b/drivers/staging/media/imx/imx7-media-csi.c
> > @@ -1004,6 +1004,18 @@ static int imx7_csi_pad_link_validate(struct
> > v4l2_subdev *sd,> 
> >  	case V4L2_PIX_FMT_SGBRG8:
> >  	case V4L2_PIX_FMT_SGRBG8:
> > 
> >  	case V4L2_PIX_FMT_SRGGB8:
> > +	case V4L2_PIX_FMT_SBGGR10:
> > +	case V4L2_PIX_FMT_SGBRG10:
> > +	case V4L2_PIX_FMT_SGRBG10:
> > +	case V4L2_PIX_FMT_SRGGB10:
> > +	case V4L2_PIX_FMT_SBGGR12:
> > +	case V4L2_PIX_FMT_SGBRG12:
> > +	case V4L2_PIX_FMT_SGRBG12:
> > +	case V4L2_PIX_FMT_SRGGB12:
> > +	case V4L2_PIX_FMT_SBGGR14:
> > +	case V4L2_PIX_FMT_SGBRG14:
> > +	case V4L2_PIX_FMT_SGRBG14:
> > 
> > +	case V4L2_PIX_FMT_SRGGB14:
> >  	case V4L2_PIX_FMT_SBGGR16:
> >  	case V4L2_PIX_FMT_SGBRG16:
> >  	case V4L2_PIX_FMT_SGRBG16:
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 158d2a736c6d..7e737221f187 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -1004,6 +1004,18 @@  static int imx7_csi_pad_link_validate(struct v4l2_subdev *sd,
 	case V4L2_PIX_FMT_SGBRG8:
 	case V4L2_PIX_FMT_SGRBG8:
 	case V4L2_PIX_FMT_SRGGB8:
+	case V4L2_PIX_FMT_SBGGR10:
+	case V4L2_PIX_FMT_SGBRG10:
+	case V4L2_PIX_FMT_SGRBG10:
+	case V4L2_PIX_FMT_SRGGB10:
+	case V4L2_PIX_FMT_SBGGR12:
+	case V4L2_PIX_FMT_SGBRG12:
+	case V4L2_PIX_FMT_SGRBG12:
+	case V4L2_PIX_FMT_SRGGB12:
+	case V4L2_PIX_FMT_SBGGR14:
+	case V4L2_PIX_FMT_SGBRG14:
+	case V4L2_PIX_FMT_SGRBG14:
+	case V4L2_PIX_FMT_SRGGB14:
 	case V4L2_PIX_FMT_SBGGR16:
 	case V4L2_PIX_FMT_SGBRG16:
 	case V4L2_PIX_FMT_SGRBG16: