From d0b2f91bede3bd5e3d24dd6803e56eee959c1797 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Thu, 20 Oct 2016 00:10:27 -0300 Subject: Linux-libre 4.8.2-gnu --- drivers/media/platform/ti-vpe/cal.c | 17 ++--------------- drivers/media/platform/ti-vpe/vpe.c | 22 +++++----------------- 2 files changed, 7 insertions(+), 32 deletions(-) (limited to 'drivers/media/platform/ti-vpe') diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index 82001e6b5..e967fcfdc 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -287,7 +287,6 @@ struct cal_ctx { /* Several counters */ unsigned long jiffies; - struct vb2_alloc_ctx *alloc_ctx; struct cal_dmaqueue vidq; /* Input Number */ @@ -1226,14 +1225,13 @@ static int cal_enum_frameintervals(struct file *file, void *priv, */ static int cal_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, unsigned int *nplanes, - unsigned int sizes[], void *alloc_ctxs[]) + unsigned int sizes[], struct device *alloc_devs[]) { struct cal_ctx *ctx = vb2_get_drv_priv(vq); unsigned size = ctx->v_fmt.fmt.pix.sizeimage; if (vq->num_buffers + *nbuffers < 3) *nbuffers = 3 - vq->num_buffers; - alloc_ctxs[0] = ctx->alloc_ctx; if (*nplanes) { if (sizes[0] < size) @@ -1551,6 +1549,7 @@ static int cal_complete_ctx(struct cal_ctx *ctx) q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->lock = &ctx->mutex; q->min_buffers_needed = 3; + q->dev = ctx->v4l2_dev.dev; ret = vb2_queue_init(q); if (ret) @@ -1578,18 +1577,7 @@ static int cal_complete_ctx(struct cal_ctx *ctx) v4l2_info(&ctx->v4l2_dev, "V4L2 device registered as %s\n", video_device_node_name(vfd)); - ctx->alloc_ctx = vb2_dma_contig_init_ctx(vfd->v4l2_dev->dev); - if (IS_ERR(ctx->alloc_ctx)) { - ctx_err(ctx, "Failed to alloc vb2 context\n"); - ret = PTR_ERR(ctx->alloc_ctx); - goto vdev_unreg; - } - return 0; - -vdev_unreg: - video_unregister_device(vfd); - return ret; } static struct device_node * @@ -1914,7 +1902,6 @@ static int cal_remove(struct platform_device *pdev) video_device_node_name(&ctx->vdev)); camerarx_phy_disable(ctx); v4l2_async_notifier_unregister(&ctx->notifier); - vb2_dma_contig_cleanup_ctx(ctx->alloc_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_handler); v4l2_device_unregister(&ctx->v4l2_dev); video_unregister_device(&ctx->vdev); diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index 1fa00c2cf..55a1458ac 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -362,7 +362,6 @@ struct vpe_dev { void __iomem *base; struct resource *res; - struct vb2_alloc_ctx *alloc_ctx; struct vpdma_data *vpdma; /* vpdma data handle */ struct sc_data *sc; /* scaler data handle */ struct csc_data *csc; /* csc data handle */ @@ -1797,7 +1796,7 @@ static const struct v4l2_ioctl_ops vpe_ioctl_ops = { */ static int vpe_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, unsigned int *nplanes, - unsigned int sizes[], void *alloc_ctxs[]) + unsigned int sizes[], struct device *alloc_devs[]) { int i; struct vpe_ctx *ctx = vb2_get_drv_priv(vq); @@ -1807,10 +1806,8 @@ static int vpe_queue_setup(struct vb2_queue *vq, *nplanes = q_data->fmt->coplanar ? 2 : 1; - for (i = 0; i < *nplanes; i++) { + for (i = 0; i < *nplanes; i++) sizes[i] = q_data->sizeimage[i]; - alloc_ctxs[i] = ctx->dev->alloc_ctx; - } vpe_dbg(ctx->dev, "get %d buffer(s) of size %d", *nbuffers, sizes[VPE_LUMA]); @@ -1907,6 +1904,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, src_vq->mem_ops = &vb2_dma_contig_memops; src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; src_vq->lock = &dev->dev_mutex; + src_vq->dev = dev->v4l2_dev.dev; ret = vb2_queue_init(src_vq); if (ret) @@ -1921,6 +1919,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, dst_vq->mem_ops = &vb2_dma_contig_memops; dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; dst_vq->lock = &dev->dev_mutex; + dst_vq->dev = dev->v4l2_dev.dev; return vb2_queue_init(dst_vq); } @@ -2161,7 +2160,6 @@ static void vpe_fw_cb(struct platform_device *pdev) vpe_runtime_put(pdev); pm_runtime_disable(&pdev->dev); v4l2_m2m_release(dev->m2m_dev); - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); v4l2_device_unregister(&dev->v4l2_dev); return; @@ -2213,18 +2211,11 @@ static int vpe_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dev); - dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); - if (IS_ERR(dev->alloc_ctx)) { - vpe_err(dev, "Failed to alloc vb2 context\n"); - ret = PTR_ERR(dev->alloc_ctx); - goto v4l2_dev_unreg; - } - dev->m2m_dev = v4l2_m2m_init(&m2m_ops); if (IS_ERR(dev->m2m_dev)) { vpe_err(dev, "Failed to init mem2mem device\n"); ret = PTR_ERR(dev->m2m_dev); - goto rel_ctx; + goto v4l2_dev_unreg; } pm_runtime_enable(&pdev->dev); @@ -2269,8 +2260,6 @@ runtime_put: rel_m2m: pm_runtime_disable(&pdev->dev); v4l2_m2m_release(dev->m2m_dev); -rel_ctx: - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); v4l2_dev_unreg: v4l2_device_unregister(&dev->v4l2_dev); @@ -2286,7 +2275,6 @@ static int vpe_remove(struct platform_device *pdev) v4l2_m2m_release(dev->m2m_dev); video_unregister_device(&dev->vfd); v4l2_device_unregister(&dev->v4l2_dev); - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); vpe_set_clock_enable(dev, 0); vpe_runtime_put(pdev); -- cgit v1.2.3-54-g00ecf