imx-uapi.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =========================
  3. i.MX Video Capture Driver
  4. =========================
  5. Events
  6. ======
  7. .. _imx_api_ipuX_csiY:
  8. ipuX_csiY
  9. ---------
  10. This subdev can generate the following event when enabling the second
  11. IDMAC source pad:
  12. - V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR
  13. The user application can subscribe to this event from the ipuX_csiY
  14. subdev node. This event is generated by the Frame Interval Monitor
  15. (see below for more on the FIM).
  16. Controls
  17. ========
  18. .. _imx_api_FIM:
  19. Frame Interval Monitor in ipuX_csiY
  20. -----------------------------------
  21. The adv718x decoders can occasionally send corrupt fields during
  22. NTSC/PAL signal re-sync (too little or too many video lines). When
  23. this happens, the IPU triggers a mechanism to re-establish vertical
  24. sync by adding 1 dummy line every frame, which causes a rolling effect
  25. from image to image, and can last a long time before a stable image is
  26. recovered. Or sometimes the mechanism doesn't work at all, causing a
  27. permanent split image (one frame contains lines from two consecutive
  28. captured images).
  29. From experiment it was found that during image rolling, the frame
  30. intervals (elapsed time between two EOF's) drop below the nominal
  31. value for the current standard, by about one frame time (60 usec),
  32. and remain at that value until rolling stops.
  33. While the reason for this observation isn't known (the IPU dummy
  34. line mechanism should show an increase in the intervals by 1 line
  35. time every frame, not a fixed value), we can use it to detect the
  36. corrupt fields using a frame interval monitor. If the FIM detects a
  37. bad frame interval, the ipuX_csiY subdev will send the event
  38. V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR. Userland can register with
  39. the FIM event notification on the ipuX_csiY subdev device node.
  40. Userland can issue a streaming restart when this event is received
  41. to correct the rolling/split image.
  42. The ipuX_csiY subdev includes custom controls to tweak some dials for
  43. FIM. If one of these controls is changed during streaming, the FIM will
  44. be reset and will continue at the new settings.
  45. - V4L2_CID_IMX_FIM_ENABLE
  46. Enable/disable the FIM.
  47. - V4L2_CID_IMX_FIM_NUM
  48. How many frame interval measurements to average before comparing against
  49. the nominal frame interval reported by the sensor. This can reduce noise
  50. caused by interrupt latency.
  51. - V4L2_CID_IMX_FIM_TOLERANCE_MIN
  52. If the averaged intervals fall outside nominal by this amount, in
  53. microseconds, the V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR event is sent.
  54. - V4L2_CID_IMX_FIM_TOLERANCE_MAX
  55. If any intervals are higher than this value, those samples are
  56. discarded and do not enter into the average. This can be used to
  57. discard really high interval errors that might be due to interrupt
  58. latency from high system load.
  59. - V4L2_CID_IMX_FIM_NUM_SKIP
  60. How many frames to skip after a FIM reset or stream restart before
  61. FIM begins to average intervals.
  62. - V4L2_CID_IMX_FIM_ICAP_CHANNEL / V4L2_CID_IMX_FIM_ICAP_EDGE
  63. These controls will configure an input capture channel as the method
  64. for measuring frame intervals. This is superior to the default method
  65. of measuring frame intervals via EOF interrupt, since it is not subject
  66. to uncertainty errors introduced by interrupt latency.
  67. Input capture requires hardware support. A VSYNC signal must be routed
  68. to one of the i.MX6 input capture channel pads.
  69. V4L2_CID_IMX_FIM_ICAP_CHANNEL configures which i.MX6 input capture
  70. channel to use. This must be 0 or 1.
  71. V4L2_CID_IMX_FIM_ICAP_EDGE configures which signal edge will trigger
  72. input capture events. By default the input capture method is disabled
  73. with a value of IRQ_TYPE_NONE. Set this control to IRQ_TYPE_EDGE_RISING,
  74. IRQ_TYPE_EDGE_FALLING, or IRQ_TYPE_EDGE_BOTH to enable input capture,
  75. triggered on the given signal edge(s).
  76. When input capture is disabled, frame intervals will be measured via
  77. EOF interrupt.
  78. File list
  79. ---------
  80. drivers/staging/media/imx/
  81. include/media/imx.h
  82. include/linux/imx-media.h
  83. Authors
  84. -------
  85. - Steve Longerbeam <steve_longerbeam@mentor.com>
  86. - Philipp Zabel <kernel@pengutronix.de>
  87. - Russell King <linux@armlinux.org.uk>
  88. Copyright (C) 2012-2017 Mentor Graphics Inc.