Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[sfrench/cifs-2.6.git] / drivers / media / platform / coda / coda-common.c
index 73222c0615c0c1023b33f6837ed88835636c5ddb..94fb4d2ecc439fc51bdf5dbf53abf6a8f4baa551 100644 (file)
@@ -933,7 +933,8 @@ static int coda_g_selection(struct file *file, void *fh,
                rsel = &r;
                /* fallthrough */
        case V4L2_SEL_TGT_CROP:
-               if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
+               if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
+                   ctx->inst_type == CODA_INST_DECODER)
                        return -EINVAL;
                break;
        case V4L2_SEL_TGT_COMPOSE_BOUNDS:
@@ -942,7 +943,8 @@ static int coda_g_selection(struct file *file, void *fh,
                /* fallthrough */
        case V4L2_SEL_TGT_COMPOSE:
        case V4L2_SEL_TGT_COMPOSE_DEFAULT:
-               if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+               if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE ||
+                   ctx->inst_type == CODA_INST_ENCODER)
                        return -EINVAL;
                break;
        default:
@@ -1084,16 +1086,16 @@ static int coda_decoder_cmd(struct file *file, void *fh,
 
        switch (dc->cmd) {
        case V4L2_DEC_CMD_START:
-               mutex_lock(&ctx->bitstream_mutex);
                mutex_lock(&dev->coda_mutex);
+               mutex_lock(&ctx->bitstream_mutex);
                coda_bitstream_flush(ctx);
-               mutex_unlock(&dev->coda_mutex);
                dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
                                         V4L2_BUF_TYPE_VIDEO_CAPTURE);
                vb2_clear_last_buffer_dequeued(dst_vq);
                ctx->bit_stream_param &= ~CODA_BIT_STREAM_END_FLAG;
                coda_fill_bitstream(ctx, NULL);
                mutex_unlock(&ctx->bitstream_mutex);
+               mutex_unlock(&dev->coda_mutex);
                break;
        case V4L2_DEC_CMD_STOP:
                stream_end = false;
@@ -2387,6 +2389,7 @@ int coda_decoder_queue_init(void *priv, struct vb2_queue *src_vq,
 
        dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        dst_vq->io_modes = VB2_DMABUF | VB2_MMAP;
+       dst_vq->dma_attrs = DMA_ATTR_NO_KERNEL_MAPPING;
        dst_vq->mem_ops = &vb2_dma_contig_memops;
 
        return coda_queue_init(priv, dst_vq);
@@ -2959,8 +2962,6 @@ static int coda_probe(struct platform_device *pdev)
        else
                return -EINVAL;
 
-       spin_lock_init(&dev->irqlock);
-
        dev->dev = &pdev->dev;
        dev->clk_per = devm_clk_get(&pdev->dev, "per");
        if (IS_ERR(dev->clk_per)) {