Skip to content

Commit

Permalink
Add tw5864 driver
Browse files Browse the repository at this point in the history
Changes in v3 since v2:
 - Kconfig: select VIDEOBUF2_DMA_CONTIG, not SG
 - drop i2c code as unused
 - Dropped num_buffers check in queue_setup as suggested by Hans
 - Drop std autodetect on streaming start as suggested by Hans
 - Cleanup buf queue on enable_input() failure
 - Change container_of() to list_entry() where applicable
 - Changed V4L2_FIELD_NONE to V4L2_FIELD_INTERLACED as suggested
 - frameinterval rework suggested by Hans
 - Add enum_framesizes
 - Report framesize based on std, not input w/h
 - Add printed warning about known video quality issues
 - MAINTAINERS: fix path
 - request_mem_region() -> pci_request_regions()
 - Rebase onto Hans' "for-v4.8i" branch
 - Follow changes from patchset "vb2: replace allocation context by device pointer"

Below log is produced by today's v4l2-compliance from v4l-utils git, and this
patch based on branch "for-v4.8i" of git://linuxtv.org/hverkuil/media_tree.git .
Compliance test runs fine.

checkpatch.pl is happy with this patch except for artifacts_warning which
produces a bunch of such warnings:

WARNING: quoted string split across lines
torvalds#155: FILE: drivers/media/pci/tw5864/tw5864-core.c:44:
+"This driver was developed by Bluecherry LLC by deducing behaviour of original"
+" manufacturer's driver, from both source code and execution traces.\n"

I believe I'd better not join all the lines to avoid them looking like

"Paragraph one.\Paragraph two.\Paragraph three.\n"

 # v4l2-compliance -d 6 -s
v4l2-compliance SHA   : 5e74f6a15aa14c01d8319e086d98f33d96a6a04d

Driver Info:
        Driver name   : tw5864
        Card type     : TW5864 Encoder 2
        Bus info      : PCI:0000:06:05.0
        Driver version: 4.7.0
        Capabilities  : 0x85200001
                Video Capture
                Read/Write
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps   : 0x05200001
                Video Capture
                Read/Write
                Streaming
                Extended Pix Format

Compliance test for device /dev/video6 (not using libv4l2):

Required ioctls:
        test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
        test second video open: OK
        test VIDIOC_QUERYCAP: OK
        test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
        test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
        test VIDIOC_LOG_STATUS: OK

Input ioctls:
        test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
        test VIDIOC_ENUMAUDIO: OK (Not Supported)
        test VIDIOC_G/S/ENUMINPUT: OK
        test VIDIOC_G/S_AUDIO: OK (Not Supported)
        Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
        test VIDIOC_G/S_MODULATOR: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_ENUMAUDOUT: OK (Not Supported)
        test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDOUT: OK (Not Supported)
        Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
        test VIDIOC_ENUM/G/S/QUERY_STD: OK
        test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
        test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
        test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

        Control ioctls:
                test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
                test VIDIOC_QUERYCTRL: OK
                test VIDIOC_G/S_CTRL: OK
                test VIDIOC_G/S/TRY_EXT_CTRLS: OK
                test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
                test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
                Standard Controls: 11 Private Controls: 0

        Format ioctls:
                test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
                test VIDIOC_G/S_PARM: OK
                test VIDIOC_G_FBUF: OK (Not Supported)
                test VIDIOC_G_FMT: OK
                test VIDIOC_TRY_FMT: OK
                test VIDIOC_S_FMT: OK
                test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
                test Cropping: OK (Not Supported)
                test Composing: OK (Not Supported)
                test Scaling: OK (Not Supported)

        Codec ioctls:
                test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
                test VIDIOC_G_ENC_INDEX: OK (Not Supported)
                test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

        Buffer ioctls:
                test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
                test VIDIOC_EXPBUF: OK

Test input 0:

Streaming ioctls:
        test read/write: OK
        test MMAP: OK
        test USERPTR: OK (Not Supported)
        test DMABUF: OK (Not Supported)

Total: 46, Succeeded: 46, Failed: 0, Warnings: 0

---8<---

Support for boards based on Techwell TW5864 chip which provides
multichannel video & audio grabbing and encoding (H.264, MJPEG,
ADPCM G.726).

This submission implements only H.264 encoding of all channels at D1
resolution.

Thanks to Mark Thompson <sw@jkqxz.net> for help, and for contribution of
H.264 startcode emulation prevention code.

Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Tested-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
  • Loading branch information
Andrey Utkin authored and 0day robot committed Jul 9, 2016
1 parent ca6e612 commit 5d55a92
Show file tree
Hide file tree
Showing 11 changed files with 4,541 additions and 0 deletions.
8 changes: 8 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -11598,6 +11598,14 @@ T: git git://linuxtv.org/media_tree.git
S: Odd fixes
F: drivers/media/usb/tm6000/

TW5864 VIDEO4LINUX DRIVER
M: Bluecherry Maintainers <maintainers@bluecherrydvr.com>
M: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
M: Andrey Utkin <andrey_utkin@fastmail.com>
L: linux-media@vger.kernel.org
S: Supported
F: drivers/media/pci/tw5864/

TW68 VIDEO4LINUX DRIVER
M: Hans Verkuil <hverkuil@xs4all.nl>
L: linux-media@vger.kernel.org
Expand Down
1 change: 1 addition & 0 deletions drivers/media/pci/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ if MEDIA_CAMERA_SUPPORT
source "drivers/media/pci/meye/Kconfig"
source "drivers/media/pci/solo6x10/Kconfig"
source "drivers/media/pci/sta2x11/Kconfig"
source "drivers/media/pci/tw5864/Kconfig"
source "drivers/media/pci/tw68/Kconfig"
source "drivers/media/pci/tw686x/Kconfig"
source "drivers/media/pci/zoran/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/media/pci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ obj-$(CONFIG_VIDEO_MEYE) += meye/
obj-$(CONFIG_STA2X11_VIP) += sta2x11/
obj-$(CONFIG_VIDEO_SOLO6X10) += solo6x10/
obj-$(CONFIG_VIDEO_COBALT) += cobalt/
obj-$(CONFIG_VIDEO_TW5864) += tw5864/
11 changes: 11 additions & 0 deletions drivers/media/pci/tw5864/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
config VIDEO_TW5864
tristate "Techwell TW5864 video/audio grabber and encoder"
depends on VIDEO_DEV && PCI && VIDEO_V4L2
select VIDEOBUF2_DMA_CONTIG
---help---
Support for boards based on Techwell TW5864 chip which provides
multichannel video & audio grabbing and encoding (H.264, MJPEG,
ADPCM G.726).

To compile this driver as a module, choose M here: the
module will be called tw5864.
3 changes: 3 additions & 0 deletions drivers/media/pci/tw5864/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tw5864-objs := tw5864-core.o tw5864-video.o tw5864-h264.o tw5864-util.o

obj-$(CONFIG_VIDEO_TW5864) += tw5864.o
Loading

0 comments on commit 5d55a92

Please sign in to comment.