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

Merge tag 'br-v5.18q' of git://linuxtv.org/hverkuil/media_tree into media_stage

Tag branch

* tag 'br-v5.18q' of git://linuxtv.org/hverkuil/media_tree:
media: cec: seco: Drop pointless include
media: hantro: sunxi: Fix VP9 steps
media: imx: csis: Store pads format separately
doc: media: Document VP9 reference_mode miss-placement
doc: media: Document MM21 tiled format
media: imx: imx8mq-mipi-csi2: Remove YUV422 2X8
media: v4l2-core: Initialize h264 scaling matrix
media: imx: imx-mipi-csis: Add output format
media: imx: imx-mipi-csis: Add BGR888
media: imx: imx-mipi-csis: Add RGB565_1X16
media: imx: imx-mipi-csis: Set PIXEL_MODE for YUV422
media: imx: imx7-media-csi: Use dual sampling for YUV 1X16
media: imx: Rename imx7-mipi-csis.c to imx-mipi-csis.c
media: imx: De-stage imx7-mipi-csis

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

+183 -35
+1 -1
Documentation/admin-guide/media/imx7.rst
··· 33 33 Entities 34 34 -------- 35 35 36 - imx7-mipi-csi2 36 + imx-mipi-csi2 37 37 -------------- 38 38 39 39 This is the MIPI CSI-2 receiver entity. It has one sink pad to receive the pixel
+1 -1
Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml
··· 1 1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 2 %YAML 1.2 3 3 --- 4 - $id: http://devicetree.org/schemas/media/nxp,imx7-mipi-csi2.yaml# 4 + $id: http://devicetree.org/schemas/media/nxp,imx-mipi-csi2.yaml# 5 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 7 title: NXP i.MX7 and i.MX8 MIPI CSI-2 receiver
+6 -1
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
··· 1698 1698 * - __u8 1699 1699 - ``reference_mode`` 1700 1700 - Specifies the type of inter prediction to be used. See 1701 - :ref:`Reference Mode<vp9_reference_mode>` for more details. 1701 + :ref:`Reference Mode<vp9_reference_mode>` for more details. Note that 1702 + this is derived as part of the compressed header parsing process and 1703 + for this reason should have been part of 1704 + :c:type: `v4l2_ctrl_vp9_compressed_hdr` optional control. It is safe to 1705 + set this value to zero if the driver does not require compressed 1706 + headers. 1702 1707 * - __u8 1703 1708 - ``reserved[7]`` 1704 1709 - Applications and drivers must set this to zero.
+4 -11
Documentation/userspace-api/media/v4l/pixfmt-reserved.rst
··· 233 233 234 234 - ``V4L2_PIX_FMT_MT21C`` 235 235 - 'MT21' 236 - - Compressed two-planar YVU420 format used by Mediatek MT8173. 237 - The compression is lossless. 238 - It is an opaque intermediate format and the MDP hardware must be 236 + - Compressed two-planar YVU420 format used by Mediatek MT8173, MT8192, 237 + MT8195 and more. The compression is lossless. This format have 238 + similitude with ``V4L2_PIX_FMT_MM21`` in term of alignment and tiling. 239 + It remains an opaque intermediate format and the MDP hardware must be 239 240 used to convert ``V4L2_PIX_FMT_MT21C`` to ``V4L2_PIX_FMT_NV12M``, 240 241 ``V4L2_PIX_FMT_YUV420M`` or ``V4L2_PIX_FMT_YVU420``. 241 - * .. _V4L2-PIX-FMT-MM21: 242 - 243 - - ``V4L2_PIX_FMT_MM21`` 244 - - 'MM21' 245 - - Non-compressed, tiled two-planar format used by Mediatek MT8183. 246 - This is an opaque intermediate format and the MDP3 hardware can be 247 - used to convert it to other formats. 248 - 249 242 .. raw:: latex 250 243 251 244 \normalsize
+6
Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
··· 296 296 aligned to a multiple of 32. The layouts of the luma and chroma planes are 297 297 identical. 298 298 299 + ``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels 300 + in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the 301 + image height must be aligned to a multiple of 32. The number of luma and chroma 302 + tiles are identical, even though the tile size differ. The image is formed of 303 + two non-contiguous planes. 304 + 299 305 .. _nv12mt: 300 306 301 307 .. kernel-figure:: nv12mt.svg
+2 -2
MAINTAINERS
··· 11889 11889 S: Maintained 11890 11890 T: git git://linuxtv.org/media_tree.git 11891 11891 F: Documentation/admin-guide/media/imx7.rst 11892 + F: Documentation/devicetree/bindings/media/nxp,imx-mipi-csi2.yaml 11892 11893 F: Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml 11893 - F: Documentation/devicetree/bindings/media/nxp,imx7-mipi-csi2.yaml 11894 + F: drivers/media/platform/imx/imx-mipi-csis.c 11894 11895 F: drivers/staging/media/imx/imx7-media-csi.c 11895 - F: drivers/staging/media/imx/imx7-mipi-csis.c 11896 11896 11897 11897 MEDIA DRIVERS FOR HELENE 11898 11898 M: Abylay Ospan <aospan@netup.ru>
+1 -2
drivers/media/cec/platform/seco/seco-cec.c
··· 12 12 #include <linux/delay.h> 13 13 #include <linux/dmi.h> 14 14 #include <linux/gpio/consumer.h> 15 - #include <linux/gpio.h> 16 15 #include <linux/interrupt.h> 17 16 #include <linux/pci.h> 18 17 #include <linux/platform_device.h> ··· 550 551 struct gpio_desc *gpio; 551 552 int irq = 0; 552 553 553 - gpio = devm_gpiod_get(dev, NULL, GPIOF_IN); 554 + gpio = devm_gpiod_get(dev, NULL, GPIOD_IN); 554 555 if (IS_ERR(gpio)) { 555 556 dev_err(dev, "Cannot request interrupt gpio\n"); 556 557 return PTR_ERR(gpio);
+1
drivers/media/platform/Kconfig
··· 171 171 source "drivers/media/platform/rcar-vin/Kconfig" 172 172 source "drivers/media/platform/atmel/Kconfig" 173 173 source "drivers/media/platform/sunxi/Kconfig" 174 + source "drivers/media/platform/imx/Kconfig" 174 175 175 176 config VIDEO_TI_CAL 176 177 tristate "TI CAL (Camera Adaptation Layer) driver"
+1
drivers/media/platform/Makefile
··· 20 20 obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o 21 21 obj-$(CONFIG_VIDEO_CODA) += coda/ 22 22 23 + obj-$(CONFIG_VIDEO_IMX) += imx/ 23 24 obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o 24 25 obj-$(CONFIG_VIDEO_IMX8_JPEG) += imx-jpeg/ 25 26
+24
drivers/media/platform/imx/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + menuconfig VIDEO_IMX 4 + bool "V4L2 capture drivers for NXP i.MX devices" 5 + depends on ARCH_MXC || COMPILE_TEST 6 + depends on VIDEO_DEV && VIDEO_V4L2 7 + help 8 + Say yes here to enable support for capture drivers on i.MX SoCs. 9 + Support for the single SoC features are selectable in the sub-menu 10 + options. 11 + 12 + if VIDEO_IMX 13 + 14 + config VIDEO_IMX_MIPI_CSIS 15 + tristate "MIPI CSI-2 CSIS receiver found on i.MX7 and i.MX8 models" 16 + select MEDIA_CONTROLLER 17 + select V4L2_FWNODE 18 + select VIDEO_V4L2_SUBDEV_API 19 + default n 20 + help 21 + Video4Linux2 sub-device driver for the MIPI CSI-2 CSIS receiver 22 + v3.3/v3.6.3 found on some i.MX7 and i.MX8 SoCs. 23 + 24 + endif # VIDEO_IMX
+1
drivers/media/platform/imx/Makefile
··· 1 + obj-$(CONFIG_VIDEO_IMX_MIPI_CSIS) += imx-mipi-csis.o
+10
drivers/media/v4l2-core/v4l2-ctrls-core.c
··· 114 114 struct v4l2_ctrl_vp8_frame *p_vp8_frame; 115 115 struct v4l2_ctrl_vp9_frame *p_vp9_frame; 116 116 struct v4l2_ctrl_fwht_params *p_fwht_params; 117 + struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix; 117 118 void *p = ptr.p + idx * ctrl->elem_size; 118 119 119 120 if (ctrl->p_def.p_const) ··· 168 167 p_fwht_params->height = 720; 169 168 p_fwht_params->flags = V4L2_FWHT_FL_PIXENC_YUV | 170 169 (2 << V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET); 170 + break; 171 + case V4L2_CTRL_TYPE_H264_SCALING_MATRIX: 172 + p_h264_scaling_matrix = p; 173 + /* 174 + * The default (flat) H.264 scaling matrix when none are 175 + * specified in the bitstream, this is according to formulas 176 + * (7-8) and (7-9) of the specification. 177 + */ 178 + memset(p_h264_scaling_matrix, 16, sizeof(*p_h264_scaling_matrix)); 171 179 break; 172 180 } 173 181 }
+2 -2
drivers/staging/media/hantro/sunxi_vpu_hw.c
··· 29 29 .frmsize = { 30 30 .min_width = 48, 31 31 .max_width = 3840, 32 - .step_width = MB_DIM, 32 + .step_width = 32, 33 33 .min_height = 48, 34 34 .max_height = 2160, 35 - .step_height = MB_DIM, 35 + .step_height = 32, 36 36 }, 37 37 }, 38 38 };
-1
drivers/staging/media/imx/Makefile
··· 15 15 obj-$(CONFIG_VIDEO_IMX_CSI) += imx6-mipi-csi2.o 16 16 17 17 obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-media-csi.o 18 - obj-$(CONFIG_VIDEO_IMX7_CSI) += imx7-mipi-csis.o 19 18 obj-$(CONFIG_VIDEO_IMX7_CSI) += imx8mq-mipi-csi2.o
+25
drivers/staging/media/imx/TODO
··· 27 27 - i.MX7: all of the above, since it uses the imx media core 28 28 29 29 - i.MX7: use Frame Interval Monitor 30 + 31 + - imx7-media-csi: Restrict the supported formats list to the SoC version. 32 + 33 + The imx7 CSI bridge can be configured to sample pixel components from the Rx 34 + queue in single (8bpp) or double (16bpp) component modes. Image format 35 + variants with different sample sizes (ie YUYV_2X8 vs YUYV_1X16) determine the 36 + pixel components sampling size per each clock cycle and their packing mode 37 + (see imx7_csi_configure() for details). 38 + 39 + As the imx7 CSI bridge can be interfaced with different IP blocks depending on 40 + the SoC model it is integrated on, the Rx queue sampling size should match 41 + the size of the samples transferred by the transmitting IP block. 42 + 43 + To avoid mis-configurations of the capture pipeline, the enumeration of the 44 + supported formats should be restricted to match the pixel source transmitting 45 + mode. 46 + 47 + Example: i.MX8MM SoC integrates the CSI bridge with the Samsung CSIS CSI-2 48 + receiver which operates in dual pixel sampling mode. The CSI bridge should 49 + only expose the 1X16 formats variant which instructs it to operate in dual 50 + pixel sampling mode. When the CSI bridge is instead integrated on an i.MX7, 51 + which supports both serial and parallel input, it should expose both variants. 52 + 53 + This currently only applies to YUYV formats, but other formats might need 54 + to be handled in the same way.
+28 -4
drivers/staging/media/imx/imx7-media-csi.c
··· 498 498 cr3 |= BIT_TWO_8BIT_SENSOR; 499 499 cr18 |= BIT_MIPI_DATA_FORMAT_RAW14; 500 500 break; 501 + 501 502 /* 502 - * CSI-2 sources are supposed to use the 1X16 formats, but not 503 - * all of them comply. Support both variants. 503 + * The CSI bridge has a 16-bit input bus. Depending on the 504 + * connected source, data may be transmitted with 8 or 10 bits 505 + * per clock sample (in bits [9:2] or [9:0] respectively) or 506 + * with 16 bits per clock sample (in bits [15:0]). The data is 507 + * then packed into a 32-bit FIFO (as shown in figure 13-11 of 508 + * the i.MX8MM reference manual rev. 3). 509 + * 510 + * The data packing in a 32-bit FIFO input word is controlled by 511 + * the CR3 TWO_8BIT_SENSOR field (also known as SENSOR_16BITS in 512 + * the i.MX8MM reference manual). When set to 0, data packing 513 + * groups four 8-bit input samples (bits [9:2]). When set to 1, 514 + * data packing groups two 16-bit input samples (bits [15:0]). 515 + * 516 + * The register field CR18 MIPI_DOUBLE_CMPNT also needs to be 517 + * configured according to the input format for YUV 4:2:2 data. 518 + * The field controls the gasket between the CSI-2 receiver and 519 + * the CSI bridge. On i.MX7 and i.MX8MM, the field must be set 520 + * to 1 when the CSIS outputs 16-bit samples. On i.MX8MQ, the 521 + * gasket ignores the MIPI_DOUBLE_CMPNT bit and YUV 4:2:2 always 522 + * uses 16-bit samples. Setting MIPI_DOUBLE_CMPNT in that case 523 + * has no effect, but doesn't cause any issue. 504 524 */ 505 525 case MEDIA_BUS_FMT_UYVY8_2X8: 506 - case MEDIA_BUS_FMT_UYVY8_1X16: 507 526 case MEDIA_BUS_FMT_YUYV8_2X8: 508 - case MEDIA_BUS_FMT_YUYV8_1X16: 509 527 cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B; 528 + break; 529 + case MEDIA_BUS_FMT_UYVY8_1X16: 530 + case MEDIA_BUS_FMT_YUYV8_1X16: 531 + cr3 |= BIT_TWO_8BIT_SENSOR; 532 + cr18 |= BIT_MIPI_DATA_FORMAT_YUV422_8B | 533 + BIT_MIPI_DOUBLE_CMPNT; 510 534 break; 511 535 } 512 536 }
+66 -7
drivers/staging/media/imx/imx7-mipi-csis.c drivers/media/platform/imx/imx-mipi-csis.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * Freescale i.MX7 SoC series MIPI-CSI V3.3 receiver driver 3 + * Samsung CSIS MIPI CSI-2 receiver driver. 4 + * 5 + * The Samsung CSIS IP is a MIPI CSI-2 receiver found in various NXP i.MX7 and 6 + * i.MX8 SoCs. The i.MX7 features version 3.3 of the IP, while i.MX8 features 7 + * version 3.6.3. 4 8 * 5 9 * Copyright (C) 2019 Linaro Ltd 6 10 * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. All Rights Reserved. ··· 35 31 #include <media/v4l2-mc.h> 36 32 #include <media/v4l2-subdev.h> 37 33 38 - #define CSIS_DRIVER_NAME "imx7-mipi-csis" 34 + #define CSIS_DRIVER_NAME "imx-mipi-csis" 39 35 40 36 #define CSIS_PAD_SINK 0 41 37 #define CSIS_PAD_SOURCE 1 ··· 173 169 #define MIPI_CSIS_ISPCFG_PIXEL_MODE_SINGLE (0 << 12) 174 170 #define MIPI_CSIS_ISPCFG_PIXEL_MODE_DUAL (1 << 12) 175 171 #define MIPI_CSIS_ISPCFG_PIXEL_MODE_QUAD (2 << 12) /* i.MX8M[MNP] only */ 172 + #define MIPI_CSIS_ISPCFG_PIXEL_MASK (3 << 12) 176 173 #define MIPI_CSIS_ISPCFG_ALIGN_32BIT BIT(11) 177 174 #define MIPI_CSIS_ISPCFG_FMT(fmt) ((fmt) << 2) 178 175 #define MIPI_CSIS_ISPCFG_FMT_MASK (0x3f << 2) ··· 330 325 331 326 struct mutex lock; /* Protect csis_fmt, format_mbus and state */ 332 327 const struct csis_pix_format *csis_fmt; 333 - struct v4l2_mbus_framefmt format_mbus; 328 + struct v4l2_mbus_framefmt format_mbus[CSIS_PADS_NUM]; 334 329 u32 state; 335 330 336 331 spinlock_t slock; /* Protect events */ ··· 349 344 350 345 struct csis_pix_format { 351 346 u32 code; 347 + u32 output; 352 348 u32 data_type; 353 349 u8 width; 354 350 }; ··· 358 352 /* YUV formats. */ 359 353 { 360 354 .code = MEDIA_BUS_FMT_UYVY8_1X16, 355 + .output = MEDIA_BUS_FMT_UYVY8_1X16, 361 356 .data_type = MIPI_CSI2_DATA_TYPE_YUV422_8, 362 357 .width = 16, 358 + }, 359 + /* RGB formats. */ 360 + { 361 + .code = MEDIA_BUS_FMT_RGB565_1X16, 362 + .output = MEDIA_BUS_FMT_RGB565_1X16, 363 + .data_type = MIPI_CSI2_DATA_TYPE_RGB565, 364 + .width = 16, 365 + }, { 366 + .code = MEDIA_BUS_FMT_BGR888_1X24, 367 + .output = MEDIA_BUS_FMT_RGB888_1X24, 368 + .data_type = MIPI_CSI2_DATA_TYPE_RGB888, 369 + .width = 24, 363 370 }, 364 371 /* RAW (Bayer and greyscale) formats. */ 365 372 { 366 373 .code = MEDIA_BUS_FMT_SBGGR8_1X8, 374 + .output = MEDIA_BUS_FMT_SBGGR8_1X8, 367 375 .data_type = MIPI_CSI2_DATA_TYPE_RAW8, 368 376 .width = 8, 369 377 }, { 370 378 .code = MEDIA_BUS_FMT_SGBRG8_1X8, 379 + .output = MEDIA_BUS_FMT_SGBRG8_1X8, 371 380 .data_type = MIPI_CSI2_DATA_TYPE_RAW8, 372 381 .width = 8, 373 382 }, { 374 383 .code = MEDIA_BUS_FMT_SGRBG8_1X8, 384 + .output = MEDIA_BUS_FMT_SGRBG8_1X8, 375 385 .data_type = MIPI_CSI2_DATA_TYPE_RAW8, 376 386 .width = 8, 377 387 }, { 378 388 .code = MEDIA_BUS_FMT_SRGGB8_1X8, 389 + .output = MEDIA_BUS_FMT_SRGGB8_1X8, 379 390 .data_type = MIPI_CSI2_DATA_TYPE_RAW8, 380 391 .width = 8, 381 392 }, { 382 393 .code = MEDIA_BUS_FMT_Y8_1X8, 394 + .output = MEDIA_BUS_FMT_Y8_1X8, 383 395 .data_type = MIPI_CSI2_DATA_TYPE_RAW8, 384 396 .width = 8, 385 397 }, { 386 398 .code = MEDIA_BUS_FMT_SBGGR10_1X10, 399 + .output = MEDIA_BUS_FMT_SBGGR10_1X10, 387 400 .data_type = MIPI_CSI2_DATA_TYPE_RAW10, 388 401 .width = 10, 389 402 }, { 390 403 .code = MEDIA_BUS_FMT_SGBRG10_1X10, 404 + .output = MEDIA_BUS_FMT_SGBRG10_1X10, 391 405 .data_type = MIPI_CSI2_DATA_TYPE_RAW10, 392 406 .width = 10, 393 407 }, { 394 408 .code = MEDIA_BUS_FMT_SGRBG10_1X10, 409 + .output = MEDIA_BUS_FMT_SGRBG10_1X10, 395 410 .data_type = MIPI_CSI2_DATA_TYPE_RAW10, 396 411 .width = 10, 397 412 }, { 398 413 .code = MEDIA_BUS_FMT_SRGGB10_1X10, 414 + .output = MEDIA_BUS_FMT_SRGGB10_1X10, 399 415 .data_type = MIPI_CSI2_DATA_TYPE_RAW10, 400 416 .width = 10, 401 417 }, { 402 418 .code = MEDIA_BUS_FMT_Y10_1X10, 419 + .output = MEDIA_BUS_FMT_Y10_1X10, 403 420 .data_type = MIPI_CSI2_DATA_TYPE_RAW10, 404 421 .width = 10, 405 422 }, { 406 423 .code = MEDIA_BUS_FMT_SBGGR12_1X12, 424 + .output = MEDIA_BUS_FMT_SBGGR12_1X12, 407 425 .data_type = MIPI_CSI2_DATA_TYPE_RAW12, 408 426 .width = 12, 409 427 }, { 410 428 .code = MEDIA_BUS_FMT_SGBRG12_1X12, 429 + .output = MEDIA_BUS_FMT_SGBRG12_1X12, 411 430 .data_type = MIPI_CSI2_DATA_TYPE_RAW12, 412 431 .width = 12, 413 432 }, { 414 433 .code = MEDIA_BUS_FMT_SGRBG12_1X12, 434 + .output = MEDIA_BUS_FMT_SGRBG12_1X12, 415 435 .data_type = MIPI_CSI2_DATA_TYPE_RAW12, 416 436 .width = 12, 417 437 }, { 418 438 .code = MEDIA_BUS_FMT_SRGGB12_1X12, 439 + .output = MEDIA_BUS_FMT_SRGGB12_1X12, 419 440 .data_type = MIPI_CSI2_DATA_TYPE_RAW12, 420 441 .width = 12, 421 442 }, { 422 443 .code = MEDIA_BUS_FMT_Y12_1X12, 444 + .output = MEDIA_BUS_FMT_Y12_1X12, 423 445 .data_type = MIPI_CSI2_DATA_TYPE_RAW12, 424 446 .width = 12, 425 447 }, { 426 448 .code = MEDIA_BUS_FMT_SBGGR14_1X14, 449 + .output = MEDIA_BUS_FMT_SBGGR14_1X14, 427 450 .data_type = MIPI_CSI2_DATA_TYPE_RAW14, 428 451 .width = 14, 429 452 }, { 430 453 .code = MEDIA_BUS_FMT_SGBRG14_1X14, 454 + .output = MEDIA_BUS_FMT_SGBRG14_1X14, 431 455 .data_type = MIPI_CSI2_DATA_TYPE_RAW14, 432 456 .width = 14, 433 457 }, { 434 458 .code = MEDIA_BUS_FMT_SGRBG14_1X14, 459 + .output = MEDIA_BUS_FMT_SGRBG14_1X14, 435 460 .data_type = MIPI_CSI2_DATA_TYPE_RAW14, 436 461 .width = 14, 437 462 }, { 438 463 .code = MEDIA_BUS_FMT_SRGGB14_1X14, 464 + .output = MEDIA_BUS_FMT_SRGGB14_1X14, 439 465 .data_type = MIPI_CSI2_DATA_TYPE_RAW14, 440 466 .width = 14, 441 467 } ··· 535 497 /* Called with the state.lock mutex held */ 536 498 static void __mipi_csis_set_format(struct csi_state *state) 537 499 { 538 - struct v4l2_mbus_framefmt *mf = &state->format_mbus; 500 + struct v4l2_mbus_framefmt *mf = &state->format_mbus[CSIS_PAD_SINK]; 539 501 u32 val; 540 502 541 503 /* Color format */ 542 504 val = mipi_csis_read(state, MIPI_CSIS_ISP_CONFIG_CH(0)); 543 - val &= ~(MIPI_CSIS_ISPCFG_ALIGN_32BIT | MIPI_CSIS_ISPCFG_FMT_MASK); 505 + val &= ~(MIPI_CSIS_ISPCFG_ALIGN_32BIT | MIPI_CSIS_ISPCFG_FMT_MASK 506 + | MIPI_CSIS_ISPCFG_PIXEL_MASK); 507 + 508 + /* 509 + * YUV 4:2:2 can be transferred with 8 or 16 bits per clock sample 510 + * (referred to in the documentation as single and dual pixel modes 511 + * respectively, although the 8-bit mode transfers half a pixel per 512 + * clock sample and the 16-bit mode one pixel). While both mode work 513 + * when the CSIS is connected to a receiver that supports either option, 514 + * single pixel mode requires clock rates twice as high. As all SoCs 515 + * that integrate the CSIS can operate in 16-bit bit mode, and some do 516 + * not support 8-bit mode (this is the case of the i.MX8MP), use dual 517 + * pixel mode unconditionally. 518 + * 519 + * TODO: Verify which other formats require DUAL (or QUAD) modes. 520 + */ 521 + if (state->csis_fmt->data_type == MIPI_CSI2_DATA_TYPE_YUV422_8) 522 + val |= MIPI_CSIS_ISPCFG_PIXEL_MODE_DUAL; 523 + 544 524 val |= MIPI_CSIS_ISPCFG_FMT(state->csis_fmt->data_type); 545 525 mipi_csis_write(state, MIPI_CSIS_ISP_CONFIG_CH(0), val); 546 526 ··· 967 911 if (which == V4L2_SUBDEV_FORMAT_TRY) 968 912 return v4l2_subdev_get_try_format(&state->sd, sd_state, pad); 969 913 970 - return &state->format_mbus; 914 + return &state->format_mbus[pad]; 971 915 } 972 916 973 917 static int mipi_csis_init_cfg(struct v4l2_subdev *sd, ··· 1129 1073 fmt = mipi_csis_get_format(state, sd_state, sdformat->which, 1130 1074 CSIS_PAD_SOURCE); 1131 1075 *fmt = sdformat->format; 1076 + 1077 + /* The format on the source pad might change due to unpacking. */ 1078 + fmt->code = csis_fmt->output; 1132 1079 1133 1080 /* Store the CSIS format descriptor for active formats. */ 1134 1081 if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE) ··· 1578 1519 1579 1520 MODULE_DESCRIPTION("i.MX7 & i.MX8 MIPI CSI-2 receiver driver"); 1580 1521 MODULE_LICENSE("GPL v2"); 1581 - MODULE_ALIAS("platform:imx7-mipi-csi2"); 1522 + MODULE_ALIAS("platform:imx-mipi-csi2");
+4 -3
drivers/staging/media/imx/imx8mq-mipi-csi2.c
··· 200 200 }, { 201 201 .code = MEDIA_BUS_FMT_SRGGB14_1X14, 202 202 .width = 14, 203 - }, { 203 + }, 204 204 /* YUV formats */ 205 - .code = MEDIA_BUS_FMT_YUYV8_2X8, 205 + { 206 + .code = MEDIA_BUS_FMT_YUYV8_1X16, 206 207 .width = 16, 207 208 }, { 208 - .code = MEDIA_BUS_FMT_YUYV8_1X16, 209 + .code = MEDIA_BUS_FMT_UYVY8_1X16, 209 210 .width = 16, 210 211 } 211 212 };