On Tue, 21 Jun 2011 09:10:22 +0800
"He, Yong M" <yong.m...@intel.com> wrote:

> 
> Hi Kristen,
> 
> The free function is in exit_dma_skipframe_release:
> I use the wrong free size, now corrected. Please review. Thanks!

Hi Yong,
Yes, that is the error path if you get a failure during the
probe routine, however, if you succeed, then you have allocated
this memory and you need to free it when the driver unloads
(in the remove function).

I changed your patch to do this.  Please review.

Thanks,
Kristen

---
A cropped line appears on both camera previewing.
solution is to add a empty frame buffer space. If the in-queue is empty, all
dropped frames goes to this empty buffer.

Signed-off-by: He, Yong <yong.m...@intel.com>
Index: linux-2.6.37/drivers/staging/mrstci/mrstisp/mrstisp_main.c
===================================================================
--- linux-2.6.37.orig/drivers/staging/mrstci/mrstisp/mrstisp_main.c     
2011-06-17 11:41:37.885391003 -0700
+++ linux-2.6.37/drivers/staging/mrstci/mrstisp/mrstisp_main.c  2011-06-21 
09:16:41.296240006 -0700
@@ -46,6 +46,12 @@
 static unsigned long jiffies_start;
 static int mipi_flag;
 
+/* DMA buffer pointer for skipped frames
+ * when input FIFO is empty */
+#define SKIPPED_FRAME_MAX_SIZE 0x00400000
+static void *addr_for_skipped_frame;
+static dma_addr_t dma_addr_for_skipped_frame;
+
 #define ISP_CLOCK_GATING
 #ifdef ISP_CLOCK_GATING
 
@@ -3014,6 +3020,11 @@
                                isp->next->i);
                } else {
                        isp->stopflag = 1;
+                       /* input FIFO is empty, this frame should be skipped
+                        * set DMA WR address to the skipped frame buf*/
+                       mrst_isp_update_marvinvfaddr(isp,
+                                       dma_addr_for_skipped_frame,
+                                       CI_ISP_CFG_UPDATE_FRAME_SYNC);
                        dprintk(0, "stop isp");
                }
 
@@ -3134,6 +3145,9 @@
                video_unregister_device(isp->vdev);
        }
 
+       dma_free_coherent(&pdev->dev, SKIPPED_FRAME_MAX_SIZE,
+               addr_for_skipped_frame, dma_addr_for_skipped_frame);
+
        dma_release_declared_memory(&pdev->dev);
 
        iounmap(isp->regs);
@@ -3219,6 +3233,18 @@
 
        dprintk(1, "isp mb1 = %lx, mb1_size = %lx", isp->mb1, isp->mb1_size);
 
+       /* allocate memory space for the skipped frames */
+       addr_for_skipped_frame = dma_alloc_coherent(&pdev->dev,
+                       SKIPPED_FRAME_MAX_SIZE,
+                       &dma_addr_for_skipped_frame,
+                       GFP_KERNEL);
+
+       if (!addr_for_skipped_frame) {
+               printk(KERN_WARNING "failed to allocate dma memory for skipped 
frame");
+               ret = -ENXIO;
+               goto exit_iounmap;
+       }
+
        ret = dma_declare_coherent_memory(&pdev->dev, start,
                                          /* start, len - 640 * 480 * 2, */
                                          start, len,
@@ -3230,7 +3256,7 @@
        if (!ret) {
                dprintk(0, "failed to declare dma memory");
                ret = -ENXIO;
-               goto exit_iounmap;
+               goto exit_dma_skipframe_release;
        }
 
        /* init device struct */
@@ -3298,6 +3324,9 @@
        video_unregister_device(isp->vdev);
 exit_dma_release:
        dma_release_declared_memory(&pdev->dev);
+exit_dma_skipframe_release:
+       dma_free_coherent(&pdev->dev, SKIPPED_FRAME_MAX_SIZE,
+               addr_for_skipped_frame, dma_addr_for_skipped_frame);
 exit_iounmap:
        iounmap(isp->regs);
 exit_release_regions:
_______________________________________________
MeeGo-kernel mailing list
MeeGo-kernel@lists.meego.com
http://lists.meego.com/listinfo/meego-kernel

Reply via email to