Skip to content

Commit 3c87e08

Browse files
slongerbeamgregkh
authored andcommitted
media: imx-csi: Skip first few frames from a BT.656 source
[ Upstream commit e198be3 ] 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 20 frames to avoid the unstable sync codes. [fabio: fixed checkpatch warning and increased the frame skipping to 20] Signed-off-by: Steve Longerbeam <[email protected]> Signed-off-by: Fabio Estevam <[email protected]> Reviewed-by: Tim Harvey <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent a3f73fe commit 3c87e08

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/staging/media/imx/imx-media-csi.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -730,9 +730,10 @@ static int csi_setup(struct csi_priv *priv)
730730

731731
static int csi_start(struct csi_priv *priv)
732732
{
733-
struct v4l2_fract *output_fi;
733+
struct v4l2_fract *input_fi, *output_fi;
734734
int ret;
735735

736+
input_fi = &priv->frame_interval[CSI_SINK_PAD];
736737
output_fi = &priv->frame_interval[priv->active_output_pad];
737738

738739
/* start upstream */
@@ -741,6 +742,17 @@ static int csi_start(struct csi_priv *priv)
741742
if (ret)
742743
return ret;
743744

745+
/* Skip first few frames from a BT.656 source */
746+
if (priv->upstream_ep.bus_type == V4L2_MBUS_BT656) {
747+
u32 delay_usec, bad_frames = 20;
748+
749+
delay_usec = DIV_ROUND_UP_ULL((u64)USEC_PER_SEC *
750+
input_fi->numerator * bad_frames,
751+
input_fi->denominator);
752+
753+
usleep_range(delay_usec, delay_usec + 1000);
754+
}
755+
744756
if (priv->dest == IPU_CSI_DEST_IDMAC) {
745757
ret = csi_idmac_start(priv);
746758
if (ret)

0 commit comments

Comments
 (0)