media: Add stk1160 new driver
Subsystems (2)
PATCH v5 1/1 media: Add stk1160 new driver
This driver adds support for stk1160 usb bridge as used in some video/audio usb capture devices.
It is a complete rewrite of staging/media/easycap driver and it's expected as a replacement.
---
Here we are once again,
As stk1160 allows communication with an ac97 codec chip, this driver registers a control-only sound card to allow the user to access ac97 controls.
This is achieved through snd_ac97_codec/ac97_bus drivers. Mauro suggested that this ac97 handling should be put inside -alsa tree, but I'm still not sure about it.
This approach is working well in practice, but I'm not 100% confident so feedback is welcome (in particular from you alsa guys).
Testing has been performed using both vlc and mplayer
on a gentoo machine, including hot unplug and on-the-fly standard change. I also got reports about the driver working fine on ARM platforms.
Two devices have been used for testing:
* 1-cvbs video and 1-audio ac97 input,
* 4-cvbs inputs
Both of these devices reports with the same id [05e1:0408], so the driver tries to support a superset of the capabilities.
By using keep_buffers module parameter it's possible to prevent the driver from releasing urb buffers when streaming is stopped. The usage of this parameter can avoid memory fragmentation that may cause the driver to stop working on low memory systems.
A similar mechanism is implemented in em28xx driver (see commit 86d38d).
This v5 patch removes easycap driver, takes advantage of latest videobuf2 improvements and addresses some minor comments from Mauro.
I consider the driver to be pretty usable, but of course: bugs happen. As usual, any comments/reviews of *any* kind will be greatly appreciated.
Ah, last but not least, if you're a user and you're reading this:
Don't use this patch! Instead, search for <stk1160-standalone> on github :-)
Thanks to Hans, Sylwester, Mauro and everyone else for their indispensable help.
Changes from v4:
* Remove old easycap staging driver
* Incorporated review comments by Mauro (Thanks!)
* Remove (pedantic) BUG usage
* Remove unused frame_* ioctls
* Use new vb2 helpers for ioctls and fops
* Select saa711x unconditionally in Kconfig
* Replace usb high speed requirement with a mere warning
Changes from v3:
* Incorporated all review comments by Sylwester (Thanks!)
* Added keep_buffers module parameter. This parameter keeps the driver from releasing urb buffers when streaming is stopped.
Changes from v2:
* Added support for multiple video input device
* Added ac97 initialization
* Register an ac97 sound card (mixer control only) to access ac97 registers.
Changes from v1:
* Use media control framework
* Register video device as the last thing
* Use v4l_device release to release all resources
* Add explicit locking for file operations
* Add vb2 buffer sanity check
* Minor style cleanups
--- drivers/media/video/Kconfig | 2 + drivers/media/video/Makefile | 1 + drivers/media/video/stk1160/Kconfig | 12 + drivers/media/video/stk1160/Makefile | 6 + drivers/media/video/stk1160/stk1160-ac97.c | 153 + drivers/media/video/stk1160/stk1160-core.c | 431 +++ drivers/media/video/stk1160/stk1160-i2c.c | 294 ++ drivers/media/video/stk1160/stk1160-reg.h | 93 + drivers/media/video/stk1160/stk1160-v4l.c | 727 ++++ drivers/media/video/stk1160/stk1160-video.c | 518 +++ drivers/media/video/stk1160/stk1160.h | 202 + drivers/staging/media/Kconfig | 2 - drivers/staging/media/Makefile | 1 - drivers/staging/media/easycap/Kconfig | 30 - drivers/staging/media/easycap/Makefile | 10 - drivers/staging/media/easycap/README | 141 - drivers/staging/media/easycap/easycap.h | 567 --- drivers/staging/media/easycap/easycap_ioctl.c | 2442 ------------- drivers/staging/media/easycap/easycap_low.c | 968 ----- drivers/staging/media/easycap/easycap_main.c | 4235 ---------------------- drivers/staging/media/easycap/easycap_settings.c | 696 ---- drivers/staging/media/easycap/easycap_sound.c | 750 ---- drivers/staging/media/easycap/easycap_testcard.c | 155 - 23 files changed, 2439 insertions(+), 9997 deletions(-) create mode 100644 drivers/media/video/stk1160/Kconfig create mode 100644 drivers/media/video/stk1160/Makefile create mode 100644 drivers/media/video/stk1160/stk1160-ac97.c create mode 100644 drivers/media/video/stk1160/stk1160-core.c create mode 100644 drivers/media/video/stk1160/stk1160-i2c.c create mode 100644 drivers/media/video/stk1160/stk1160-reg.h create mode 100644 drivers/media/video/stk1160/stk1160-v4l.c create mode 100644 drivers/media/video/stk1160/stk1160-video.c create mode 100644 drivers/media/video/stk1160/stk1160.h delete mode 100644 drivers/staging/media/easycap/Kconfig delete mode 100644 drivers/staging/media/easycap/Makefile delete mode 100644 drivers/staging/media/easycap/README delete mode 100644 drivers/staging/media/easycap/easycap.h delete mode 100644 drivers/staging/media/easycap/easycap_ioctl.c delete mode 100644 drivers/staging/media/easycap/easycap_low.c delete mode 100644 drivers/staging/media/easycap/easycap_main.c delete mode 100644 drivers/staging/media/easycap/easycap_settings.c delete mode 100644 drivers/staging/media/easycap/easycap_sound.c delete mode 100644 drivers/staging/media/easycap/easycap_testcard.c
drivers/media/video/Kconfig +2 -0
@@ -748,6 +748,8 @@ source "drivers/media/video/tm6000/Kconfig" source "drivers/media/video/usbvision/Kconfig" +source "drivers/media/video/stk1160/Kconfig" + endif # V4L_USB_DRIVERS #
drivers/media/video/Makefile +1 -0
@@ -126,6 +126,7 @@ obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o obj-$(CONFIG_STA2X11_VIP) += sta2x11_vip.o obj-$(CONFIG_VIDEO_TIMBERDALE) += timblogiw.o +obj-$(CONFIG_VIDEO_STK1160) += stk1160/ obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
drivers/media/video/stk1160/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +config VIDEO_STK1160 + tristate "STK1160 USB video capture support" + depends on VIDEO_DEV && I2C + select VIDEOBUF2_VMALLOC + select VIDEO_SAA711X + select SND_AC97_CODEC + + ---help--- + This is a video4linux driver for STK1160 based video capture devices + + To compile this driver as a module, choose M here: the + module will be called stk1160
drivers/media/video/stk1160/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +stk1160-y := stk1160-core.o stk1160-v4l.o stk1160-video.o stk1160-i2c.o stk1160-ac97.o + +obj-$(CONFIG_VIDEO_STK1160) += stk1160.o + +ccflags-y += -Wall +ccflags-y += -Idrivers/media/video
drivers/media/video/stk1160/stk1160-ac97.c new file +153 -0
153 lines not on this page · raw message
drivers/media/video/stk1160/stk1160-core.c new file +431 -0
431 lines not on this page · raw message
drivers/media/video/stk1160/stk1160-i2c.c new file +294 -0
294 lines not on this page · raw message
drivers/media/video/stk1160/stk1160-reg.h new file +93 -0
93 lines not on this page · raw message
drivers/media/video/stk1160/stk1160-v4l.c new file +727 -0
727 lines not on this page · raw message
drivers/media/video/stk1160/stk1160-video.c new file +518 -0
518 lines not on this page · raw message
drivers/media/video/stk1160/stk1160.h new file +202 -0
202 lines not on this page · raw message
drivers/staging/media/Kconfig +0 -2
@@ -25,8 +25,6 @@ source "drivers/staging/media/cxd2099/Kconfig" source "drivers/staging/media/dt3155v4l/Kconfig" -source "drivers/staging/media/easycap/Kconfig" - source "drivers/staging/media/go7007/Kconfig" source "drivers/staging/media/solo6x10/Kconfig"
drivers/staging/media/Makefile +0 -1
@@ -1,6 +1,5 @@ obj-$(CONFIG_DVB_AS102) += as102/ obj-$(CONFIG_DVB_CXD2099) += cxd2099/ -obj-$(CONFIG_EASYCAP) += easycap/ obj-$(CONFIG_LIRC_STAGING) += lirc/ obj-$(CONFIG_SOLO6X10) += solo6x10/ obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/
drivers/staging/media/easycap/Kconfig deleted +0 -30
@@ -1,30 +0,0 @@ -config EASYCAP - tristate "EasyCAP USB ID 05e1:0408 support" - depends on USB && VIDEO_DEV && SND - select SND_PCM - - ---help--- - This is an integrated audio/video driver for EasyCAP cards with - USB ID 05e1:0408. It supports two hardware variants: - - * EasyCAP USB 2.0 Video Adapter with Audio, Model DC60, - having input cables labelled CVBS, S-VIDEO, AUDIO(L), AUDIO(R) - - * EasyCAP002 4-Channel USB 2.0 DVR, having input cables labelled - 1, 2, 3, 4 and an unlabelled input cable for a microphone. - - To compile this driver as a module, choose M here: the - module will be called easycap - -config EASYCAP_DEBUG - bool "Enable EasyCAP driver debugging" - depends on EASYCAP - - ---help--- - This option enables debug printouts - - To enable debug, pass the debug level to the debug module - parameter: - - modprobe easycap debug=[0..9] -
drivers/staging/media/easycap/Makefile deleted +0 -10
@@ -1,10 +0,0 @@ -easycap-objs := easycap_main.o -easycap-objs += easycap_low.o -easycap-objs += easycap_ioctl.o -easycap-objs += easycap_settings.o -easycap-objs += easycap_testcard.o -easycap-objs += easycap_sound.o -obj-$(CONFIG_EASYCAP) += easycap.o - -ccflags-y := -Wall -
drivers/staging/media/easycap/README deleted +0 -141
141 lines not on this page · raw message
drivers/staging/media/easycap/easycap.h deleted +0 -567
354 lines not on this page · raw message
drivers/staging/media/easycap/easycap_ioctl.c deleted +0 -2442
2,442 lines not on this page · raw message
drivers/staging/media/easycap/easycap_low.c deleted +0 -968
968 lines not on this page · raw message
drivers/staging/media/easycap/easycap_main.c deleted +0 -4235
4,235 lines not on this page · raw message
drivers/staging/media/easycap/easycap_settings.c deleted +0 -696
696 lines not on this page · raw message
drivers/staging/media/easycap/easycap_sound.c deleted +0 -750
750 lines not on this page · raw message
drivers/staging/media/easycap/easycap_testcard.c deleted +0 -155
155 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.8.6
Part of the diff is not shown here. View the raw message.