aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 18:42:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 18:42:54 -0400
commit1eb63378354ac37b7e27d256bbf84684751bac32 (patch)
tree0775591a2dced778d1ba0bd8a946831e424d02d7 /drivers/media/video/cx18
parent1a4ceab195e66bce9c1638fdded6d92988100ba4 (diff)
parentbac2dacd5fb9ddad093d7a2dc5ab44e764874821 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (348 commits) [media] pctv452e: Remove bogus code [media] adv7175: Make use of media bus pixel codes [media] media: vb2: fix incorrect return value [media] em28xx: implement VIDIOC_ENUM_FRAMESIZES [media] cx23885: Stop the risc video fifo before reconfiguring it [media] cx23885: Avoid incorrect error handling and reporting [media] cx23885: Avoid stopping the risc engine during buffer timeout [media] cx23885: Removed a spurious function cx23885_set_scale() [media] cx23885: v4l2 api compliance, set the audioset field correctly [media] cx23885: hook the audio selection functions into the main driver [media] cx23885: add generic functions for dealing with audio input selection [media] cx23885: fixes related to maximum number of inputs and range checking [media] cx23885: Initial support for the MPX-885 mini-card [media] cx25840: Ensure AUDIO6 and AUDIO7 trigger line-in baseband use [media] cx23885: Enable audio line in support from the back panel [media] cx23885: Allow the audio mux config to be specified on a per input basis [media] cx25840: Enable support for non-tuner LR1/LR2 audio inputs [media] cx23885: Name an internal i2c part and declare a bitfield by name [media] cx23885: Ensure VBI buffers timeout quickly - bugfix for vbi hangs during streaming [media] cx23885: remove channel dump diagnostics when a vbi buffer times out ... Fix up trivial conflicts in drivers/misc/altera-stapl/altera.c (header file rename vs add)
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r--drivers/media/video/cx18/Makefile6
-rw-r--r--drivers/media/video/cx18/cx18-driver.h5
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c2
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c18
-rw-r--r--drivers/media/video/cx18/cx18-mailbox.c2
-rw-r--r--drivers/media/video/cx18/cx18-streams.c13
6 files changed, 29 insertions, 17 deletions
diff --git a/drivers/media/video/cx18/Makefile b/drivers/media/video/cx18/Makefile
index 2fadd9ded34..a86bab5893e 100644
--- a/drivers/media/video/cx18/Makefile
+++ b/drivers/media/video/cx18/Makefile
@@ -8,6 +8,6 @@ cx18-alsa-objs := cx18-alsa-main.o cx18-alsa-pcm.o
8obj-$(CONFIG_VIDEO_CX18) += cx18.o 8obj-$(CONFIG_VIDEO_CX18) += cx18.o
9obj-$(CONFIG_VIDEO_CX18_ALSA) += cx18-alsa.o 9obj-$(CONFIG_VIDEO_CX18_ALSA) += cx18-alsa.o
10 10
11EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core 11ccflags-y += -Idrivers/media/dvb/dvb-core
12EXTRA_CFLAGS += -Idrivers/media/dvb/frontends 12ccflags-y += -Idrivers/media/dvb/frontends
13EXTRA_CFLAGS += -Idrivers/media/common/tuners 13ccflags-y += -Idrivers/media/common/tuners
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index 18342072306..b9a94fc5146 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -409,6 +409,7 @@ struct cx18_stream {
409 409
410 /* Videobuf for YUV video */ 410 /* Videobuf for YUV video */
411 u32 pixelformat; 411 u32 pixelformat;
412 u32 vb_bytes_per_frame;
412 struct list_head vb_capture; /* video capture queue */ 413 struct list_head vb_capture; /* video capture queue */
413 spinlock_t vb_lock; 414 spinlock_t vb_lock;
414 struct timer_list vb_timeout; 415 struct timer_list vb_timeout;
@@ -430,10 +431,6 @@ struct cx18_open_id {
430 u32 open_id; 431 u32 open_id;
431 int type; 432 int type;
432 struct cx18 *cx; 433 struct cx18 *cx;
433
434 struct videobuf_queue vbuf_q;
435 spinlock_t s_lock; /* Protect vbuf_q */
436 enum v4l2_buf_type vb_type;
437}; 434};
438 435
439static inline struct cx18_open_id *fh2id(struct v4l2_fh *fh) 436static inline struct cx18_open_id *fh2id(struct v4l2_fh *fh)
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 07411f34885..14cb961c22b 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -784,8 +784,6 @@ int cx18_v4l2_close(struct file *filp)
784 cx18_release_stream(s); 784 cx18_release_stream(s);
785 } else { 785 } else {
786 cx18_stop_capture(id, 0); 786 cx18_stop_capture(id, 0);
787 if (id->type == CX18_ENC_STREAM_TYPE_YUV)
788 videobuf_mmap_free(&id->vbuf_q);
789 } 787 }
790 kfree(id); 788 kfree(id);
791 mutex_unlock(&cx->serialize_lock); 789 mutex_unlock(&cx->serialize_lock);
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index afe0a29e720..66b1c15c354 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -160,12 +160,7 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh,
160 pixfmt->priv = 0; 160 pixfmt->priv = 0;
161 if (id->type == CX18_ENC_STREAM_TYPE_YUV) { 161 if (id->type == CX18_ENC_STREAM_TYPE_YUV) {
162 pixfmt->pixelformat = s->pixelformat; 162 pixfmt->pixelformat = s->pixelformat;
163 /* HM12 YUV size is (Y=(h*720) + UV=(h*(720/2))) 163 pixfmt->sizeimage = s->vb_bytes_per_frame;
164 UYUV YUV size is (Y=(h*720) + UV=(h*(720))) */
165 if (s->pixelformat == V4L2_PIX_FMT_HM12)
166 pixfmt->sizeimage = pixfmt->height * 720 * 3 / 2;
167 else
168 pixfmt->sizeimage = pixfmt->height * 720 * 2;
169 pixfmt->bytesperline = 720; 164 pixfmt->bytesperline = 720;
170 } else { 165 } else {
171 pixfmt->pixelformat = V4L2_PIX_FMT_MPEG; 166 pixfmt->pixelformat = V4L2_PIX_FMT_MPEG;
@@ -296,6 +291,12 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
296 return -EBUSY; 291 return -EBUSY;
297 292
298 s->pixelformat = fmt->fmt.pix.pixelformat; 293 s->pixelformat = fmt->fmt.pix.pixelformat;
294 /* HM12 YUV size is (Y=(h*720) + UV=(h*(720/2)))
295 UYUV YUV size is (Y=(h*720) + UV=(h*(720))) */
296 if (s->pixelformat == V4L2_PIX_FMT_HM12)
297 s->vb_bytes_per_frame = h * 720 * 3 / 2;
298 else
299 s->vb_bytes_per_frame = h * 720 * 2;
299 300
300 mbus_fmt.width = cx->cxhdl.width = w; 301 mbus_fmt.width = cx->cxhdl.width = w;
301 mbus_fmt.height = cx->cxhdl.height = h; 302 mbus_fmt.height = cx->cxhdl.height = h;
@@ -463,13 +464,16 @@ static int cx18_s_register(struct file *file, void *fh,
463static int cx18_querycap(struct file *file, void *fh, 464static int cx18_querycap(struct file *file, void *fh,
464 struct v4l2_capability *vcap) 465 struct v4l2_capability *vcap)
465{ 466{
466 struct cx18 *cx = fh2id(fh)->cx; 467 struct cx18_open_id *id = fh2id(fh);
468 struct cx18 *cx = id->cx;
467 469
468 strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); 470 strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver));
469 strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); 471 strlcpy(vcap->card, cx->card_name, sizeof(vcap->card));
470 snprintf(vcap->bus_info, sizeof(vcap->bus_info), 472 snprintf(vcap->bus_info, sizeof(vcap->bus_info),
471 "PCI:%s", pci_name(cx->pci_dev)); 473 "PCI:%s", pci_name(cx->pci_dev));
472 vcap->capabilities = cx->v4l2_cap; /* capabilities */ 474 vcap->capabilities = cx->v4l2_cap; /* capabilities */
475 if (id->type == CX18_ENC_STREAM_TYPE_YUV)
476 vcap->capabilities |= V4L2_CAP_STREAMING;
473 return 0; 477 return 0;
474} 478}
475 479
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c
index c07191e09fc..0c7796e76ac 100644
--- a/drivers/media/video/cx18/cx18-mailbox.c
+++ b/drivers/media/video/cx18/cx18-mailbox.c
@@ -196,7 +196,7 @@ static void cx18_mdl_send_to_videobuf(struct cx18_stream *s,
196 } 196 }
197 197
198 /* If we've filled the buffer as per the callers res then dispatch it */ 198 /* If we've filled the buffer as per the callers res then dispatch it */
199 if (vb_buf->bytes_used >= (vb_buf->vb.width * vb_buf->vb.height * 2)) { 199 if (vb_buf->bytes_used >= s->vb_bytes_per_frame) {
200 dispatch = 1; 200 dispatch = 1;
201 vb_buf->bytes_used = 0; 201 vb_buf->bytes_used = 0;
202 } 202 }
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index 852f420fd27..638cca156b5 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -138,6 +138,12 @@ static int cx18_prepare_buffer(struct videobuf_queue *q,
138 buf->tvnorm = cx->std; 138 buf->tvnorm = cx->std;
139 s->pixelformat = pixelformat; 139 s->pixelformat = pixelformat;
140 140
141 /* HM12 YUV size is (Y=(h*720) + UV=(h*(720/2)))
142 UYUV YUV size is (Y=(h*720) + UV=(h*(720))) */
143 if (s->pixelformat == V4L2_PIX_FMT_HM12)
144 s->vb_bytes_per_frame = height * 720 * 3 / 2;
145 else
146 s->vb_bytes_per_frame = height * 720 * 2;
141 cx18_dma_free(q, s, buf); 147 cx18_dma_free(q, s, buf);
142 } 148 }
143 149
@@ -154,6 +160,12 @@ static int cx18_prepare_buffer(struct videobuf_queue *q,
154 buf->tvnorm = cx->std; 160 buf->tvnorm = cx->std;
155 s->pixelformat = pixelformat; 161 s->pixelformat = pixelformat;
156 162
163 /* HM12 YUV size is (Y=(h*720) + UV=(h*(720/2)))
164 UYUV YUV size is (Y=(h*720) + UV=(h*(720))) */
165 if (s->pixelformat == V4L2_PIX_FMT_HM12)
166 s->vb_bytes_per_frame = height * 720 * 3 / 2;
167 else
168 s->vb_bytes_per_frame = height * 720 * 2;
157 rc = videobuf_iolock(q, &buf->vb, NULL); 169 rc = videobuf_iolock(q, &buf->vb, NULL);
158 if (rc != 0) 170 if (rc != 0)
159 goto fail; 171 goto fail;
@@ -287,6 +299,7 @@ static void cx18_stream_init(struct cx18 *cx, int type)
287 299
288 /* Assume the previous pixel default */ 300 /* Assume the previous pixel default */
289 s->pixelformat = V4L2_PIX_FMT_HM12; 301 s->pixelformat = V4L2_PIX_FMT_HM12;
302 s->vb_bytes_per_frame = cx->cxhdl.height * 720 * 3 / 2;
290 } 303 }
291} 304}
292 305