diff options
author | Steven Toth <stoth@kernellabs.com> | 2011-04-06 07:32:56 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 08:28:43 -0400 |
commit | b7101de3fff596b35e45cd9fb7007caa07e97c9a (patch) | |
tree | 1c11baca827c290a1e312180204e8dc0472eabb9 /drivers/media/video/cx18/cx18-streams.c | |
parent | 5ed9bd02444a00bb1e8ecc1baa8ecdb633afc126 (diff) |
[media] cx18: mmap() support for raw YUV video capture
Add support for mmap method streaming of raw YUV video on cx18-based
hardware, in addition to the existing support for read() streaming of
raw YUV and MPEG-2 encoded video.
[simon.farnsworth@onelan.co.uk: I forward-ported this from Steven's original work,
done under contract to ONELAN. The original code is at
http://www.kernellabs.com/hg/~stoth/cx18-videobuf]
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-streams.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-streams.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 6fbc356113c1..eeb455a8b726 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -44,6 +44,7 @@ static struct v4l2_file_operations cx18_v4l2_enc_fops = { | |||
44 | .unlocked_ioctl = cx18_v4l2_ioctl, | 44 | .unlocked_ioctl = cx18_v4l2_ioctl, |
45 | .release = cx18_v4l2_close, | 45 | .release = cx18_v4l2_close, |
46 | .poll = cx18_v4l2_enc_poll, | 46 | .poll = cx18_v4l2_enc_poll, |
47 | .mmap = cx18_v4l2_mmap, | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | /* offset from 0 to register ts v4l2 minors on */ | 50 | /* offset from 0 to register ts v4l2 minors on */ |
@@ -132,6 +133,15 @@ static void cx18_stream_init(struct cx18 *cx, int type) | |||
132 | cx18_queue_init(&s->q_idle); | 133 | cx18_queue_init(&s->q_idle); |
133 | 134 | ||
134 | INIT_WORK(&s->out_work_order, cx18_out_work_handler); | 135 | INIT_WORK(&s->out_work_order, cx18_out_work_handler); |
136 | |||
137 | INIT_LIST_HEAD(&s->vb_capture); | ||
138 | s->vb_timeout.function = cx18_vb_timeout; | ||
139 | s->vb_timeout.data = (unsigned long)s; | ||
140 | init_timer(&s->vb_timeout); | ||
141 | spin_lock_init(&s->vb_lock); | ||
142 | |||
143 | /* Assume the previous pixel default */ | ||
144 | s->pixelformat = V4L2_PIX_FMT_HM12; | ||
135 | } | 145 | } |
136 | 146 | ||
137 | static int cx18_prep_dev(struct cx18 *cx, int type) | 147 | static int cx18_prep_dev(struct cx18 *cx, int type) |
@@ -729,6 +739,19 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s) | |||
729 | test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) | 739 | test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) |
730 | cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle, | 740 | cx18_vapi(cx, CX18_CPU_SET_VIDEO_MUTE, 2, s->handle, |
731 | (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute_yuv) << 8) | 1); | 741 | (v4l2_ctrl_g_ctrl(cx->cxhdl.video_mute_yuv) << 8) | 1); |
742 | |||
743 | /* Enable the Video Format Converter for UYVY 4:2:2 support, | ||
744 | * rather than the default HM12 Macroblovk 4:2:0 support. | ||
745 | */ | ||
746 | if (captype == CAPTURE_CHANNEL_TYPE_YUV) { | ||
747 | if (s->pixelformat == V4L2_PIX_FMT_YUYV) | ||
748 | cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2, | ||
749 | s->handle, 1); | ||
750 | else | ||
751 | /* If in doubt, default to HM12 */ | ||
752 | cx18_vapi(cx, CX18_CPU_SET_VFC_PARAM, 2, | ||
753 | s->handle, 0); | ||
754 | } | ||
732 | } | 755 | } |
733 | 756 | ||
734 | if (atomic_read(&cx->tot_capturing) == 0) { | 757 | if (atomic_read(&cx->tot_capturing) == 0) { |