From fe47a1b7bbbcf60b0b02241ab36f56bc0df6ffdd Mon Sep 17 00:00:00 2001 From: root Date: Mon, 9 Apr 2012 18:13:26 +0800 Subject: [PATCH] camera rk30: fix scaled erro of some resolution,fix bug on taking pic continuously. --- drivers/media/video/ov2655.c | 2 +- drivers/media/video/rk30_camera_oneframe.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/media/video/ov2655.c b/drivers/media/video/ov2655.c index 28ea3bc3985a..fbdce216337e 100755 --- a/drivers/media/video/ov2655.c +++ b/drivers/media/video/ov2655.c @@ -374,7 +374,7 @@ static struct reginfo sensor_uxga[] = /* 1280X1024 SXGA */ static struct reginfo sensor_sxga[] = { -#if 0 +#if 1 {0x300E, 0x34}, {0x3011, 0x00}, {0x3012, 0x00}, diff --git a/drivers/media/video/rk30_camera_oneframe.c b/drivers/media/video/rk30_camera_oneframe.c index 85196b5ab0ea..8a9460f9ed26 100755 --- a/drivers/media/video/rk30_camera_oneframe.c +++ b/drivers/media/video/rk30_camera_oneframe.c @@ -381,7 +381,8 @@ static int rk_videobuf_setup(struct videobuf_queue *vq, unsigned int *count, pcdev->camera_work_count = *count; } } - + //must be reinit,or will be somthing wrong in irq process. + pcdev->active = NULL; RKCAMERA_DG("%s..%d.. videobuf size:%d, vipmem_buf size:%d, count:%d \n",__FUNCTION__,__LINE__, *size,pcdev->vipmem_size, *count); return 0; @@ -505,7 +506,6 @@ static void rk_videobuf_queue(struct videobuf_queue *vq, vb, vb->baddr, vb->bsize); vb->state = VIDEOBUF_QUEUED; - if (list_empty(&pcdev->capture)) { list_add_tail(&vb->queue, &pcdev->capture); } else { @@ -571,7 +571,7 @@ static void rk_camera_capture_process(struct work_struct *work) ipp_req.timeout = 100; ipp_req.flag = IPP_ROT_0; // if(pcdev->icd->user_width != pcdev->zoominfo.vir_width) - // ipp_req.store_clip_mode =1; + ipp_req.store_clip_mode =1; ipp_req.src0.w = pcdev->zoominfo.a.c.width/scale_times; ipp_req.src0.h = pcdev->zoominfo.a.c.height/scale_times; //ipp_req.src_vir_w = pcdev->zoominfo.a.c.width; @@ -645,7 +645,6 @@ static irqreturn_t rk_camera_irq(int irq, void *data) pcdev->fps++; if (!pcdev->active) goto RK_CAMERA_IRQ_END; - if (pcdev->frame_inval>0) { pcdev->frame_inval--; rk_videobuf_capture(pcdev->active,pcdev); @@ -654,13 +653,11 @@ static irqreturn_t rk_camera_irq(int irq, void *data) RKCAMERA_TR("frame_inval : %0x",pcdev->frame_inval); pcdev->frame_inval = 0; } - vb = pcdev->active; /* ddl@rock-chips.com : this vb may be deleted from queue */ if ((vb->state == VIDEOBUF_QUEUED) || (vb->state == VIDEOBUF_ACTIVE)) { list_del_init(&vb->queue); } - pcdev->active = NULL; if (!list_empty(&pcdev->capture)) { pcdev->active = list_entry(pcdev->capture.next, struct videobuf_buffer, queue); @@ -668,7 +665,6 @@ static irqreturn_t rk_camera_irq(int irq, void *data) rk_videobuf_capture(pcdev->active,pcdev); } } - if (pcdev->active == NULL) { RKCAMERA_DG("%s video_buf queue is empty!\n",__FUNCTION__); } @@ -678,14 +674,12 @@ static irqreturn_t rk_camera_irq(int irq, void *data) do_gettimeofday(&vb->ts); vb->field_count++; } - if (CAM_WORKQUEUE_IS_EN()) { wk = pcdev->camera_work + vb->i; INIT_WORK(&(wk->work), rk_camera_capture_process); - wk->vb = vb; + wk->vb = vb; wk->pcdev = pcdev; queue_work(pcdev->camera_wq, &(wk->work)); - } else { wake_up(&vb->done); } @@ -1307,6 +1301,9 @@ static int rk_camera_set_fmt(struct soc_camera_device *icd, ratio = ((mf.width*10/usr_w) >= (mf.height*10/usr_h))?(mf.height*10/usr_h):(mf.width*10/usr_w); pcdev->host_width = ratio*usr_w/10; pcdev->host_height = ratio*usr_h/10; + //for ipp ,need 4 bit alligned. + pcdev->host_width &= ~0x03; + pcdev->host_height &= ~0x03; RKCAMERA_DG("ratio = %d ,host:%d*%d\n",ratio,pcdev->host_width,pcdev->host_height); } else{ // needn't crop ,just scaled by ipp -- 2.34.1