aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/davinci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/davinci')
-rw-r--r--drivers/media/video/davinci/vpfe_capture.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index 2b906753f13c..d4676ad41f39 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -539,6 +539,16 @@ static void vpfe_schedule_next_buffer(struct vpfe_device *vpfe_dev)
539 list_del(&vpfe_dev->next_frm->queue); 539 list_del(&vpfe_dev->next_frm->queue);
540 vpfe_dev->next_frm->state = VIDEOBUF_ACTIVE; 540 vpfe_dev->next_frm->state = VIDEOBUF_ACTIVE;
541 addr = videobuf_to_dma_contig(vpfe_dev->next_frm); 541 addr = videobuf_to_dma_contig(vpfe_dev->next_frm);
542
543 ccdc_dev->hw_ops.setfbaddr(addr);
544}
545
546static void vpfe_schedule_bottom_field(struct vpfe_device *vpfe_dev)
547{
548 unsigned long addr;
549
550 addr = videobuf_to_dma_contig(vpfe_dev->cur_frm);
551 addr += vpfe_dev->field_off;
542 ccdc_dev->hw_ops.setfbaddr(addr); 552 ccdc_dev->hw_ops.setfbaddr(addr);
543} 553}
544 554
@@ -559,7 +569,6 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id)
559{ 569{
560 struct vpfe_device *vpfe_dev = dev_id; 570 struct vpfe_device *vpfe_dev = dev_id;
561 enum v4l2_field field; 571 enum v4l2_field field;
562 unsigned long addr;
563 int fid; 572 int fid;
564 573
565 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "\nStarting vpfe_isr...\n"); 574 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "\nStarting vpfe_isr...\n");
@@ -604,10 +613,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id)
604 * the CCDC memory address 613 * the CCDC memory address
605 */ 614 */
606 if (field == V4L2_FIELD_SEQ_TB) { 615 if (field == V4L2_FIELD_SEQ_TB) {
607 addr = 616 vpfe_schedule_bottom_field(vpfe_dev);
608 videobuf_to_dma_contig(vpfe_dev->cur_frm);
609 addr += vpfe_dev->field_off;
610 ccdc_dev->hw_ops.setfbaddr(addr);
611 } 617 }
612 goto clear_intr; 618 goto clear_intr;
613 } 619 }
@@ -1234,7 +1240,10 @@ static int vpfe_videobuf_setup(struct videobuf_queue *vq,
1234 struct vpfe_device *vpfe_dev = fh->vpfe_dev; 1240 struct vpfe_device *vpfe_dev = fh->vpfe_dev;
1235 1241
1236 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_buffer_setup\n"); 1242 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_buffer_setup\n");
1237 *size = config_params.device_bufsize; 1243 *size = vpfe_dev->fmt.fmt.pix.sizeimage;
1244 if (vpfe_dev->memory == V4L2_MEMORY_MMAP &&
1245 vpfe_dev->fmt.fmt.pix.sizeimage > config_params.device_bufsize)
1246 *size = config_params.device_bufsize;
1238 1247
1239 if (*count < config_params.min_numbuffers) 1248 if (*count < config_params.min_numbuffers)
1240 *count = config_params.min_numbuffers; 1249 *count = config_params.min_numbuffers;
@@ -1249,6 +1258,8 @@ static int vpfe_videobuf_prepare(struct videobuf_queue *vq,
1249{ 1258{
1250 struct vpfe_fh *fh = vq->priv_data; 1259 struct vpfe_fh *fh = vq->priv_data;
1251 struct vpfe_device *vpfe_dev = fh->vpfe_dev; 1260 struct vpfe_device *vpfe_dev = fh->vpfe_dev;
1261 unsigned long addr;
1262 int ret;
1252 1263
1253 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_buffer_prepare\n"); 1264 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_buffer_prepare\n");
1254 1265
@@ -1258,8 +1269,18 @@ static int vpfe_videobuf_prepare(struct videobuf_queue *vq,
1258 vb->height = vpfe_dev->fmt.fmt.pix.height; 1269 vb->height = vpfe_dev->fmt.fmt.pix.height;
1259 vb->size = vpfe_dev->fmt.fmt.pix.sizeimage; 1270 vb->size = vpfe_dev->fmt.fmt.pix.sizeimage;
1260 vb->field = field; 1271 vb->field = field;
1272
1273 ret = videobuf_iolock(vq, vb, NULL);;
1274 if (ret < 0)
1275 return ret;
1276
1277 addr = videobuf_to_dma_contig(vb);
1278 /* Make sure user addresses are aligned to 32 bytes */
1279 if (!ALIGN(addr, 32))
1280 return -EINVAL;
1281
1282 vb->state = VIDEOBUF_PREPARED;
1261 } 1283 }
1262 vb->state = VIDEOBUF_PREPARED;
1263 return 0; 1284 return 0;
1264} 1285}
1265 1286
@@ -1327,13 +1348,6 @@ static int vpfe_reqbufs(struct file *file, void *priv,
1327 return -EINVAL; 1348 return -EINVAL;
1328 } 1349 }
1329 1350
1330 if (V4L2_MEMORY_USERPTR == req_buf->memory) {
1331 /* we don't support user ptr IO */
1332 v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_reqbufs:"
1333 " USERPTR IO not supported\n");
1334 return -EINVAL;
1335 }
1336
1337 ret = mutex_lock_interruptible(&vpfe_dev->lock); 1351 ret = mutex_lock_interruptible(&vpfe_dev->lock);
1338 if (ret) 1352 if (ret)
1339 return ret; 1353 return ret;