Skip to content

Commit

Permalink
media: imx-csi: Skip first few frames from a BT.656 source
Browse files Browse the repository at this point in the history
Some BT.656 sensors (e.g. ADV718x) transmit frames with unstable
BT.656 sync codes after initial power on. This confuses the imx
CSI, resulting in vertical and/or horizontal sync issues. Skip
the first 10 frames to avoid the unstable sync codes.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
  • Loading branch information
slongerbeam authored and Gateworks committed Jul 2, 2019
1 parent 1612d4b commit 959fbd4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion drivers/staging/media/imx/imx-media-csi.c
Expand Up @@ -749,9 +749,10 @@ static int csi_setup(struct csi_priv *priv)

static int csi_start(struct csi_priv *priv)
{
struct v4l2_fract *output_fi;
struct v4l2_fract *input_fi, *output_fi;
int ret;

input_fi = &priv->frame_interval[CSI_SINK_PAD];
output_fi = &priv->frame_interval[priv->active_output_pad];

/* start upstream */
Expand All @@ -760,6 +761,17 @@ static int csi_start(struct csi_priv *priv)
if (ret)
return ret;

/* Skip first few frames from a BT.656 source */
if (priv->upstream_ep.bus_type == V4L2_MBUS_BT656) {
u32 delay_usec, bad_frames = 10;

delay_usec = DIV_ROUND_UP_ULL(
(u64)USEC_PER_SEC * input_fi->numerator * bad_frames,
input_fi->denominator);

usleep_range(delay_usec, delay_usec + 1000);
}

if (priv->dest == IPU_CSI_DEST_IDMAC) {
ret = csi_idmac_start(priv);
if (ret)
Expand Down

0 comments on commit 959fbd4

Please sign in to comment.