Convert au0828 to use videobuf2. Tested with NTSC.
Tested video and vbi devices with xawtv, tvtime,
and vlc. Ran v4l2-compliance to ensure there are
no new regressions in video and vbi now has 3 fewer
failures.
video before:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_G_FMT: FAIL 3 failures
Total: 72, Succeeded: 69, Failed: 3, Warnings: 0
Video after:
test VIDIOC_DBG_G/S_REGISTER: OK
test VIDIOC_G_FMT: FAIL 3 failures
Total: 72, Succeeded: 69, Failed: 3, Warnings: 0
vbi before:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
test VIDIOC_EXPBUF: FAIL
test USERPTR: FAIL
Total: 72, Succeeded: 66, Failed: 6, Warnings: 0
vbi after:
test VIDIOC_DBG_G/S_REGISTER: OK
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK (Not Supported)
test USERPTR: OK
Total: 72, Succeeded: 69, Failed: 3, Warnings: 0
Signed-off-by: Shuah Khan shua...@osg.samsung.com
---
Note:
Also Alsa audio is having issues on 3.18-rc7 without any vb2
conversion changes. Is that a known issue? Several ALSA PCM
underrun and overrun errors and audio stops.
drivers/media/usb/au0828/Kconfig| 2 +-
drivers/media/usb/au0828/au0828-cards.c | 2 +-
drivers/media/usb/au0828/au0828-vbi.c | 122 ++--
drivers/media/usb/au0828/au0828-video.c | 960 +---
drivers/media/usb/au0828/au0828.h | 61 +-
5 files changed, 462 insertions(+), 685 deletions(-)
diff --git a/drivers/media/usb/au0828/Kconfig b/drivers/media/usb/au0828/Kconfig
index 1d410ac..78b797e 100644
--- a/drivers/media/usb/au0828/Kconfig
+++ b/drivers/media/usb/au0828/Kconfig
@@ -4,7 +4,7 @@ config VIDEO_AU0828
depends on I2C INPUT DVB_CORE USB
select I2C_ALGOBIT
select VIDEO_TVEEPROM
- select VIDEOBUF_VMALLOC
+ select VIDEOBUF2_VMALLOC
select DVB_AU8522_DTV if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/usb/au0828/au0828-cards.c
b/drivers/media/usb/au0828/au0828-cards.c
index 9eb77ac..ae2e563 100644
--- a/drivers/media/usb/au0828/au0828-cards.c
+++ b/drivers/media/usb/au0828/au0828-cards.c
@@ -39,7 +39,7 @@ static void hvr950q_cs5340_audio(void *priv, int enable)
struct au0828_board au0828_boards[] = {
[AU0828_BOARD_UNKNOWN] = {
.name = Unknown board,
- .tuner_type = UNSET,
+ .tuner_type = -1U,
.tuner_addr = ADDR_UNSET,
},
[AU0828_BOARD_HAUPPAUGE_HVR850] = {
diff --git a/drivers/media/usb/au0828/au0828-vbi.c
b/drivers/media/usb/au0828/au0828-vbi.c
index 932d24f..e8b4798 100644
--- a/drivers/media/usb/au0828/au0828-vbi.c
+++ b/drivers/media/usb/au0828/au0828-vbi.c
@@ -34,105 +34,71 @@ MODULE_PARM_DESC(vbibufs, number of vbi buffers, range
2-32);
/* -- */
-static void
-free_buffer(struct videobuf_queue *vq, struct au0828_buffer *buf)
+static int vbi_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
+ unsigned int *nbuffers, unsigned int *nplanes,
+ unsigned int sizes[], void *alloc_ctxs[])
{
- struct au0828_fh *fh = vq-priv_data;
- struct au0828_dev*dev = fh-dev;
- unsigned long flags = 0;
- if (in_interrupt())
- BUG();
-
- /* We used to wait for the buffer to finish here, but this didn't work
- because, as we were keeping the state as VIDEOBUF_QUEUED,
- videobuf_queue_cancel marked it as finished for us.
- (Also, it could wedge forever if the hardware was misconfigured.)
-
- This should be safe; by the time we get here, the buffer isn't
- queued anymore. If we ever start marking the buffers as
- VIDEOBUF_ACTIVE, it won't be, though.
- */
- spin_lock_irqsave(dev-slock, flags);
- if (dev-isoc_ctl.vbi_buf == buf)
- dev-isoc_ctl.vbi_buf = NULL;
- spin_unlock_irqrestore(dev-slock, flags);
+ struct au0828_dev *dev = vb2_get_drv_priv(vq);
+ unsigned long size;
- videobuf_vmalloc_free(buf-vb);
- buf-vb.state = VIDEOBUF_NEEDS_INIT;
-}
+ if (fmt)
+ size = fmt-fmt.pix.sizeimage;
+ else
+ size = dev-vbi_width * dev-vbi_height * 2;
-static int
-vbi_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
-{
- struct au0828_fh *fh = q-priv_data;
- struct au0828_dev*dev = fh-dev;
+ if (0 == *nbuffers)
+ *nbuffers = 32;
+ if (*nbuffers 2)
+ *nbuffers = 2;
+ if (*nbuffers 32)
+ *nbuffers = 32;
- *size = dev-vbi_width * dev-vbi_height * 2;
+ *nplanes = 1;
+ sizes[0] = size;
- if (0 == *count)
- *count = vbibufs;
- if (*count 2)
-