Commit 6dfa5131 authored by Prabhakar Lad's avatar Prabhakar Lad Committed by Mauro Carvalho Chehab

[media] media: vivid: use vb2_ops_wait_prepare/finish helper

Signed-off-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent a48ff17d
...@@ -195,20 +195,6 @@ static const u8 vivid_hdmi_edid[256] = { ...@@ -195,20 +195,6 @@ static const u8 vivid_hdmi_edid[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7
}; };
void vivid_lock(struct vb2_queue *vq)
{
struct vivid_dev *dev = vb2_get_drv_priv(vq);
mutex_lock(&dev->mutex);
}
void vivid_unlock(struct vb2_queue *vq)
{
struct vivid_dev *dev = vb2_get_drv_priv(vq);
mutex_unlock(&dev->mutex);
}
static int vidioc_querycap(struct file *file, void *priv, static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
...@@ -1018,6 +1004,7 @@ static int __init vivid_create_instance(int inst) ...@@ -1018,6 +1004,7 @@ static int __init vivid_create_instance(int inst)
q->mem_ops = &vb2_vmalloc_memops; q->mem_ops = &vb2_vmalloc_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 2; q->min_buffers_needed = 2;
q->lock = &dev->mutex;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret) if (ret)
...@@ -1036,6 +1023,7 @@ static int __init vivid_create_instance(int inst) ...@@ -1036,6 +1023,7 @@ static int __init vivid_create_instance(int inst)
q->mem_ops = &vb2_vmalloc_memops; q->mem_ops = &vb2_vmalloc_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 2; q->min_buffers_needed = 2;
q->lock = &dev->mutex;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret) if (ret)
...@@ -1054,6 +1042,7 @@ static int __init vivid_create_instance(int inst) ...@@ -1054,6 +1042,7 @@ static int __init vivid_create_instance(int inst)
q->mem_ops = &vb2_vmalloc_memops; q->mem_ops = &vb2_vmalloc_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 2; q->min_buffers_needed = 2;
q->lock = &dev->mutex;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret) if (ret)
...@@ -1072,6 +1061,7 @@ static int __init vivid_create_instance(int inst) ...@@ -1072,6 +1061,7 @@ static int __init vivid_create_instance(int inst)
q->mem_ops = &vb2_vmalloc_memops; q->mem_ops = &vb2_vmalloc_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 2; q->min_buffers_needed = 2;
q->lock = &dev->mutex;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret) if (ret)
...@@ -1089,6 +1079,7 @@ static int __init vivid_create_instance(int inst) ...@@ -1089,6 +1079,7 @@ static int __init vivid_create_instance(int inst)
q->mem_ops = &vb2_vmalloc_memops; q->mem_ops = &vb2_vmalloc_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->min_buffers_needed = 8; q->min_buffers_needed = 8;
q->lock = &dev->mutex;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret) if (ret)
......
...@@ -514,7 +514,4 @@ static inline bool vivid_is_hdmi_out(const struct vivid_dev *dev) ...@@ -514,7 +514,4 @@ static inline bool vivid_is_hdmi_out(const struct vivid_dev *dev)
return dev->output_type[dev->output] == HDMI; return dev->output_type[dev->output] == HDMI;
} }
void vivid_lock(struct vb2_queue *vq);
void vivid_unlock(struct vb2_queue *vq);
#endif #endif
...@@ -297,8 +297,8 @@ const struct vb2_ops vivid_sdr_cap_qops = { ...@@ -297,8 +297,8 @@ const struct vb2_ops vivid_sdr_cap_qops = {
.buf_queue = sdr_cap_buf_queue, .buf_queue = sdr_cap_buf_queue,
.start_streaming = sdr_cap_start_streaming, .start_streaming = sdr_cap_start_streaming,
.stop_streaming = sdr_cap_stop_streaming, .stop_streaming = sdr_cap_stop_streaming,
.wait_prepare = vivid_unlock, .wait_prepare = vb2_ops_wait_prepare,
.wait_finish = vivid_lock, .wait_finish = vb2_ops_wait_finish,
}; };
int vivid_sdr_enum_freq_bands(struct file *file, void *fh, struct v4l2_frequency_band *band) int vivid_sdr_enum_freq_bands(struct file *file, void *fh, struct v4l2_frequency_band *band)
......
...@@ -236,8 +236,8 @@ const struct vb2_ops vivid_vbi_cap_qops = { ...@@ -236,8 +236,8 @@ const struct vb2_ops vivid_vbi_cap_qops = {
.buf_queue = vbi_cap_buf_queue, .buf_queue = vbi_cap_buf_queue,
.start_streaming = vbi_cap_start_streaming, .start_streaming = vbi_cap_start_streaming,
.stop_streaming = vbi_cap_stop_streaming, .stop_streaming = vbi_cap_stop_streaming,
.wait_prepare = vivid_unlock, .wait_prepare = vb2_ops_wait_prepare,
.wait_finish = vivid_lock, .wait_finish = vb2_ops_wait_finish,
}; };
int vidioc_g_fmt_vbi_cap(struct file *file, void *priv, int vidioc_g_fmt_vbi_cap(struct file *file, void *priv,
......
...@@ -131,8 +131,8 @@ const struct vb2_ops vivid_vbi_out_qops = { ...@@ -131,8 +131,8 @@ const struct vb2_ops vivid_vbi_out_qops = {
.buf_queue = vbi_out_buf_queue, .buf_queue = vbi_out_buf_queue,
.start_streaming = vbi_out_start_streaming, .start_streaming = vbi_out_start_streaming,
.stop_streaming = vbi_out_stop_streaming, .stop_streaming = vbi_out_stop_streaming,
.wait_prepare = vivid_unlock, .wait_prepare = vb2_ops_wait_prepare,
.wait_finish = vivid_lock, .wait_finish = vb2_ops_wait_finish,
}; };
int vidioc_g_fmt_vbi_out(struct file *file, void *priv, int vidioc_g_fmt_vbi_out(struct file *file, void *priv,
......
...@@ -288,8 +288,8 @@ const struct vb2_ops vivid_vid_cap_qops = { ...@@ -288,8 +288,8 @@ const struct vb2_ops vivid_vid_cap_qops = {
.buf_queue = vid_cap_buf_queue, .buf_queue = vid_cap_buf_queue,
.start_streaming = vid_cap_start_streaming, .start_streaming = vid_cap_start_streaming,
.stop_streaming = vid_cap_stop_streaming, .stop_streaming = vid_cap_stop_streaming,
.wait_prepare = vivid_unlock, .wait_prepare = vb2_ops_wait_prepare,
.wait_finish = vivid_lock, .wait_finish = vb2_ops_wait_finish,
}; };
/* /*
......
...@@ -209,8 +209,8 @@ const struct vb2_ops vivid_vid_out_qops = { ...@@ -209,8 +209,8 @@ const struct vb2_ops vivid_vid_out_qops = {
.buf_queue = vid_out_buf_queue, .buf_queue = vid_out_buf_queue,
.start_streaming = vid_out_start_streaming, .start_streaming = vid_out_start_streaming,
.stop_streaming = vid_out_stop_streaming, .stop_streaming = vid_out_stop_streaming,
.wait_prepare = vivid_unlock, .wait_prepare = vb2_ops_wait_prepare,
.wait_finish = vivid_lock, .wait_finish = vb2_ops_wait_finish,
}; };
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment