Here it is the patch:

diff --git a/sun7i_tvd-linux-3.4-working/drv_tvd.c 
b/sun7i_tvd-linux-3.4-working/drv_tvd.c
index f387dc1..2055acf 100644
--- a/sun7i_tvd-linux-3.4-working/drv_tvd.c
+++ b/sun7i_tvd-linux-3.4-working/drv_tvd.c
@@ -118,12 +118,12 @@ static irqreturn_t tvd_irq(int irq, void *priv)
  }
  
  if (list_empty(&dma_q->active)) { 
- __err("No active queue to serve\n"); 
+  /*__err("No active queue to serve\n"); */ 
  goto unlock; 
  }
  
  buf = list_entry(dma_q->active.next,struct buffer, vb.queue);
- __dbg("buf ptr=%p\n",buf);
+ /* __dbg("buf ptr=%p\n",buf);  */
 
  /* Nobody is waiting on this buffer*/ 
 
@@ -505,7 +505,18 @@ static int vidioc_g_fmt_vid_cap(struct file *file, 
void *priv,struct v4l2_format
  struct tvd_dev *dev = video_drvdata(file);
 
  __dbg("%s\n", __FUNCTION__);
- 
+
+
+        // if the first time called....
+ if( !dev->fmt )
+ {
+    __inf("%s: this is not set yet: %d, %d\n", __FUNCTION__, dev->width, 
dev->height );
+    dev->fmt                = &tvd_fmt;
+    dev->vb_vidq.field      = V4L2_FIELD_NONE; //format->fmt.pix.field;
+    dev->width              = tvd_fmt.width;
+    dev->height             = tvd_fmt.height;
+        }
+
  format->fmt.pix.width        = dev->width;
  format->fmt.pix.height       = dev->height;
  format->fmt.pix.field        = dev->vb_vidq.field;
@@ -569,15 +580,23 @@ static int vidioc_s_fmt_vid_cap(struct file *file, 
void *priv,struct v4l2_format
  dev->channel_index[2]   = 0;
  dev->channel_index[3]   = 0;
 
+   tvd_fmt.width           = dev->width;
+ tvd_fmt.height          = dev->height;
+
         TVD_config(dev->interface, dev->system);
 
  TVD_set_width(0,format->fmt.pix.width);
  TVD_set_width_jump(0,format->fmt.pix.width);
  TVD_set_height(0,format->fmt.pix.height/2);//for interlace here set half 
of heigh       
- TVD_set_fmt(0, dev->format+1);
+ TVD_set_fmt(0, TVD_PL_YUV420 );
     
         dev->channel_offset_y[0] = 0;
         dev->channel_offset_c[0] = 0;
+
+ if (tvd_clk_init(dev,dev->interface)) 
+ {
+   __err("clock init fail!\n");
+ }
  
 out:
  mutex_unlock(&q->vb_lock);
@@ -991,7 +1010,7 @@ static int buffer_setup(struct videobuf_queue *vq, 
unsigned int *count, unsigned
  switch (dev->fmt->output_fmt) {
  case TVD_MB_YUV420:
  case TVD_PL_YUV420:
- *size = dev->width * dev->height * 3/2;
+        *size = (dev->width * dev->height * 3)/2;
  break; 
  case TVD_PL_YUV422:
  default:
@@ -1005,9 +1024,10 @@ static int buffer_setup(struct videobuf_queue *vq, 
unsigned int *count, unsigned
  if (*count < 3) {
  *count = 3;
  __err("buffer count is invalid, set to 3\n");
- } else if(*count > 5) { 
- *count = 5;
- __err("buffer count is invalid, set to 5\n");
+ } else if(*count > 32) { 
+        __err("buffer count is invalid(%d), set to 32\n", *count );
+ *count = 32;
+ // __err("buffer count is invalid, set to 5\n");
  }
 
  while (*size * *count > MAX_BUFFER) {//FIXME


>

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to