media: ov5640: Complement yuv mbus formats with their 1X16 versions
authorXavier Roumegue <xavier.roumegue@oss.nxp.com>
Fri, 18 Jun 2021 07:59:33 +0000 (09:59 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 4 Aug 2021 12:43:50 +0000 (14:43 +0200)
According to media bus pixel codes definition, data formats on serial
busses should be described with one bus sample per pixel.

Documentation/userspace-api/media/v4l/subdev-formats.rst states:

"The media bus pixel codes document parallel formats. Should the pixel
data be transported over a serial bus, the media bus pixel code that
describes a parallel format that transfers a sample on a single clock
cycle is used. For instance, both MEDIA_BUS_FMT_BGR888_1X24 and
MEDIA_BUS_FMT_BGR888_3X8 are used on parallel busses for transferring an
8 bits per sample BGR data, whereas on serial busses the data in this
format is only referred to using MEDIA_BUS_FMT_BGR888_1X24. This is
because there is effectively only a single way to transport that
format on the serial busses."

Some MIPI CSI receivers strictly obey this definition and declare
support for only *1X_* formats.

Hence, complement the supported media bus formats with their 1X16 versions
(currently applicable to yuyv, uyvy) to enhance interoperability with CSI
receivers.

Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/i2c/ov5640.c

index f6e1e51..ddbd713 100644 (file)
@@ -135,7 +135,9 @@ struct ov5640_pixfmt {
 static const struct ov5640_pixfmt ov5640_formats[] = {
        { MEDIA_BUS_FMT_JPEG_1X8, V4L2_COLORSPACE_JPEG, },
        { MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_SRGB, },
+       { MEDIA_BUS_FMT_UYVY8_1X16, V4L2_COLORSPACE_SRGB, },
        { MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_SRGB, },
+       { MEDIA_BUS_FMT_YUYV8_1X16, V4L2_COLORSPACE_SRGB, },
        { MEDIA_BUS_FMT_RGB565_2X8_LE, V4L2_COLORSPACE_SRGB, },
        { MEDIA_BUS_FMT_RGB565_2X8_BE, V4L2_COLORSPACE_SRGB, },
        { MEDIA_BUS_FMT_SBGGR8_1X8, V4L2_COLORSPACE_SRGB, },
@@ -2338,11 +2340,13 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor,
        u8 fmt, mux;
 
        switch (format->code) {
+       case MEDIA_BUS_FMT_UYVY8_1X16:
        case MEDIA_BUS_FMT_UYVY8_2X8:
                /* YUV422, UYVY */
                fmt = 0x3f;
                mux = OV5640_FMT_MUX_YUV422;
                break;
+       case MEDIA_BUS_FMT_YUYV8_1X16:
        case MEDIA_BUS_FMT_YUYV8_2X8:
                /* YUV422, YUYV */
                fmt = 0x30;