diff options
Diffstat (limited to 'drivers/media/video/mx3_camera.c')
-rw-r--r-- | drivers/media/video/mx3_camera.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index f13643d31353..af2297dd49c8 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -61,15 +61,9 @@ | |||
61 | 61 | ||
62 | #define MAX_VIDEO_MEM 16 | 62 | #define MAX_VIDEO_MEM 16 |
63 | 63 | ||
64 | enum csi_buffer_state { | ||
65 | CSI_BUF_NEEDS_INIT, | ||
66 | CSI_BUF_PREPARED, | ||
67 | }; | ||
68 | |||
69 | struct mx3_camera_buffer { | 64 | struct mx3_camera_buffer { |
70 | /* common v4l buffer stuff -- must be first */ | 65 | /* common v4l buffer stuff -- must be first */ |
71 | struct vb2_buffer vb; | 66 | struct vb2_buffer vb; |
72 | enum csi_buffer_state state; | ||
73 | struct list_head queue; | 67 | struct list_head queue; |
74 | 68 | ||
75 | /* One descriptot per scatterlist (per frame) */ | 69 | /* One descriptot per scatterlist (per frame) */ |
@@ -285,7 +279,7 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) | |||
285 | goto error; | 279 | goto error; |
286 | } | 280 | } |
287 | 281 | ||
288 | if (buf->state == CSI_BUF_NEEDS_INIT) { | 282 | if (!buf->txd) { |
289 | sg_dma_address(sg) = vb2_dma_contig_plane_dma_addr(vb, 0); | 283 | sg_dma_address(sg) = vb2_dma_contig_plane_dma_addr(vb, 0); |
290 | sg_dma_len(sg) = new_size; | 284 | sg_dma_len(sg) = new_size; |
291 | 285 | ||
@@ -298,7 +292,6 @@ static void mx3_videobuf_queue(struct vb2_buffer *vb) | |||
298 | txd->callback_param = txd; | 292 | txd->callback_param = txd; |
299 | txd->callback = mx3_cam_dma_done; | 293 | txd->callback = mx3_cam_dma_done; |
300 | 294 | ||
301 | buf->state = CSI_BUF_PREPARED; | ||
302 | buf->txd = txd; | 295 | buf->txd = txd; |
303 | } else { | 296 | } else { |
304 | txd = buf->txd; | 297 | txd = buf->txd; |
@@ -385,7 +378,6 @@ static void mx3_videobuf_release(struct vb2_buffer *vb) | |||
385 | 378 | ||
386 | /* Doesn't hurt also if the list is empty */ | 379 | /* Doesn't hurt also if the list is empty */ |
387 | list_del_init(&buf->queue); | 380 | list_del_init(&buf->queue); |
388 | buf->state = CSI_BUF_NEEDS_INIT; | ||
389 | 381 | ||
390 | if (txd) { | 382 | if (txd) { |
391 | buf->txd = NULL; | 383 | buf->txd = NULL; |
@@ -405,13 +397,13 @@ static int mx3_videobuf_init(struct vb2_buffer *vb) | |||
405 | struct mx3_camera_dev *mx3_cam = ici->priv; | 397 | struct mx3_camera_dev *mx3_cam = ici->priv; |
406 | struct mx3_camera_buffer *buf = to_mx3_vb(vb); | 398 | struct mx3_camera_buffer *buf = to_mx3_vb(vb); |
407 | 399 | ||
408 | /* This is for locking debugging only */ | 400 | if (!buf->txd) { |
409 | INIT_LIST_HEAD(&buf->queue); | 401 | /* This is for locking debugging only */ |
410 | sg_init_table(&buf->sg, 1); | 402 | INIT_LIST_HEAD(&buf->queue); |
403 | sg_init_table(&buf->sg, 1); | ||
411 | 404 | ||
412 | buf->state = CSI_BUF_NEEDS_INIT; | 405 | mx3_cam->buf_total += vb2_plane_size(vb, 0); |
413 | 406 | } | |
414 | mx3_cam->buf_total += vb2_plane_size(vb, 0); | ||
415 | 407 | ||
416 | return 0; | 408 | return 0; |
417 | } | 409 | } |