0001 .. SPDX-License-Identifier: GPL-2.0
0002
0003 =========================
0004 i.MX Video Capture Driver
0005 =========================
0006
0007 Events
0008 ======
0009
0010 .. _imx_api_ipuX_csiY:
0011
0012 ipuX_csiY
0013 ---------
0014
0015 This subdev can generate the following event when enabling the second
0016 IDMAC source pad:
0017
0018 - V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR
0019
0020 The user application can subscribe to this event from the ipuX_csiY
0021 subdev node. This event is generated by the Frame Interval Monitor
0022 (see below for more on the FIM).
0023
0024 Controls
0025 ========
0026
0027 .. _imx_api_FIM:
0028
0029 Frame Interval Monitor in ipuX_csiY
0030 -----------------------------------
0031
0032 The adv718x decoders can occasionally send corrupt fields during
0033 NTSC/PAL signal re-sync (too little or too many video lines). When
0034 this happens, the IPU triggers a mechanism to re-establish vertical
0035 sync by adding 1 dummy line every frame, which causes a rolling effect
0036 from image to image, and can last a long time before a stable image is
0037 recovered. Or sometimes the mechanism doesn't work at all, causing a
0038 permanent split image (one frame contains lines from two consecutive
0039 captured images).
0040
0041 From experiment it was found that during image rolling, the frame
0042 intervals (elapsed time between two EOF's) drop below the nominal
0043 value for the current standard, by about one frame time (60 usec),
0044 and remain at that value until rolling stops.
0045
0046 While the reason for this observation isn't known (the IPU dummy
0047 line mechanism should show an increase in the intervals by 1 line
0048 time every frame, not a fixed value), we can use it to detect the
0049 corrupt fields using a frame interval monitor. If the FIM detects a
0050 bad frame interval, the ipuX_csiY subdev will send the event
0051 V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR. Userland can register with
0052 the FIM event notification on the ipuX_csiY subdev device node.
0053 Userland can issue a streaming restart when this event is received
0054 to correct the rolling/split image.
0055
0056 The ipuX_csiY subdev includes custom controls to tweak some dials for
0057 FIM. If one of these controls is changed during streaming, the FIM will
0058 be reset and will continue at the new settings.
0059
0060 - V4L2_CID_IMX_FIM_ENABLE
0061
0062 Enable/disable the FIM.
0063
0064 - V4L2_CID_IMX_FIM_NUM
0065
0066 How many frame interval measurements to average before comparing against
0067 the nominal frame interval reported by the sensor. This can reduce noise
0068 caused by interrupt latency.
0069
0070 - V4L2_CID_IMX_FIM_TOLERANCE_MIN
0071
0072 If the averaged intervals fall outside nominal by this amount, in
0073 microseconds, the V4L2_EVENT_IMX_FRAME_INTERVAL_ERROR event is sent.
0074
0075 - V4L2_CID_IMX_FIM_TOLERANCE_MAX
0076
0077 If any intervals are higher than this value, those samples are
0078 discarded and do not enter into the average. This can be used to
0079 discard really high interval errors that might be due to interrupt
0080 latency from high system load.
0081
0082 - V4L2_CID_IMX_FIM_NUM_SKIP
0083
0084 How many frames to skip after a FIM reset or stream restart before
0085 FIM begins to average intervals.
0086
0087 - V4L2_CID_IMX_FIM_ICAP_CHANNEL / V4L2_CID_IMX_FIM_ICAP_EDGE
0088
0089 These controls will configure an input capture channel as the method
0090 for measuring frame intervals. This is superior to the default method
0091 of measuring frame intervals via EOF interrupt, since it is not subject
0092 to uncertainty errors introduced by interrupt latency.
0093
0094 Input capture requires hardware support. A VSYNC signal must be routed
0095 to one of the i.MX6 input capture channel pads.
0096
0097 V4L2_CID_IMX_FIM_ICAP_CHANNEL configures which i.MX6 input capture
0098 channel to use. This must be 0 or 1.
0099
0100 V4L2_CID_IMX_FIM_ICAP_EDGE configures which signal edge will trigger
0101 input capture events. By default the input capture method is disabled
0102 with a value of IRQ_TYPE_NONE. Set this control to IRQ_TYPE_EDGE_RISING,
0103 IRQ_TYPE_EDGE_FALLING, or IRQ_TYPE_EDGE_BOTH to enable input capture,
0104 triggered on the given signal edge(s).
0105
0106 When input capture is disabled, frame intervals will be measured via
0107 EOF interrupt.
0108
0109
0110 File list
0111 ---------
0112
0113 drivers/staging/media/imx/
0114 include/media/imx.h
0115 include/linux/imx-media.h
0116
0117
0118 Authors
0119 -------
0120
0121 - Steve Longerbeam <steve_longerbeam@mentor.com>
0122 - Philipp Zabel <kernel@pengutronix.de>
0123 - Russell King <linux@armlinux.org.uk>
0124
0125 Copyright (C) 2012-2017 Mentor Graphics Inc.