Commit 6e537b58 authored by Steve Longerbeam's avatar Steve Longerbeam Committed by Mauro Carvalho Chehab
Browse files

media: imx: vdic: rely on VDIC for correct field order



prepare_vdi_in_buffers() was setting up the dma pointers as if the
VDIC is always programmed to receive the fields in bottom-top order,
i.e. as if ipu_vdi_set_field_order() only programs BT order in the VDIC.
But that's not true, ipu_vdi_set_field_order() is working correctly.

So fix prepare_vdi_in_buffers() to give the VDIC the fields in whatever
order they were received by the video source, and rely on the VDIC to
sort out which is top and which is bottom.

Signed-off-by: default avatarSteve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 792f061b
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -219,26 +219,18 @@ static void __maybe_unused prepare_vdi_in_buffers(struct vdic_priv *priv,

	switch (priv->fieldtype) {
	case V4L2_FIELD_SEQ_TB:
		prev_phys = vb2_dma_contig_plane_dma_addr(prev_vb, 0);
		curr_phys = vb2_dma_contig_plane_dma_addr(curr_vb, 0) + fs;
		next_phys = vb2_dma_contig_plane_dma_addr(curr_vb, 0);
		break;
	case V4L2_FIELD_SEQ_BT:
		prev_phys = vb2_dma_contig_plane_dma_addr(prev_vb, 0) + fs;
		curr_phys = vb2_dma_contig_plane_dma_addr(curr_vb, 0);
		next_phys = vb2_dma_contig_plane_dma_addr(curr_vb, 0) + fs;
		break;
	case V4L2_FIELD_INTERLACED_TB:
	case V4L2_FIELD_INTERLACED_BT:
	case V4L2_FIELD_INTERLACED:
		prev_phys = vb2_dma_contig_plane_dma_addr(prev_vb, 0) + is;
		curr_phys = vb2_dma_contig_plane_dma_addr(curr_vb, 0);
		next_phys = vb2_dma_contig_plane_dma_addr(curr_vb, 0) + is;
		break;
	default:
		/* assume V4L2_FIELD_INTERLACED_TB */
		prev_phys = vb2_dma_contig_plane_dma_addr(prev_vb, 0);
		curr_phys = vb2_dma_contig_plane_dma_addr(curr_vb, 0) + is;
		next_phys = vb2_dma_contig_plane_dma_addr(curr_vb, 0);
		break;
	}

	ipu_cpmem_set_buffer(priv->vdi_in_ch_p, 0, prev_phys);