Hi Jacopo, Thank you for the patch. On Wed, Mar 09, 2022 at 11:04:48AM +0100, Jacopo Mondi wrote: > Add support for MEDIA_BUS_FMT_JPEG_1X8 media bus code to the > CSIS driver. > > The MEDIA_BUS_FMT_JPEG_1X8 code is mapped tot the RAW8 CSI-2 Data Type, s/tot/to/ > while the CSI-2 specification suggests to use User Defined Data Type 1. > > As reported in the comment, the CSIS interface captures arbitrary Data > Types by using a pixel sampling mode not supported by the IP core > connected to it on i.MX SoCs. > > As some sensors, such as OV5640, support sending JPEG data on the RAW8 > Data Type and capture operations work correcty with such configuration, > map MEDIA_BUS_FMT_JPEG_1X8 to Data Type 0x2a. > > Signed-off-by: Jacopo Mondi <jacopo@xxxxxxxxxx> > --- > > Based on Hans' br-v5.18s where the CSIS patches have been collected > > --- > drivers/media/platform/imx/imx-mipi-csis.c | 28 ++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c > index 0a72734db55e..3731748de18b 100644 > --- a/drivers/media/platform/imx/imx-mipi-csis.c > +++ b/drivers/media/platform/imx/imx-mipi-csis.c > @@ -470,6 +470,34 @@ static const struct csis_pix_format mipi_csis_formats[] = { > .output = MEDIA_BUS_FMT_SRGGB14_1X14, > .data_type = MIPI_CSI2_DATA_TYPE_RAW14, > .width = 14, > + }, > + /* JPEG */ > + { > + .code = MEDIA_BUS_FMT_JPEG_1X8, > + .output = MEDIA_BUS_FMT_JPEG_1X8, > + /* > + * Map JPEG_1X8 on the RAW8 datatype. s/on the/to the/ Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > + * > + * The CSI-2 specification suggests in Annex A "JPEG8 Data > + * Format (informative)" to transmit JPEG data using one of the > + * Data Types aimed to represent arbitrary data, such as the > + * "User Defined Data Type 1" (0x30). > + * > + * However, when configured with a User Defined Data Type, the > + * CSIS outputs data in quad pixel mode regardless of the mode > + * selected in the MIPI_CSIS_ISP_CONFIG_CH register. Neither of > + * the IP cores connected to the CSIS in i.MX SoCs (CSI bridge > + * or ISI) support quad pixel mode, so this will never work in > + * practice. > + * > + * Some sensors (such as the OV5640) send JPEG data using the > + * RAW8 data type. This is usable and works, so map the JPEG > + * format to RAW8. If the CSIS ends up being integrated in an > + * SoC that can support quad pixel mode, this will have to be > + * revisited. > + */ > + .data_type = MIPI_CSI2_DATA_TYPE_RAW8, > + .width = 8, > } > }; > -- Regards, Laurent Pinchart