summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier Martin <javier.martin@vista-silicon.com>2011-12-22 12:12:00 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-06 11:02:14 -0200
commitccd1a499c1675fef5d2a138617507add63cb81db (patch)
tree7f1e85857fcc173e465d6d9c5eb78a55bb169192
parentf410991dcf1fc3ad1d3311b79b4f1b917224ebed (diff)
downloadlinux-ccd1a499c1675fef5d2a138617507add63cb81db.tar.gz
linux-ccd1a499c1675fef5d2a138617507add63cb81db.tar.bz2
linux-ccd1a499c1675fef5d2a138617507add63cb81db.zip
[media] media i.MX27 camera: Fix field_count handling
To properly detect frame loss the driver must keep track of a frame_count. Furthermore, field_count use was erroneous because in progressive format this must be incremented twice. Signed-off-by: Javier Martin <javier.martin@vista-silicon.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/mx2_camera.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index e635ab3c71e7..04aab0c538aa 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -258,6 +258,7 @@ struct mx2_camera_dev {
dma_addr_t discard_buffer_dma;
size_t discard_size;
struct mx2_fmt_cfg *emma_prp;
+ u32 frame_count;
};
/* buffer for one video frame */
@@ -371,6 +372,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd)
writel(pcdev->csicr1, pcdev->base_csi + CSICR1);
pcdev->icd = icd;
+ pcdev->frame_count = 0;
dev_info(icd->parent, "Camera driver attached to camera %d\n",
icd->devnum);
@@ -1374,7 +1376,8 @@ static void mx27_camera_frame_done_emma(struct mx2_camera_dev *pcdev,
list_del(&vb->queue);
vb->state = state;
do_gettimeofday(&vb->ts);
- vb->field_count++;
+ vb->field_count = pcdev->frame_count * 2;
+ pcdev->frame_count++;
wake_up(&vb->done);
}