diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2016-02-15 10:09:10 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-08 13:39:21 -0400 |
commit | 53ddcc683faef8c730c7162fa1ef2261a385d16d (patch) | |
tree | 657e3cbb9136b0bee5ef6680137067c15e4fb6b7 | |
parent | 57813da417f9c9aff1299a24182f590deac08c19 (diff) |
[media] media/platform: convert drivers to use the new vb2_queue dev field
Stop using alloc_ctx and just fill in the device pointer.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Scott Jiang <scott.jiang.linux@gmail.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/platform/am437x/am437x-vpfe.c | 10 | ||||
-rw-r--r-- | drivers/media/platform/am437x/am437x-vpfe.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/blackfin/bfin_capture.c | 15 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 16 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda.h | 1 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpbe_display.c | 12 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.c | 11 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_capture.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_display.c | 11 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpif_display.h | 2 | ||||
-rw-r--r-- | drivers/media/platform/rcar-vin/rcar-dma.c | 11 | ||||
-rw-r--r-- | drivers/media/platform/rcar-vin/rcar-vin.h | 2 | ||||
-rw-r--r-- | include/media/davinci/vpbe_display.h | 2 |
13 files changed, 9 insertions, 88 deletions
diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c index e749eb7c3be9..d22b09db9fd0 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.c +++ b/drivers/media/platform/am437x/am437x-vpfe.c | |||
@@ -1915,7 +1915,6 @@ static int vpfe_queue_setup(struct vb2_queue *vq, | |||
1915 | 1915 | ||
1916 | if (vq->num_buffers + *nbuffers < 3) | 1916 | if (vq->num_buffers + *nbuffers < 3) |
1917 | *nbuffers = 3 - vq->num_buffers; | 1917 | *nbuffers = 3 - vq->num_buffers; |
1918 | alloc_ctxs[0] = vpfe->alloc_ctx; | ||
1919 | 1918 | ||
1920 | if (*nplanes) { | 1919 | if (*nplanes) { |
1921 | if (sizes[0] < size) | 1920 | if (sizes[0] < size) |
@@ -2364,13 +2363,6 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe) | |||
2364 | goto probe_out; | 2363 | goto probe_out; |
2365 | 2364 | ||
2366 | /* Initialize videobuf2 queue as per the buffer type */ | 2365 | /* Initialize videobuf2 queue as per the buffer type */ |
2367 | vpfe->alloc_ctx = vb2_dma_contig_init_ctx(vpfe->pdev); | ||
2368 | if (IS_ERR(vpfe->alloc_ctx)) { | ||
2369 | vpfe_err(vpfe, "Failed to get the context\n"); | ||
2370 | err = PTR_ERR(vpfe->alloc_ctx); | ||
2371 | goto probe_out; | ||
2372 | } | ||
2373 | |||
2374 | q = &vpfe->buffer_queue; | 2366 | q = &vpfe->buffer_queue; |
2375 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 2367 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
2376 | q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; | 2368 | q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; |
@@ -2381,11 +2373,11 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe) | |||
2381 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 2373 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
2382 | q->lock = &vpfe->lock; | 2374 | q->lock = &vpfe->lock; |
2383 | q->min_buffers_needed = 1; | 2375 | q->min_buffers_needed = 1; |
2376 | q->dev = vpfe->pdev; | ||
2384 | 2377 | ||
2385 | err = vb2_queue_init(q); | 2378 | err = vb2_queue_init(q); |
2386 | if (err) { | 2379 | if (err) { |
2387 | vpfe_err(vpfe, "vb2_queue_init() failed\n"); | 2380 | vpfe_err(vpfe, "vb2_queue_init() failed\n"); |
2388 | vb2_dma_contig_cleanup_ctx(vpfe->alloc_ctx); | ||
2389 | goto probe_out; | 2381 | goto probe_out; |
2390 | } | 2382 | } |
2391 | 2383 | ||
diff --git a/drivers/media/platform/am437x/am437x-vpfe.h b/drivers/media/platform/am437x/am437x-vpfe.h index 777bf97fea57..17d7aa426788 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.h +++ b/drivers/media/platform/am437x/am437x-vpfe.h | |||
@@ -264,8 +264,6 @@ struct vpfe_device { | |||
264 | struct v4l2_rect crop; | 264 | struct v4l2_rect crop; |
265 | /* Buffer queue used in video-buf */ | 265 | /* Buffer queue used in video-buf */ |
266 | struct vb2_queue buffer_queue; | 266 | struct vb2_queue buffer_queue; |
267 | /* Allocator-specific contexts for each plane */ | ||
268 | struct vb2_alloc_ctx *alloc_ctx; | ||
269 | /* Queue of filled frames */ | 267 | /* Queue of filled frames */ |
270 | struct list_head dma_queue; | 268 | struct list_head dma_queue; |
271 | /* IRQ lock for DMA queue */ | 269 | /* IRQ lock for DMA queue */ |
diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c index d0092dae7a57..1e2442876d26 100644 --- a/drivers/media/platform/blackfin/bfin_capture.c +++ b/drivers/media/platform/blackfin/bfin_capture.c | |||
@@ -91,8 +91,6 @@ struct bcap_device { | |||
91 | struct bcap_buffer *cur_frm; | 91 | struct bcap_buffer *cur_frm; |
92 | /* buffer queue used in videobuf2 */ | 92 | /* buffer queue used in videobuf2 */ |
93 | struct vb2_queue buffer_queue; | 93 | struct vb2_queue buffer_queue; |
94 | /* allocator-specific contexts for each plane */ | ||
95 | struct vb2_alloc_ctx *alloc_ctx; | ||
96 | /* queue of filled frames */ | 94 | /* queue of filled frames */ |
97 | struct list_head dma_queue; | 95 | struct list_head dma_queue; |
98 | /* used in videobuf2 callback */ | 96 | /* used in videobuf2 callback */ |
@@ -209,7 +207,6 @@ static int bcap_queue_setup(struct vb2_queue *vq, | |||
209 | 207 | ||
210 | if (vq->num_buffers + *nbuffers < 2) | 208 | if (vq->num_buffers + *nbuffers < 2) |
211 | *nbuffers = 2; | 209 | *nbuffers = 2; |
212 | alloc_ctxs[0] = bcap_dev->alloc_ctx; | ||
213 | 210 | ||
214 | if (*nplanes) | 211 | if (*nplanes) |
215 | return sizes[0] < bcap_dev->fmt.sizeimage ? -EINVAL : 0; | 212 | return sizes[0] < bcap_dev->fmt.sizeimage ? -EINVAL : 0; |
@@ -820,12 +817,6 @@ static int bcap_probe(struct platform_device *pdev) | |||
820 | } | 817 | } |
821 | bcap_dev->ppi->priv = bcap_dev; | 818 | bcap_dev->ppi->priv = bcap_dev; |
822 | 819 | ||
823 | bcap_dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); | ||
824 | if (IS_ERR(bcap_dev->alloc_ctx)) { | ||
825 | ret = PTR_ERR(bcap_dev->alloc_ctx); | ||
826 | goto err_free_ppi; | ||
827 | } | ||
828 | |||
829 | vfd = &bcap_dev->video_dev; | 820 | vfd = &bcap_dev->video_dev; |
830 | /* initialize field of video device */ | 821 | /* initialize field of video device */ |
831 | vfd->release = video_device_release_empty; | 822 | vfd->release = video_device_release_empty; |
@@ -839,7 +830,7 @@ static int bcap_probe(struct platform_device *pdev) | |||
839 | if (ret) { | 830 | if (ret) { |
840 | v4l2_err(pdev->dev.driver, | 831 | v4l2_err(pdev->dev.driver, |
841 | "Unable to register v4l2 device\n"); | 832 | "Unable to register v4l2 device\n"); |
842 | goto err_cleanup_ctx; | 833 | goto err_free_ppi; |
843 | } | 834 | } |
844 | v4l2_info(&bcap_dev->v4l2_dev, "v4l2 device registered\n"); | 835 | v4l2_info(&bcap_dev->v4l2_dev, "v4l2 device registered\n"); |
845 | 836 | ||
@@ -863,6 +854,7 @@ static int bcap_probe(struct platform_device *pdev) | |||
863 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 854 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
864 | q->lock = &bcap_dev->mutex; | 855 | q->lock = &bcap_dev->mutex; |
865 | q->min_buffers_needed = 1; | 856 | q->min_buffers_needed = 1; |
857 | q->dev = &pdev->dev; | ||
866 | 858 | ||
867 | ret = vb2_queue_init(q); | 859 | ret = vb2_queue_init(q); |
868 | if (ret) | 860 | if (ret) |
@@ -967,8 +959,6 @@ err_free_handler: | |||
967 | v4l2_ctrl_handler_free(&bcap_dev->ctrl_handler); | 959 | v4l2_ctrl_handler_free(&bcap_dev->ctrl_handler); |
968 | err_unreg_v4l2: | 960 | err_unreg_v4l2: |
969 | v4l2_device_unregister(&bcap_dev->v4l2_dev); | 961 | v4l2_device_unregister(&bcap_dev->v4l2_dev); |
970 | err_cleanup_ctx: | ||
971 | vb2_dma_contig_cleanup_ctx(bcap_dev->alloc_ctx); | ||
972 | err_free_ppi: | 962 | err_free_ppi: |
973 | ppi_delete_instance(bcap_dev->ppi); | 963 | ppi_delete_instance(bcap_dev->ppi); |
974 | err_free_dev: | 964 | err_free_dev: |
@@ -986,7 +976,6 @@ static int bcap_remove(struct platform_device *pdev) | |||
986 | video_unregister_device(&bcap_dev->video_dev); | 976 | video_unregister_device(&bcap_dev->video_dev); |
987 | v4l2_ctrl_handler_free(&bcap_dev->ctrl_handler); | 977 | v4l2_ctrl_handler_free(&bcap_dev->ctrl_handler); |
988 | v4l2_device_unregister(v4l2_dev); | 978 | v4l2_device_unregister(v4l2_dev); |
989 | vb2_dma_contig_cleanup_ctx(bcap_dev->alloc_ctx); | ||
990 | ppi_delete_instance(bcap_dev->ppi); | 979 | ppi_delete_instance(bcap_dev->ppi); |
991 | kfree(bcap_dev); | 980 | kfree(bcap_dev); |
992 | return 0; | 981 | return 0; |
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index 133ab9f70f85..3d57c352cefa 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c | |||
@@ -1151,9 +1151,6 @@ static int coda_queue_setup(struct vb2_queue *vq, | |||
1151 | *nplanes = 1; | 1151 | *nplanes = 1; |
1152 | sizes[0] = size; | 1152 | sizes[0] = size; |
1153 | 1153 | ||
1154 | /* Set to vb2-dma-contig allocator context, ignored by vb2-vmalloc */ | ||
1155 | alloc_ctxs[0] = ctx->dev->alloc_ctx; | ||
1156 | |||
1157 | v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, | 1154 | v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, |
1158 | "get %d buffer(s) of size %d each.\n", *nbuffers, size); | 1155 | "get %d buffer(s) of size %d each.\n", *nbuffers, size); |
1159 | 1156 | ||
@@ -1599,6 +1596,7 @@ static int coda_queue_init(struct coda_ctx *ctx, struct vb2_queue *vq) | |||
1599 | * that videobuf2 will keep the value of bytesused intact. | 1596 | * that videobuf2 will keep the value of bytesused intact. |
1600 | */ | 1597 | */ |
1601 | vq->allow_zero_bytesused = 1; | 1598 | vq->allow_zero_bytesused = 1; |
1599 | vq->dev = &ctx->dev->plat_dev->dev; | ||
1602 | 1600 | ||
1603 | return vb2_queue_init(vq); | 1601 | return vb2_queue_init(vq); |
1604 | } | 1602 | } |
@@ -2040,16 +2038,10 @@ static void coda_fw_callback(const struct firmware *fw, void *context) | |||
2040 | if (ret < 0) | 2038 | if (ret < 0) |
2041 | goto put_pm; | 2039 | goto put_pm; |
2042 | 2040 | ||
2043 | dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); | ||
2044 | if (IS_ERR(dev->alloc_ctx)) { | ||
2045 | v4l2_err(&dev->v4l2_dev, "Failed to alloc vb2 context\n"); | ||
2046 | goto put_pm; | ||
2047 | } | ||
2048 | |||
2049 | dev->m2m_dev = v4l2_m2m_init(&coda_m2m_ops); | 2041 | dev->m2m_dev = v4l2_m2m_init(&coda_m2m_ops); |
2050 | if (IS_ERR(dev->m2m_dev)) { | 2042 | if (IS_ERR(dev->m2m_dev)) { |
2051 | v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n"); | 2043 | v4l2_err(&dev->v4l2_dev, "Failed to init mem2mem device\n"); |
2052 | goto rel_ctx; | 2044 | goto put_pm; |
2053 | } | 2045 | } |
2054 | 2046 | ||
2055 | for (i = 0; i < dev->devtype->num_vdevs; i++) { | 2047 | for (i = 0; i < dev->devtype->num_vdevs; i++) { |
@@ -2072,8 +2064,6 @@ rel_vfd: | |||
2072 | while (--i >= 0) | 2064 | while (--i >= 0) |
2073 | video_unregister_device(&dev->vfd[i]); | 2065 | video_unregister_device(&dev->vfd[i]); |
2074 | v4l2_m2m_release(dev->m2m_dev); | 2066 | v4l2_m2m_release(dev->m2m_dev); |
2075 | rel_ctx: | ||
2076 | vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); | ||
2077 | put_pm: | 2067 | put_pm: |
2078 | pm_runtime_put_sync(&pdev->dev); | 2068 | pm_runtime_put_sync(&pdev->dev); |
2079 | } | 2069 | } |
@@ -2324,8 +2314,6 @@ static int coda_remove(struct platform_device *pdev) | |||
2324 | if (dev->m2m_dev) | 2314 | if (dev->m2m_dev) |
2325 | v4l2_m2m_release(dev->m2m_dev); | 2315 | v4l2_m2m_release(dev->m2m_dev); |
2326 | pm_runtime_disable(&pdev->dev); | 2316 | pm_runtime_disable(&pdev->dev); |
2327 | if (dev->alloc_ctx) | ||
2328 | vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); | ||
2329 | v4l2_device_unregister(&dev->v4l2_dev); | 2317 | v4l2_device_unregister(&dev->v4l2_dev); |
2330 | destroy_workqueue(dev->workqueue); | 2318 | destroy_workqueue(dev->workqueue); |
2331 | if (dev->iram.vaddr) | 2319 | if (dev->iram.vaddr) |
diff --git a/drivers/media/platform/coda/coda.h b/drivers/media/platform/coda/coda.h index 8f2c71e06966..53f96661683c 100644 --- a/drivers/media/platform/coda/coda.h +++ b/drivers/media/platform/coda/coda.h | |||
@@ -92,7 +92,6 @@ struct coda_dev { | |||
92 | struct mutex coda_mutex; | 92 | struct mutex coda_mutex; |
93 | struct workqueue_struct *workqueue; | 93 | struct workqueue_struct *workqueue; |
94 | struct v4l2_m2m_dev *m2m_dev; | 94 | struct v4l2_m2m_dev *m2m_dev; |
95 | struct vb2_alloc_ctx *alloc_ctx; | ||
96 | struct list_head instances; | 95 | struct list_head instances; |
97 | unsigned long instance_mask; | 96 | unsigned long instance_mask; |
98 | struct dentry *debugfs_root; | 97 | struct dentry *debugfs_root; |
diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index 0abcdfe97a6c..2a4c2914d077 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c | |||
@@ -242,7 +242,6 @@ vpbe_buffer_queue_setup(struct vb2_queue *vq, | |||
242 | /* Store number of buffers allocated in numbuffer member */ | 242 | /* Store number of buffers allocated in numbuffer member */ |
243 | if (vq->num_buffers + *nbuffers < VPBE_DEFAULT_NUM_BUFS) | 243 | if (vq->num_buffers + *nbuffers < VPBE_DEFAULT_NUM_BUFS) |
244 | *nbuffers = VPBE_DEFAULT_NUM_BUFS - vq->num_buffers; | 244 | *nbuffers = VPBE_DEFAULT_NUM_BUFS - vq->num_buffers; |
245 | alloc_ctxs[0] = layer->alloc_ctx; | ||
246 | 245 | ||
247 | if (*nplanes) | 246 | if (*nplanes) |
248 | return sizes[0] < layer->pix_fmt.sizeimage ? -EINVAL : 0; | 247 | return sizes[0] < layer->pix_fmt.sizeimage ? -EINVAL : 0; |
@@ -1451,20 +1450,13 @@ static int vpbe_display_probe(struct platform_device *pdev) | |||
1451 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1450 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
1452 | q->min_buffers_needed = 1; | 1451 | q->min_buffers_needed = 1; |
1453 | q->lock = &disp_dev->dev[i]->opslock; | 1452 | q->lock = &disp_dev->dev[i]->opslock; |
1453 | q->dev = disp_dev->vpbe_dev->pdev; | ||
1454 | err = vb2_queue_init(q); | 1454 | err = vb2_queue_init(q); |
1455 | if (err) { | 1455 | if (err) { |
1456 | v4l2_err(v4l2_dev, "vb2_queue_init() failed\n"); | 1456 | v4l2_err(v4l2_dev, "vb2_queue_init() failed\n"); |
1457 | goto probe_out; | 1457 | goto probe_out; |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | disp_dev->dev[i]->alloc_ctx = | ||
1461 | vb2_dma_contig_init_ctx(disp_dev->vpbe_dev->pdev); | ||
1462 | if (IS_ERR(disp_dev->dev[i]->alloc_ctx)) { | ||
1463 | v4l2_err(v4l2_dev, "Failed to get the context\n"); | ||
1464 | err = PTR_ERR(disp_dev->dev[i]->alloc_ctx); | ||
1465 | goto probe_out; | ||
1466 | } | ||
1467 | |||
1468 | INIT_LIST_HEAD(&disp_dev->dev[i]->dma_queue); | 1460 | INIT_LIST_HEAD(&disp_dev->dev[i]->dma_queue); |
1469 | 1461 | ||
1470 | if (register_device(disp_dev->dev[i], disp_dev, pdev)) { | 1462 | if (register_device(disp_dev->dev[i], disp_dev, pdev)) { |
@@ -1482,7 +1474,6 @@ probe_out: | |||
1482 | for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) { | 1474 | for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) { |
1483 | /* Unregister video device */ | 1475 | /* Unregister video device */ |
1484 | if (disp_dev->dev[k] != NULL) { | 1476 | if (disp_dev->dev[k] != NULL) { |
1485 | vb2_dma_contig_cleanup_ctx(disp_dev->dev[k]->alloc_ctx); | ||
1486 | video_unregister_device(&disp_dev->dev[k]->video_dev); | 1477 | video_unregister_device(&disp_dev->dev[k]->video_dev); |
1487 | kfree(disp_dev->dev[k]); | 1478 | kfree(disp_dev->dev[k]); |
1488 | } | 1479 | } |
@@ -1510,7 +1501,6 @@ static int vpbe_display_remove(struct platform_device *pdev) | |||
1510 | for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { | 1501 | for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) { |
1511 | /* Get the pointer to the layer object */ | 1502 | /* Get the pointer to the layer object */ |
1512 | vpbe_display_layer = disp_dev->dev[i]; | 1503 | vpbe_display_layer = disp_dev->dev[i]; |
1513 | vb2_dma_contig_cleanup_ctx(vpbe_display_layer->alloc_ctx); | ||
1514 | /* Unregister video device */ | 1504 | /* Unregister video device */ |
1515 | video_unregister_device(&vpbe_display_layer->video_dev); | 1505 | video_unregister_device(&vpbe_display_layer->video_dev); |
1516 | 1506 | ||
diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 08f7028c7560..d5afab0dd9e5 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c | |||
@@ -133,7 +133,6 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq, | |||
133 | 133 | ||
134 | *nplanes = 1; | 134 | *nplanes = 1; |
135 | sizes[0] = size; | 135 | sizes[0] = size; |
136 | alloc_ctxs[0] = common->alloc_ctx; | ||
137 | 136 | ||
138 | /* Calculate the offset for Y and C data in the buffer */ | 137 | /* Calculate the offset for Y and C data in the buffer */ |
139 | vpif_calculate_offsets(ch); | 138 | vpif_calculate_offsets(ch); |
@@ -1371,6 +1370,7 @@ static int vpif_probe_complete(void) | |||
1371 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1370 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
1372 | q->min_buffers_needed = 1; | 1371 | q->min_buffers_needed = 1; |
1373 | q->lock = &common->lock; | 1372 | q->lock = &common->lock; |
1373 | q->dev = vpif_dev; | ||
1374 | 1374 | ||
1375 | err = vb2_queue_init(q); | 1375 | err = vb2_queue_init(q); |
1376 | if (err) { | 1376 | if (err) { |
@@ -1378,13 +1378,6 @@ static int vpif_probe_complete(void) | |||
1378 | goto probe_out; | 1378 | goto probe_out; |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); | ||
1382 | if (IS_ERR(common->alloc_ctx)) { | ||
1383 | vpif_err("Failed to get the context\n"); | ||
1384 | err = PTR_ERR(common->alloc_ctx); | ||
1385 | goto probe_out; | ||
1386 | } | ||
1387 | |||
1388 | INIT_LIST_HEAD(&common->dma_queue); | 1381 | INIT_LIST_HEAD(&common->dma_queue); |
1389 | 1382 | ||
1390 | /* Initialize the video_device structure */ | 1383 | /* Initialize the video_device structure */ |
@@ -1412,7 +1405,6 @@ probe_out: | |||
1412 | /* Get the pointer to the channel object */ | 1405 | /* Get the pointer to the channel object */ |
1413 | ch = vpif_obj.dev[k]; | 1406 | ch = vpif_obj.dev[k]; |
1414 | common = &ch->common[k]; | 1407 | common = &ch->common[k]; |
1415 | vb2_dma_contig_cleanup_ctx(common->alloc_ctx); | ||
1416 | /* Unregister video device */ | 1408 | /* Unregister video device */ |
1417 | video_unregister_device(&ch->video_dev); | 1409 | video_unregister_device(&ch->video_dev); |
1418 | } | 1410 | } |
@@ -1546,7 +1538,6 @@ static int vpif_remove(struct platform_device *device) | |||
1546 | /* Get the pointer to the channel object */ | 1538 | /* Get the pointer to the channel object */ |
1547 | ch = vpif_obj.dev[i]; | 1539 | ch = vpif_obj.dev[i]; |
1548 | common = &ch->common[VPIF_VIDEO_INDEX]; | 1540 | common = &ch->common[VPIF_VIDEO_INDEX]; |
1549 | vb2_dma_contig_cleanup_ctx(common->alloc_ctx); | ||
1550 | /* Unregister video device */ | 1541 | /* Unregister video device */ |
1551 | video_unregister_device(&ch->video_dev); | 1542 | video_unregister_device(&ch->video_dev); |
1552 | kfree(vpif_obj.dev[i]); | 1543 | kfree(vpif_obj.dev[i]); |
diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h index 4a7600929b61..9e35b6771d22 100644 --- a/drivers/media/platform/davinci/vpif_capture.h +++ b/drivers/media/platform/davinci/vpif_capture.h | |||
@@ -65,8 +65,6 @@ struct common_obj { | |||
65 | struct v4l2_format fmt; | 65 | struct v4l2_format fmt; |
66 | /* Buffer queue used in video-buf */ | 66 | /* Buffer queue used in video-buf */ |
67 | struct vb2_queue buffer_queue; | 67 | struct vb2_queue buffer_queue; |
68 | /* allocator-specific contexts for each plane */ | ||
69 | struct vb2_alloc_ctx *alloc_ctx; | ||
70 | /* Queue of filled frames */ | 68 | /* Queue of filled frames */ |
71 | struct list_head dma_queue; | 69 | struct list_head dma_queue; |
72 | /* Used in video-buf */ | 70 | /* Used in video-buf */ |
diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index f40755cf1bf2..5d77884b120a 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c | |||
@@ -126,7 +126,6 @@ static int vpif_buffer_queue_setup(struct vb2_queue *vq, | |||
126 | 126 | ||
127 | *nplanes = 1; | 127 | *nplanes = 1; |
128 | sizes[0] = size; | 128 | sizes[0] = size; |
129 | alloc_ctxs[0] = common->alloc_ctx; | ||
130 | 129 | ||
131 | /* Calculate the offset for Y and C data in the buffer */ | 130 | /* Calculate the offset for Y and C data in the buffer */ |
132 | vpif_calculate_offsets(ch); | 131 | vpif_calculate_offsets(ch); |
@@ -1191,19 +1190,13 @@ static int vpif_probe_complete(void) | |||
1191 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1190 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
1192 | q->min_buffers_needed = 1; | 1191 | q->min_buffers_needed = 1; |
1193 | q->lock = &common->lock; | 1192 | q->lock = &common->lock; |
1193 | q->dev = vpif_dev; | ||
1194 | err = vb2_queue_init(q); | 1194 | err = vb2_queue_init(q); |
1195 | if (err) { | 1195 | if (err) { |
1196 | vpif_err("vpif_display: vb2_queue_init() failed\n"); | 1196 | vpif_err("vpif_display: vb2_queue_init() failed\n"); |
1197 | goto probe_out; | 1197 | goto probe_out; |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | common->alloc_ctx = vb2_dma_contig_init_ctx(vpif_dev); | ||
1201 | if (IS_ERR(common->alloc_ctx)) { | ||
1202 | vpif_err("Failed to get the context\n"); | ||
1203 | err = PTR_ERR(common->alloc_ctx); | ||
1204 | goto probe_out; | ||
1205 | } | ||
1206 | |||
1207 | INIT_LIST_HEAD(&common->dma_queue); | 1200 | INIT_LIST_HEAD(&common->dma_queue); |
1208 | 1201 | ||
1209 | /* register video device */ | 1202 | /* register video device */ |
@@ -1233,7 +1226,6 @@ probe_out: | |||
1233 | for (k = 0; k < j; k++) { | 1226 | for (k = 0; k < j; k++) { |
1234 | ch = vpif_obj.dev[k]; | 1227 | ch = vpif_obj.dev[k]; |
1235 | common = &ch->common[k]; | 1228 | common = &ch->common[k]; |
1236 | vb2_dma_contig_cleanup_ctx(common->alloc_ctx); | ||
1237 | video_unregister_device(&ch->video_dev); | 1229 | video_unregister_device(&ch->video_dev); |
1238 | } | 1230 | } |
1239 | return err; | 1231 | return err; |
@@ -1355,7 +1347,6 @@ static int vpif_remove(struct platform_device *device) | |||
1355 | /* Get the pointer to the channel object */ | 1347 | /* Get the pointer to the channel object */ |
1356 | ch = vpif_obj.dev[i]; | 1348 | ch = vpif_obj.dev[i]; |
1357 | common = &ch->common[VPIF_VIDEO_INDEX]; | 1349 | common = &ch->common[VPIF_VIDEO_INDEX]; |
1358 | vb2_dma_contig_cleanup_ctx(common->alloc_ctx); | ||
1359 | /* Unregister video device */ | 1350 | /* Unregister video device */ |
1360 | video_unregister_device(&ch->video_dev); | 1351 | video_unregister_device(&ch->video_dev); |
1361 | kfree(vpif_obj.dev[i]); | 1352 | kfree(vpif_obj.dev[i]); |
diff --git a/drivers/media/platform/davinci/vpif_display.h b/drivers/media/platform/davinci/vpif_display.h index e7a1723a1b7a..af2765fdcea8 100644 --- a/drivers/media/platform/davinci/vpif_display.h +++ b/drivers/media/platform/davinci/vpif_display.h | |||
@@ -74,8 +74,6 @@ struct common_obj { | |||
74 | struct v4l2_format fmt; /* Used to store the format */ | 74 | struct v4l2_format fmt; /* Used to store the format */ |
75 | struct vb2_queue buffer_queue; /* Buffer queue used in | 75 | struct vb2_queue buffer_queue; /* Buffer queue used in |
76 | * video-buf */ | 76 | * video-buf */ |
77 | /* allocator-specific contexts for each plane */ | ||
78 | struct vb2_alloc_ctx *alloc_ctx; | ||
79 | 77 | ||
80 | struct list_head dma_queue; /* Queue of filled frames */ | 78 | struct list_head dma_queue; /* Queue of filled frames */ |
81 | spinlock_t irqlock; /* Used in video-buf */ | 79 | spinlock_t irqlock; /* Used in video-buf */ |
diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index dad3b031f778..4c5c529aafa7 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c | |||
@@ -979,7 +979,6 @@ static int rvin_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, | |||
979 | { | 979 | { |
980 | struct rvin_dev *vin = vb2_get_drv_priv(vq); | 980 | struct rvin_dev *vin = vb2_get_drv_priv(vq); |
981 | 981 | ||
982 | alloc_ctxs[0] = vin->alloc_ctx; | ||
983 | /* Make sure the image size is large enough. */ | 982 | /* Make sure the image size is large enough. */ |
984 | if (*nplanes) | 983 | if (*nplanes) |
985 | return sizes[0] < vin->format.sizeimage ? -EINVAL : 0; | 984 | return sizes[0] < vin->format.sizeimage ? -EINVAL : 0; |
@@ -1129,9 +1128,6 @@ static struct vb2_ops rvin_qops = { | |||
1129 | 1128 | ||
1130 | void rvin_dma_remove(struct rvin_dev *vin) | 1129 | void rvin_dma_remove(struct rvin_dev *vin) |
1131 | { | 1130 | { |
1132 | if (!IS_ERR_OR_NULL(vin->alloc_ctx)) | ||
1133 | vb2_dma_contig_cleanup_ctx(vin->alloc_ctx); | ||
1134 | |||
1135 | mutex_destroy(&vin->lock); | 1131 | mutex_destroy(&vin->lock); |
1136 | 1132 | ||
1137 | v4l2_device_unregister(&vin->v4l2_dev); | 1133 | v4l2_device_unregister(&vin->v4l2_dev); |
@@ -1158,12 +1154,6 @@ int rvin_dma_probe(struct rvin_dev *vin, int irq) | |||
1158 | vin->queue_buf[i] = NULL; | 1154 | vin->queue_buf[i] = NULL; |
1159 | 1155 | ||
1160 | /* buffer queue */ | 1156 | /* buffer queue */ |
1161 | vin->alloc_ctx = vb2_dma_contig_init_ctx(vin->dev); | ||
1162 | if (IS_ERR(vin->alloc_ctx)) { | ||
1163 | ret = PTR_ERR(vin->alloc_ctx); | ||
1164 | goto error; | ||
1165 | } | ||
1166 | |||
1167 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1157 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1168 | q->io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF; | 1158 | q->io_modes = VB2_MMAP | VB2_READ | VB2_DMABUF; |
1169 | q->lock = &vin->lock; | 1159 | q->lock = &vin->lock; |
@@ -1173,6 +1163,7 @@ int rvin_dma_probe(struct rvin_dev *vin, int irq) | |||
1173 | q->mem_ops = &vb2_dma_contig_memops; | 1163 | q->mem_ops = &vb2_dma_contig_memops; |
1174 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1164 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
1175 | q->min_buffers_needed = 2; | 1165 | q->min_buffers_needed = 2; |
1166 | q->dev = vin->dev; | ||
1176 | 1167 | ||
1177 | ret = vb2_queue_init(q); | 1168 | ret = vb2_queue_init(q); |
1178 | if (ret < 0) { | 1169 | if (ret < 0) { |
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index a6dd6db246ab..31ad39a39937 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h | |||
@@ -94,7 +94,6 @@ struct rvin_graph_entity { | |||
94 | * | 94 | * |
95 | * @lock: protects @queue | 95 | * @lock: protects @queue |
96 | * @queue: vb2 buffers queue | 96 | * @queue: vb2 buffers queue |
97 | * @alloc_ctx: allocation context for the vb2 @queue | ||
98 | * | 97 | * |
99 | * @qlock: protects @queue_buf, @buf_list, @continuous, @sequence | 98 | * @qlock: protects @queue_buf, @buf_list, @continuous, @sequence |
100 | * @state | 99 | * @state |
@@ -125,7 +124,6 @@ struct rvin_dev { | |||
125 | 124 | ||
126 | struct mutex lock; | 125 | struct mutex lock; |
127 | struct vb2_queue queue; | 126 | struct vb2_queue queue; |
128 | struct vb2_alloc_ctx *alloc_ctx; | ||
129 | 127 | ||
130 | spinlock_t qlock; | 128 | spinlock_t qlock; |
131 | struct vb2_v4l2_buffer *queue_buf[HW_BUFFER_NUM]; | 129 | struct vb2_v4l2_buffer *queue_buf[HW_BUFFER_NUM]; |
diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h index e14a9370b67e..12783fd823f8 100644 --- a/include/media/davinci/vpbe_display.h +++ b/include/media/davinci/vpbe_display.h | |||
@@ -81,8 +81,6 @@ struct vpbe_layer { | |||
81 | * Buffer queue used in video-buf | 81 | * Buffer queue used in video-buf |
82 | */ | 82 | */ |
83 | struct vb2_queue buffer_queue; | 83 | struct vb2_queue buffer_queue; |
84 | /* allocator-specific contexts for each plane */ | ||
85 | struct vb2_alloc_ctx *alloc_ctx; | ||
86 | /* Queue of filled frames */ | 84 | /* Queue of filled frames */ |
87 | struct list_head dma_queue; | 85 | struct list_head dma_queue; |
88 | /* Used in video-buf */ | 86 | /* Used in video-buf */ |