Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
[pandora-kernel.git] / drivers / media / video / mx2_camera.c
index 3fba600..4a27862 100644 (file)
@@ -461,7 +461,7 @@ static void free_buffer(struct videobuf_queue *vq, struct mx2_buffer *buf)
 
        /*
         * This waits until this buffer is out of danger, i.e., until it is no
-        * longer in STATE_QUEUED or STATE_ACTIVE
+        * longer in state VIDEOBUF_QUEUED or VIDEOBUF_ACTIVE
         */
        videobuf_waiton(vq, vb, 0, 0);
 
@@ -640,15 +640,27 @@ static void mx2_videobuf_release(struct videobuf_queue *vq,
         * Terminate only queued but inactive buffers. Active buffers are
         * released when they become inactive after videobuf_waiton().
         *
-        * FIXME: implement forced termination of active buffers, so that the
-        * user won't get stuck in an uninterruptible state. This requires a
-        * specific handling for each of the three DMA types that this driver
-        * supports.
+        * FIXME: implement forced termination of active buffers for mx27 and
+        * mx27 eMMA, so that the user won't get stuck in an uninterruptible
+        * state. This requires a specific handling for each of the these DMA
+        * types.
         */
        spin_lock_irqsave(&pcdev->lock, flags);
        if (vb->state == VIDEOBUF_QUEUED) {
                list_del(&vb->queue);
                vb->state = VIDEOBUF_ERROR;
+       } else if (cpu_is_mx25() && vb->state == VIDEOBUF_ACTIVE) {
+               if (pcdev->fb1_active == buf) {
+                       pcdev->csicr1 &= ~CSICR1_FB1_DMA_INTEN;
+                       writel(0, pcdev->base_csi + CSIDMASA_FB1);
+                       pcdev->fb1_active = NULL;
+               } else if (pcdev->fb2_active == buf) {
+                       pcdev->csicr1 &= ~CSICR1_FB2_DMA_INTEN;
+                       writel(0, pcdev->base_csi + CSIDMASA_FB2);
+                       pcdev->fb2_active = NULL;
+               }
+               writel(pcdev->csicr1, pcdev->base_csi + CSICR1);
+               vb->state = VIDEOBUF_ERROR;
        }
        spin_unlock_irqrestore(&pcdev->lock, flags);
 
@@ -670,7 +682,7 @@ static void mx2_camera_init_videobuf(struct videobuf_queue *q,
 
        videobuf_queue_dma_contig_init(q, &mx2_videobuf_ops, pcdev->dev,
                        &pcdev->lock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
-                       V4L2_FIELD_NONE, sizeof(struct mx2_buffer), icd);
+                       V4L2_FIELD_NONE, sizeof(struct mx2_buffer), icd, NULL);
 }
 
 #define MX2_BUS_FLAGS  (SOCAM_DATAWIDTH_8 | \
@@ -1421,6 +1433,9 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
        if (err)
                goto exit_free_emma;
 
+       dev_info(&pdev->dev, "MX2 Camera (CSI) driver probed, clock frequency: %ld\n",
+                       clk_get_rate(pcdev->clk_csi));
+
        return 0;
 
 exit_free_emma: