|
@@ -1076,6 +1076,17 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|
|
unsigned long flags;
|
|
|
int ret;
|
|
|
|
|
|
+ /* Allocate scratch buffer. */
|
|
|
+ vin->scratch = dma_alloc_coherent(vin->dev, vin->format.sizeimage,
|
|
|
+ &vin->scratch_phys, GFP_KERNEL);
|
|
|
+ if (!vin->scratch) {
|
|
|
+ spin_lock_irqsave(&vin->qlock, flags);
|
|
|
+ return_all_buffers(vin, VB2_BUF_STATE_QUEUED);
|
|
|
+ spin_unlock_irqrestore(&vin->qlock, flags);
|
|
|
+ vin_err(vin, "Failed to allocate scratch buffer\n");
|
|
|
+ return -ENOMEM;
|
|
|
+ }
|
|
|
+
|
|
|
sd = vin_to_source(vin);
|
|
|
v4l2_subdev_call(sd, video, s_stream, 1);
|
|
|
|
|
@@ -1091,6 +1102,10 @@ static int rvin_start_streaming(struct vb2_queue *vq, unsigned int count)
|
|
|
|
|
|
spin_unlock_irqrestore(&vin->qlock, flags);
|
|
|
|
|
|
+ if (ret)
|
|
|
+ dma_free_coherent(vin->dev, vin->format.sizeimage, vin->scratch,
|
|
|
+ vin->scratch_phys);
|
|
|
+
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
@@ -1141,6 +1156,10 @@ static void rvin_stop_streaming(struct vb2_queue *vq)
|
|
|
|
|
|
/* disable interrupts */
|
|
|
rvin_disable_interrupts(vin);
|
|
|
+
|
|
|
+ /* Free scratch buffer. */
|
|
|
+ dma_free_coherent(vin->dev, vin->format.sizeimage, vin->scratch,
|
|
|
+ vin->scratch_phys);
|
|
|
}
|
|
|
|
|
|
static const struct vb2_ops rvin_qops = {
|