aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/sh_vou.c
diff options
context:
space:
mode:
authorJunghak Sung <jh1009.sung@samsung.com>2015-09-22 09:30:30 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-10-01 08:04:43 -0400
commit2d7007153f0c9b1dd00c01894df7d26ddc32b79f (patch)
tree8320f9d22f45dd7dcea64088b50ff706bb0082b2 /drivers/media/platform/sh_vou.c
parentc139990e842d550db2f59bd4f5993bba90f140e0 (diff)
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer. Add new member variables - bytesused, length, offset, userptr, fd, data_offset - to struct vb2_plane in order to cover all information of v4l2_plane. struct vb2_plane { <snip> unsigned int bytesused; unsigned int length; union { unsigned int offset; unsigned long userptr; int fd; } m; unsigned int data_offset; } Replace v4l2_buf with new member variables - index, type, memory - which are common fields for buffer management. struct vb2_buffer { <snip> unsigned int index; unsigned int type; unsigned int memory; unsigned int num_planes; struct vb2_plane planes[VIDEO_MAX_PLANES]; <snip> }; v4l2 specific fields - flags, field, timestamp, timecode, sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c struct vb2_v4l2_buffer { struct vb2_buffer vb2_buf; __u32 flags; __u32 field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; }; Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/sh_vou.c')
-rw-r--r--drivers/media/platform/sh_vou.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c
index fe5c8ab06bd5..7967a75fde36 100644
--- a/drivers/media/platform/sh_vou.c
+++ b/drivers/media/platform/sh_vou.c
@@ -27,6 +27,7 @@
27#include <media/v4l2-device.h> 27#include <media/v4l2-device.h>
28#include <media/v4l2-ioctl.h> 28#include <media/v4l2-ioctl.h>
29#include <media/v4l2-mediabus.h> 29#include <media/v4l2-mediabus.h>
30#include <media/videobuf2-v4l2.h>
30#include <media/videobuf2-dma-contig.h> 31#include <media/videobuf2-dma-contig.h>
31 32
32/* Mirror addresses are not available for all registers */ 33/* Mirror addresses are not available for all registers */
@@ -62,11 +63,12 @@ enum sh_vou_status {
62#define VOU_MIN_IMAGE_HEIGHT 16 63#define VOU_MIN_IMAGE_HEIGHT 16
63 64
64struct sh_vou_buffer { 65struct sh_vou_buffer {
65 struct vb2_buffer vb; 66 struct vb2_v4l2_buffer vb;
66 struct list_head list; 67 struct list_head list;
67}; 68};
68 69
69static inline struct sh_vou_buffer *to_sh_vou_buffer(struct vb2_buffer *vb2) 70static inline struct
71sh_vou_buffer *to_sh_vou_buffer(struct vb2_v4l2_buffer *vb2)
70{ 72{
71 return container_of(vb2, struct sh_vou_buffer, vb); 73 return container_of(vb2, struct sh_vou_buffer, vb);
72} 74}
@@ -193,11 +195,11 @@ static struct sh_vou_fmt vou_fmt[] = {
193}; 195};
194 196
195static void sh_vou_schedule_next(struct sh_vou_device *vou_dev, 197static void sh_vou_schedule_next(struct sh_vou_device *vou_dev,
196 struct vb2_buffer *vb) 198 struct vb2_v4l2_buffer *vbuf)
197{ 199{
198 dma_addr_t addr1, addr2; 200 dma_addr_t addr1, addr2;
199 201
200 addr1 = vb2_dma_contig_plane_dma_addr(vb, 0); 202 addr1 = vb2_dma_contig_plane_dma_addr(&vbuf->vb2_buf, 0);
201 switch (vou_dev->pix.pixelformat) { 203 switch (vou_dev->pix.pixelformat) {
202 case V4L2_PIX_FMT_NV12: 204 case V4L2_PIX_FMT_NV12:
203 case V4L2_PIX_FMT_NV16: 205 case V4L2_PIX_FMT_NV16:
@@ -282,8 +284,9 @@ static int sh_vou_buf_prepare(struct vb2_buffer *vb)
282/* Locking: caller holds fop_lock mutex and vq->irqlock spinlock */ 284/* Locking: caller holds fop_lock mutex and vq->irqlock spinlock */
283static void sh_vou_buf_queue(struct vb2_buffer *vb) 285static void sh_vou_buf_queue(struct vb2_buffer *vb)
284{ 286{
287 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
285 struct sh_vou_device *vou_dev = vb2_get_drv_priv(vb->vb2_queue); 288 struct sh_vou_device *vou_dev = vb2_get_drv_priv(vb->vb2_queue);
286 struct sh_vou_buffer *shbuf = to_sh_vou_buffer(vb); 289 struct sh_vou_buffer *shbuf = to_sh_vou_buffer(vbuf);
287 unsigned long flags; 290 unsigned long flags;
288 291
289 spin_lock_irqsave(&vou_dev->lock, flags); 292 spin_lock_irqsave(&vou_dev->lock, flags);
@@ -302,7 +305,8 @@ static int sh_vou_start_streaming(struct vb2_queue *vq, unsigned int count)
302 video, s_stream, 1); 305 video, s_stream, 1);
303 if (ret < 0 && ret != -ENOIOCTLCMD) { 306 if (ret < 0 && ret != -ENOIOCTLCMD) {
304 list_for_each_entry_safe(buf, node, &vou_dev->buf_list, list) { 307 list_for_each_entry_safe(buf, node, &vou_dev->buf_list, list) {
305 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_QUEUED); 308 vb2_buffer_done(&buf->vb.vb2_buf,
309 VB2_BUF_STATE_QUEUED);
306 list_del(&buf->list); 310 list_del(&buf->list);
307 } 311 }
308 vou_dev->active = NULL; 312 vou_dev->active = NULL;
@@ -353,7 +357,7 @@ static void sh_vou_stop_streaming(struct vb2_queue *vq)
353 msleep(50); 357 msleep(50);
354 spin_lock_irqsave(&vou_dev->lock, flags); 358 spin_lock_irqsave(&vou_dev->lock, flags);
355 list_for_each_entry_safe(buf, node, &vou_dev->buf_list, list) { 359 list_for_each_entry_safe(buf, node, &vou_dev->buf_list, list) {
356 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); 360 vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
357 list_del(&buf->list); 361 list_del(&buf->list);
358 } 362 }
359 vou_dev->active = NULL; 363 vou_dev->active = NULL;
@@ -1066,10 +1070,10 @@ static irqreturn_t sh_vou_isr(int irq, void *dev_id)
1066 1070
1067 list_del(&vb->list); 1071 list_del(&vb->list);
1068 1072
1069 v4l2_get_timestamp(&vb->vb.v4l2_buf.timestamp); 1073 v4l2_get_timestamp(&vb->vb.timestamp);
1070 vb->vb.v4l2_buf.sequence = vou_dev->sequence++; 1074 vb->vb.sequence = vou_dev->sequence++;
1071 vb->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; 1075 vb->vb.field = V4L2_FIELD_INTERLACED;
1072 vb2_buffer_done(&vb->vb, VB2_BUF_STATE_DONE); 1076 vb2_buffer_done(&vb->vb.vb2_buf, VB2_BUF_STATE_DONE);
1073 1077
1074 vou_dev->active = list_entry(vou_dev->buf_list.next, 1078 vou_dev->active = list_entry(vou_dev->buf_list.next,
1075 struct sh_vou_buffer, list); 1079 struct sh_vou_buffer, list);