Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: ov5640: Complement yuv mbus formats with their 1X16 versions

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>

authored by

Xavier Roumegue and committed by
Mauro Carvalho Chehab
1536fbdb 14ea315b

+4
+4
drivers/media/i2c/ov5640.c
··· 135 135 static const struct ov5640_pixfmt ov5640_formats[] = { 136 136 { MEDIA_BUS_FMT_JPEG_1X8, V4L2_COLORSPACE_JPEG, }, 137 137 { MEDIA_BUS_FMT_UYVY8_2X8, V4L2_COLORSPACE_SRGB, }, 138 + { MEDIA_BUS_FMT_UYVY8_1X16, V4L2_COLORSPACE_SRGB, }, 138 139 { MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_SRGB, }, 140 + { MEDIA_BUS_FMT_YUYV8_1X16, V4L2_COLORSPACE_SRGB, }, 139 141 { MEDIA_BUS_FMT_RGB565_2X8_LE, V4L2_COLORSPACE_SRGB, }, 140 142 { MEDIA_BUS_FMT_RGB565_2X8_BE, V4L2_COLORSPACE_SRGB, }, 141 143 { MEDIA_BUS_FMT_SBGGR8_1X8, V4L2_COLORSPACE_SRGB, }, ··· 2340 2338 u8 fmt, mux; 2341 2339 2342 2340 switch (format->code) { 2341 + case MEDIA_BUS_FMT_UYVY8_1X16: 2343 2342 case MEDIA_BUS_FMT_UYVY8_2X8: 2344 2343 /* YUV422, UYVY */ 2345 2344 fmt = 0x3f; 2346 2345 mux = OV5640_FMT_MUX_YUV422; 2347 2346 break; 2347 + case MEDIA_BUS_FMT_YUYV8_1X16: 2348 2348 case MEDIA_BUS_FMT_YUYV8_2X8: 2349 2349 /* YUV422, YUYV */ 2350 2350 fmt = 0x30;