ipu6-isys.rst 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. include:: <isonum.txt>
  3. ========================================================
  4. Intel Image Processing Unit 6 (IPU6) Input System driver
  5. ========================================================
  6. Copyright |copy| 2023--2024 Intel Corporation
  7. Introduction
  8. ============
  9. This file documents the Intel IPU6 (6th generation Image Processing Unit)
  10. Input System (MIPI CSI2 receiver) drivers located under
  11. drivers/media/pci/intel/ipu6.
  12. The Intel IPU6 can be found in certain Intel SoCs but not in all SKUs:
  13. * Tiger Lake
  14. * Jasper Lake
  15. * Alder Lake
  16. * Raptor Lake
  17. * Meteor Lake
  18. Intel IPU6 is made up of two components - Input System (ISYS) and Processing
  19. System (PSYS).
  20. The Input System mainly works as MIPI CSI-2 receiver which receives and
  21. processes the image data from the sensors and outputs the frames to memory.
  22. There are 2 driver modules - intel-ipu6 and intel-ipu6-isys. intel-ipu6 is an
  23. IPU6 common driver which does PCI configuration, firmware loading and parsing,
  24. firmware authentication, DMA mapping and IPU-MMU (internal Memory mapping Unit)
  25. configuration. intel_ipu6_isys implements V4L2, Media Controller and V4L2
  26. sub-device interfaces. The IPU6 ISYS driver supports camera sensors connected
  27. to the IPU6 ISYS through V4L2 sub-device sensor drivers.
  28. .. Note:: See Documentation/driver-api/media/drivers/ipu6.rst for more
  29. information about the IPU6 hardware.
  30. Input system driver
  31. ===================
  32. The Input System driver mainly configures CSI-2 D-PHY, constructs the firmware
  33. stream configuration, sends commands to firmware, gets response from hardware
  34. and firmware and then returns buffers to user. The ISYS is represented as
  35. several V4L2 sub-devices as well as video nodes.
  36. .. kernel-figure:: ipu6_isys_graph.svg
  37. :alt: ipu6 isys media graph with multiple streams support
  38. IPU6 ISYS media graph with multiple streams support
  39. The graph has been produced using the following command:
  40. .. code-block:: none
  41. fdp -Gsplines=true -Tsvg < dot > dot.svg
  42. Capturing frames with IPU6 ISYS
  43. -------------------------------
  44. IPU6 ISYS is used to capture frames from the camera sensors connected to the
  45. CSI2 ports. The supported input formats of ISYS are listed in table below:
  46. .. tabularcolumns:: |p{0.8cm}|p{4.0cm}|p{4.0cm}|
  47. .. flat-table::
  48. :header-rows: 1
  49. * - IPU6 ISYS supported input formats
  50. * - RGB565, RGB888
  51. * - UYVY8, YUYV8
  52. * - RAW8, RAW10, RAW12
  53. .. _ipu6_isys_capture_examples:
  54. Examples
  55. ~~~~~~~~
  56. Here is an example of IPU6 ISYS raw capture on Dell XPS 9315 laptop. On this
  57. machine, ov01a10 sensor is connected to IPU ISYS CSI-2 port 2, which can
  58. generate images at sBGGR10 with resolution 1280x800.
  59. Using the media controller APIs, we can configure ov01a10 sensor by
  60. media-ctl [#f1]_ and yavta [#f2]_ to transmit frames to IPU6 ISYS.
  61. .. code-block:: none
  62. # Example 1 capture frame from ov01a10 camera sensor
  63. # This example assumes /dev/media0 as the IPU ISYS media device
  64. export MDEV=/dev/media0
  65. # Establish the link for the media devices using media-ctl
  66. media-ctl -d $MDEV -l "\"ov01a10 3-0036\":0 -> \"Intel IPU6 CSI2 2\":0[1]"
  67. # Set the format for the media devices
  68. media-ctl -d $MDEV -V "ov01a10:0 [fmt:SBGGR10/1280x800]"
  69. media-ctl -d $MDEV -V "Intel IPU6 CSI2 2:0 [fmt:SBGGR10/1280x800]"
  70. media-ctl -d $MDEV -V "Intel IPU6 CSI2 2:1 [fmt:SBGGR10/1280x800]"
  71. Once the media pipeline is configured, desired sensor specific settings
  72. (such as exposure and gain settings) can be set, using the yavta tool.
  73. e.g
  74. .. code-block:: none
  75. # and that ov01a10 sensor is connected to i2c bus 3 with address 0x36
  76. export SDEV=$(media-ctl -d $MDEV -e "ov01a10 3-0036")
  77. yavta -w 0x009e0903 400 $SDEV
  78. yavta -w 0x009e0913 1000 $SDEV
  79. yavta -w 0x009e0911 2000 $SDEV
  80. Once the desired sensor settings are set, frame captures can be done as below.
  81. e.g
  82. .. code-block:: none
  83. yavta --data-prefix -u -c10 -n5 -I -s 1280x800 --file=/tmp/frame-#.bin \
  84. -f SBGGR10 $(media-ctl -d $MDEV -e "Intel IPU6 ISYS Capture 0")
  85. With the above command, 10 frames are captured at 1280x800 resolution with
  86. sBGGR10 format. The captured frames are available as /tmp/frame-#.bin files.
  87. Here is another example of IPU6 ISYS RAW and metadata capture from camera
  88. sensor ov2740 on Lenovo X1 Yoga laptop.
  89. .. code-block:: none
  90. media-ctl -l "\"ov2740 14-0036\":0 -> \"Intel IPU6 CSI2 1\":0[1]"
  91. media-ctl -l "\"Intel IPU6 CSI2 1\":1 -> \"Intel IPU6 ISYS Capture 0\":0[1]"
  92. media-ctl -l "\"Intel IPU6 CSI2 1\":2 -> \"Intel IPU6 ISYS Capture 1\":0[1]"
  93. # set routing
  94. media-ctl -R "\"Intel IPU6 CSI2 1\" [0/0->1/0[1],0/1->2/1[1]]"
  95. media-ctl -V "\"Intel IPU6 CSI2 1\":0/0 [fmt:SGRBG10/1932x1092]"
  96. media-ctl -V "\"Intel IPU6 CSI2 1\":0/1 [fmt:GENERIC_8/97x1]"
  97. media-ctl -V "\"Intel IPU6 CSI2 1\":1/0 [fmt:SGRBG10/1932x1092]"
  98. media-ctl -V "\"Intel IPU6 CSI2 1\":2/1 [fmt:GENERIC_8/97x1]"
  99. CAPTURE_DEV=$(media-ctl -e "Intel IPU6 ISYS Capture 0")
  100. ./yavta --data-prefix -c100 -n5 -I -s1932x1092 --file=/tmp/frame-#.bin \
  101. -f SGRBG10 ${CAPTURE_DEV}
  102. CAPTURE_META=$(media-ctl -e "Intel IPU6 ISYS Capture 1")
  103. ./yavta --data-prefix -c100 -n5 -I -s97x1 -B meta-capture \
  104. --file=/tmp/meta-#.bin -f GENERIC_8 ${CAPTURE_META}
  105. References
  106. ==========
  107. .. [#f1] https://git.ideasonboard.org/media-ctl.git
  108. .. [#f2] https://git.ideasonboard.org/yavta.git