Skip to contentSkip to conversation

TW686x frame grabber driver

PATCH Superseded Krzysztof Hałasa 1 participant 2 messages Feb 16, 2016 – Feb 23, 2016

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 TW686x frame grabber driver

A driver for Intersil/Techwell TW686x-based PCIe frame grabbers.

MAINTAINERS +6 -0
index f075926..faf93db 100644
@@ -11073,6 +11073,12 @@ W:	https://linuxtv.org
 S:	Odd Fixes
 F:	drivers/media/pci/tw68/
 
+TW686x VIDEO4LINUX DRIVER
+M:	Krzysztof Halasa <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/media/pci/tw686x/
+
 TPM DEVICE DRIVER
 M:	Peter Huewe <[email protected]>
 M:	Marcel Selhorst <[email protected]>
drivers/media/pci/Kconfig +1 -0
index 48a611b..4f6467f 100644
@@ -14,6 +14,7 @@ source "drivers/media/pci/meye/Kconfig"
 source "drivers/media/pci/solo6x10/Kconfig"
 source "drivers/media/pci/sta2x11/Kconfig"
 source "drivers/media/pci/tw68/Kconfig"
+source "drivers/media/pci/tw686x/Kconfig"
 source "drivers/media/pci/zoran/Kconfig"
 endif
 
drivers/media/pci/Makefile +1 -0
index 5f8aacb..2e54c36 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_VIDEO_BT848) += bt8xx/
 obj-$(CONFIG_VIDEO_SAA7134) += saa7134/
 obj-$(CONFIG_VIDEO_SAA7164) += saa7164/
 obj-$(CONFIG_VIDEO_TW68) += tw68/
+obj-$(CONFIG_VIDEO_TW686X) += tw686x/
 obj-$(CONFIG_VIDEO_DT3155) += dt3155/
 obj-$(CONFIG_VIDEO_MEYE) += meye/
 obj-$(CONFIG_STA2X11_VIP) += sta2x11/
drivers/media/pci/tw686x/Kconfig new file +16 -0
new file mode 100644
index 0000000..8792a68
@@ -0,0 +1,16 @@
+config VIDEO_TW686X
+	tristate "Intersil/Techwell TW686x Video For Linux"
+	depends on VIDEO_DEV && PCI && VIDEO_V4L2
+	select VIDEOBUF2_DMA_SG
+	help
+	  Support for Intersil/Techwell TW686x-based frame grabber cards.
+
+	  Currently supported chips:
+	  - TW6864 (4 video channels),
+	  - TW6865 (4 video channels, not tested, second generation chip),
+	  - TW6868 (8 video channels but only 4 first channels using
+	    built-in video decoder are supported, not tested),
+	  - TW6869 (8 video channels, second generation chip).
+
+	  To compile this driver as a module, choose M here: the module
+	  will be named tw686x.
drivers/media/pci/tw686x/Makefile new file +3 -0
new file mode 100644
index 0000000..083b806
@@ -0,0 +1,3 @@
+tw686x-objs := tw686x-core.o tw686x-video.o
+
+obj-$(CONFIG_VIDEO_TW686X) += tw686x.o
drivers/media/pci/tw686x/tw686x-core.c new file +140 -0

140 lines not on this page · raw message

drivers/media/pci/tw686x/tw686x-regs.h new file +103 -0

103 lines not on this page · raw message

drivers/media/pci/tw686x/tw686x-video.c new file +815 -0

815 lines not on this page · raw message

drivers/media/pci/tw686x/tw686x.h new file +118 -0

118 lines not on this page · raw message

#1 lore raw
Quoted 1 line

A driver for Intersil/Techwell TW686x-based PCIe frame grabbers.

The v3 TW686x patch was missing a few small changes (attached). Will post complete v4 patch.

Signature · 37 lines
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland

--- a/drivers/media/pci/tw686x/tw686x-video.c
+++ b/drivers/media/pci/tw686x/tw686x-video.c
@@ -260,6 +260,10 @@ static void setup_dma_cfg(struct tw686x_video_channel *vc)
 	reg_write(vc->dev, VIDEO_SIZE[vc->ch], (1 << 31) | (field_height << 16)
 		  | field_width);
 	reg = reg_read(vc->dev, VIDEO_CONTROL1);
+	if (vc->video_standard & V4L2_STD_625_50)
+		reg |= 1 << (vc->ch + 13);
+	else
+		reg &= ~(1 << (vc->ch + 13));
 	reg_write(vc->dev, VIDEO_CONTROL1, reg);
 }
 
@@ -569,8 +573,8 @@ static int video_thread(void *arg)
 
 			/* handle channel events */
 			if ((request & 0x01000000) |
-			    (reg_read(dev, VIDEO_FIFO_STATUS) & 0x01010001) |
-			    (reg_read(dev, VIDEO_PARSER_STATUS) & 0x00000101)) {
+			    (reg_read(dev, VIDEO_FIFO_STATUS) & (0x01010001 << ch)) |
+			    (reg_read(dev, VIDEO_PARSER_STATUS) & (0x00000101 << ch))) {
 				/* DMA Errors - reset channel */
 				u32 reg;
 
@@ -667,6 +671,7 @@ int tw686x_video_init(struct tw686x_dev *dev)
 	if (err)
 		return err;
 
+	reg_write(dev, VIDEO_CONTROL1, 0); /* NTSC, disable scaler */
 	reg_write(dev, PHASE_REF, 0x00001518); /* Scatter-gather DMA mode */
 
 	/* setup required SG table sizes */