aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/tw68
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-11-18 07:51:01 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-25 05:55:32 -0500
commit0c3a14c177aa85afb991e7c2be3921aa9a52a893 (patch)
treede833b66ee640393292bc404e16c8f43a49ae89c /drivers/media/pci/tw68
parente5ae8fa739f8a1d5c292c5b13fa33ac64166e5a0 (diff)
[media] vb2-dma-sg: add allocation context to dma-sg
Require that dma-sg also uses an allocation context. This is in preparation for adding prepare/finish memops to sync the memory between DMA and CPU. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Pawel Osciak <pawel@osciak.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/pci/tw68')
-rw-r--r--drivers/media/pci/tw68/tw68-core.c15
-rw-r--r--drivers/media/pci/tw68/tw68-video.c1
-rw-r--r--drivers/media/pci/tw68/tw68.h1
3 files changed, 14 insertions, 3 deletions
diff --git a/drivers/media/pci/tw68/tw68-core.c b/drivers/media/pci/tw68/tw68-core.c
index 63f0b64057cb..c135165a8b26 100644
--- a/drivers/media/pci/tw68/tw68-core.c
+++ b/drivers/media/pci/tw68/tw68-core.c
@@ -304,13 +304,19 @@ static int tw68_initdev(struct pci_dev *pci_dev,
304 /* Then do any initialisation wanted before interrupts are on */ 304 /* Then do any initialisation wanted before interrupts are on */
305 tw68_hw_init1(dev); 305 tw68_hw_init1(dev);
306 306
307 dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);
308 if (IS_ERR(dev->alloc_ctx)) {
309 err = PTR_ERR(dev->alloc_ctx);
310 goto fail3;
311 }
312
307 /* get irq */ 313 /* get irq */
308 err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw68_irq, 314 err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw68_irq,
309 IRQF_SHARED, dev->name, dev); 315 IRQF_SHARED, dev->name, dev);
310 if (err < 0) { 316 if (err < 0) {
311 pr_err("%s: can't get IRQ %d\n", 317 pr_err("%s: can't get IRQ %d\n",
312 dev->name, pci_dev->irq); 318 dev->name, pci_dev->irq);
313 goto fail3; 319 goto fail4;
314 } 320 }
315 321
316 /* 322 /*
@@ -324,7 +330,7 @@ static int tw68_initdev(struct pci_dev *pci_dev,
324 if (err < 0) { 330 if (err < 0) {
325 pr_err("%s: can't register video device\n", 331 pr_err("%s: can't register video device\n",
326 dev->name); 332 dev->name);
327 goto fail4; 333 goto fail5;
328 } 334 }
329 tw_setl(TW68_INTMASK, dev->pci_irqmask); 335 tw_setl(TW68_INTMASK, dev->pci_irqmask);
330 336
@@ -333,8 +339,10 @@ static int tw68_initdev(struct pci_dev *pci_dev,
333 339
334 return 0; 340 return 0;
335 341
336fail4: 342fail5:
337 video_unregister_device(&dev->vdev); 343 video_unregister_device(&dev->vdev);
344fail4:
345 vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
338fail3: 346fail3:
339 iounmap(dev->lmmio); 347 iounmap(dev->lmmio);
340fail2: 348fail2:
@@ -358,6 +366,7 @@ static void tw68_finidev(struct pci_dev *pci_dev)
358 /* unregister */ 366 /* unregister */
359 video_unregister_device(&dev->vdev); 367 video_unregister_device(&dev->vdev);
360 v4l2_ctrl_handler_free(&dev->hdl); 368 v4l2_ctrl_handler_free(&dev->hdl);
369 vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
361 370
362 /* release resources */ 371 /* release resources */
363 iounmap(dev->lmmio); 372 iounmap(dev->lmmio);
diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c
index 5c94ac7c88d9..50dcce6251f6 100644
--- a/drivers/media/pci/tw68/tw68-video.c
+++ b/drivers/media/pci/tw68/tw68-video.c
@@ -384,6 +384,7 @@ static int tw68_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
384 unsigned tot_bufs = q->num_buffers + *num_buffers; 384 unsigned tot_bufs = q->num_buffers + *num_buffers;
385 385
386 sizes[0] = (dev->fmt->depth * dev->width * dev->height) >> 3; 386 sizes[0] = (dev->fmt->depth * dev->width * dev->height) >> 3;
387 alloc_ctxs[0] = dev->alloc_ctx;
387 /* 388 /*
388 * We allow create_bufs, but only if the sizeimage is the same as the 389 * We allow create_bufs, but only if the sizeimage is the same as the
389 * current sizeimage. The tw68_buffer_count calculation becomes quite 390 * current sizeimage. The tw68_buffer_count calculation becomes quite
diff --git a/drivers/media/pci/tw68/tw68.h b/drivers/media/pci/tw68/tw68.h
index 2c8abe26b13b..7a7501bd165f 100644
--- a/drivers/media/pci/tw68/tw68.h
+++ b/drivers/media/pci/tw68/tw68.h
@@ -181,6 +181,7 @@ struct tw68_dev {
181 unsigned field; 181 unsigned field;
182 struct vb2_queue vidq; 182 struct vb2_queue vidq;
183 struct list_head active; 183 struct list_head active;
184 void *alloc_ctx;
184 185
185 /* various v4l controls */ 186 /* various v4l controls */
186 const struct tw68_tvnorm *tvnorm; /* video */ 187 const struct tw68_tvnorm *tvnorm; /* video */