Skip to contentSkip to conversation

Yet another (third) dt3155 driver PCI/video4linux compliant

RFC Marin Mitov 2 participants 7 messages Mar 20, 2010 – May 2, 2010 Staging

lore
Share & tools
lore
#1 lore raw
Quoted 7 lines · Marin Mitov

Hi Scott, Greg, all,

Here you will find a link to the source code for a dt3155 driver rewritten to be PCI/video4linux compliant.

http://lfb.issp.bas.bg/~mitov/linux/dt3155v4l/

Quoted 8 lines

It works with xawtv (if the window is bigger than the acquired image). See

http://lfb.issp.bas.bg/~mitov/linux/dt3155v4l/00README

for more details.

Any critics/comments will be appreciated.

Can you send it in patch form? I can't really do anything with it like this, sorry.

greg k-h

#2 lore raw
Quoted 13 lines · Greg KH
Quoted 12 lines · Marin Mitov

Hi Scott, Greg, all,

Here you will find a link to the source code for a dt3155 driver rewritten to be PCI/video4linux compliant.

http://lfb.issp.bas.bg/~mitov/linux/dt3155v4l/

It works with xawtv (if the window is bigger than the acquired image). See

http://lfb.issp.bas.bg/~mitov/linux/dt3155v4l/00README

Quoted 8 lines
Quoted 3 lines

for more details.

Any critics/comments will be appreciated.

Can you send it in patch form? I can't really do anything with it like this, sorry.

greg k-h

OK, here it is:

======================================================

Kernel module (device driver) for dt3155 frame grabber video4linux2 compliant (finaly). Works with xawtv.

======================================================

This driver is written (almost) from scratch, usung the allocator developed for dt3155pci see bellow). The driver uses videobuf-dma-contig interface modified to use the above mentioned allocator instead of dma_alloc_coheren().

The first thing to do was to design a new allocator based on allocating a configurable number of 4MB chunks of memory, that latter are broken into frame buffers of 768x576 bytes kept in different FIFOs (queues). As far as the driver autoloads as a kernel module during kernel boot, the allocation of 4MB chunks succeeds.

The driver keeps three FIFOs: one for 4MB chunks, one for free buffers (available for allocations) and one for buffers already allocated. Allocation/deallocation is done automatically though the video4linux videobuf subsystem (some pointers to functions are replaced by driver supplied functions).

Sure, there are problems:

1. The device works by read() method only (for now).

2. Works for CCIR, but should work for RS-170 (not tested) This is made during kernel configuration.

3. Could work for multiple dt3155 frame grabbers in a PC, (private data is allocated during PCI probe() method), but is not tested due to lack of a second board.

4. Not tested on a BIG ENDIAN architecture.

5. Many others you could find .... :-)

All critics, comments, suggestions are wellcome.

Marin Mitov

================================================================================

drivers/staging/dt3155v4l/Kconfig +20 -0
diff -uN a/drivers/staging/dt3155v4l/Kconfig b/drivers/staging/dt3155v4l/Kconfig
@@ -0,0 +1,20 @@
+config VIDEO_DT3155
+	tristate "DT3155 frame grabber, Video4Linux interface"
+	depends on PCI && VIDEO_DEV && VIDEO_V4L2
+	select VIDEOBUF_DMA_CONTIG
+	default n
+	---help---
+	  Enables dt3155 device driver for the DataTranslation DT3155 frame grabber.
+	  Say Y here if you have this hardware.
+	  In doubt, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called dt3155_v4l.
+
+config DT3155_CCIR
+	bool "Selects CCIR/50Hz vertical refresh"
+	depends on VIDEO_DT3155
+	default y
+	---help---
+	  Select it for CCIR/50Hz (European region),
+	  or leave it unselected for RS-170/60Hz (North America).
drivers/staging/dt3155v4l/Makefile +4 -0
diff -uN a/drivers/staging/dt3155v4l/Makefile b/drivers/staging/dt3155v4l/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_VIDEO_DT3155)	+= dt3155_v4l.o
+dt3155_v4l-objs :=	\
+		dt3155-bufs.o	\
+		dt3155v4l.o
drivers/staging/dt3155v4l/dt3155-bufs.c +256 -0

256 lines not on this page · raw message

drivers/staging/dt3155v4l/dt3155-bufs.h +86 -0

86 lines not on this page · raw message

drivers/staging/dt3155v4l/dt3155v4l.c +1417 -0

1,417 lines not on this page · raw message

drivers/staging/dt3155v4l/dt3155v4l.h +214 -0

214 lines not on this page · raw message

==============================================
A patch for drivers/staging/Kconfig

======================================================================

drivers/staging/Kconfig +2 -0
@@ -137,6 +137,8 @@
 
 source "drivers/staging/dt3155/Kconfig"
 
+source "drivers/staging/dt3155v4l/Kconfig"
+
 source "drivers/staging/crystalhd/Kconfig"
 
 endif # !STAGING_EXCLUDE_BUILD
#3 lore raw
Quoted 61 lines · Marin Mitov
Quoted 13 lines · Greg KH
Quoted 12 lines · Marin Mitov

Hi Scott, Greg, all,

Here you will find a link to the source code for a dt3155 driver rewritten to be PCI/video4linux compliant.

http://lfb.issp.bas.bg/~mitov/linux/dt3155v4l/

It works with xawtv (if the window is bigger than the acquired image). See

http://lfb.issp.bas.bg/~mitov/linux/dt3155v4l/00README

Quoted 8 lines
Quoted 3 lines

for more details.

Any critics/comments will be appreciated.

Can you send it in patch form? I can't really do anything with it like this, sorry.

greg k-h

OK, here it is:

======================================================

Kernel module (device driver) for dt3155 frame grabber video4linux2 compliant (finaly). Works with xawtv.

======================================================

This driver is written (almost) from scratch, usung the allocator developed for dt3155pci see bellow). The driver uses videobuf-dma-contig interface modified to use the above mentioned allocator instead of dma_alloc_coheren().

The first thing to do was to design a new allocator based on allocating a configurable number of 4MB chunks of memory, that latter are broken into frame buffers of 768x576 bytes kept in different FIFOs (queues). As far as the driver autoloads as a kernel module during kernel boot, the allocation of 4MB chunks succeeds.

The driver keeps three FIFOs: one for 4MB chunks, one for free buffers (available for allocations) and one for buffers already allocated. Allocation/deallocation is done automatically though the video4linux videobuf subsystem (some pointers to functions are replaced by driver supplied functions).

Sure, there are problems:

1. The device works by read() method only (for now).

2. Works for CCIR, but should work for RS-170 (not tested) This is made during kernel configuration.

3. Could work for multiple dt3155 frame grabbers in a PC, (private data is allocated during PCI probe() method), but is not tested due to lack of a second board.

Quoted 5 lines

4. Not tested on a BIG ENDIAN architecture.

5. Many others you could find .... :-)

All critics, comments, suggestions are wellcome.

I like it, want me to apply it? Right now it fails to build, but that should be simple to fix up, I'll be glad to do that.

thanks,

greg k-h

#4 lore raw
Quoted 62 lines · Greg KH
Quoted 61 lines · Marin Mitov
Quoted 13 lines · Greg KH
Quoted 12 lines · Marin Mitov

Hi Scott, Greg, all,

Here you will find a link to the source code for a dt3155 driver rewritten to be PCI/video4linux compliant.

http://lfb.issp.bas.bg/~mitov/linux/dt3155v4l/

It works with xawtv (if the window is bigger than the acquired image). See

http://lfb.issp.bas.bg/~mitov/linux/dt3155v4l/00README

Quoted 8 lines
Quoted 3 lines

for more details.

Any critics/comments will be appreciated.

Can you send it in patch form? I can't really do anything with it like this, sorry.

greg k-h

OK, here it is:

======================================================

Kernel module (device driver) for dt3155 frame grabber video4linux2 compliant (finaly). Works with xawtv.

======================================================

This driver is written (almost) from scratch, usung the allocator developed for dt3155pci see bellow). The driver uses videobuf-dma-contig interface modified to use the above mentioned allocator instead of dma_alloc_coheren().

The first thing to do was to design a new allocator based on allocating a configurable number of 4MB chunks of memory, that latter are broken into frame buffers of 768x576 bytes kept in different FIFOs (queues). As far as the driver autoloads as a kernel module during kernel boot, the allocation of 4MB chunks succeeds.

The driver keeps three FIFOs: one for 4MB chunks, one for free buffers (available for allocations) and one for buffers already allocated. Allocation/deallocation is done automatically though the video4linux videobuf subsystem (some pointers to functions are replaced by driver supplied functions).

Sure, there are problems:

1. The device works by read() method only (for now).

2. Works for CCIR, but should work for RS-170 (not tested) This is made during kernel configuration.

3. Could work for multiple dt3155 frame grabbers in a PC, (private data is allocated during PCI probe() method), but is not tested due to lack of a second board.

Quoted 7 lines
Quoted 5 lines

4. Not tested on a BIG ENDIAN architecture.

5. Many others you could find .... :-)

All critics, comments, suggestions are wellcome.

I like it, want me to apply it?

Thank you for liking it. Since the time I sent the patch much in the driver has changed. Now it works (tested only with xawtv -f) with read(), as well as mmap(), but see below for the problems.

Now I send you an updated patch, but it is not reviewed. You could either review it :-) or apply the previous patch. In the last case I will prepare a difference patch and will send it.

I should say the new patch is tested with kernel-2.6.32.12

Quoted 2 lines

Right now it fails to build, but that
should be simple to fix up, I'll be glad to do that.

Strange, I have tested the build here (both built-in and as module). What is the problem? May be it is also present in the new patch, sorry.

Quoted 5 lines

thanks,

greg k-h

Marin Mitov

======================================================

Kernel module (device driver) for dt3155 frame grabber video4linux2 compliant (finally). Works with "xawtv -f".

======================================================

This driver is written (almost) from scratch, using the allocator developed for dt3155pci see bellow). The driver uses videobuf-dma-contig interface modified to use the above mentioned allocator instead of dma_alloc_coheren().

The first thing to do was to design a new allocator based on allocating a configurable number of 4MB chunks of memory, that latter are broken into frame buffers of 768x576 bytes kept in different FIFOs (queues). As far as the driver autoloads as a kernel module during kernel boot, the allocation of 4MB chunks succeeds.

The driver keeps three FIFOs: one for 4MB chunks, one for free buffers (available for allocations) and one for buffers already allocated. Allocation/deallocation is done automatically though the video4linux videobuf subsystem (some pointers to functions are replaced by driver supplied functions).

Sure, there are problems:

1. The device tested to work with "xawtv -f" either via read() method (DT3155_STREAMING not selected), or via mmap() method (DT3155_STREAMING is selected) only. This coresponds to either cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; or
cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; but not when
cap->capabilities = V4L2_CAP_VIDEO_CAPTURE |

                           V4L2_CAP_STREAMING |
                           V4L2_CAP_READWRITE;

This is because xawtv calls poll() before starting streaming, but videobuf_poll_stream() automatically starts reading if streaming is not started.
This selection is made during kernel configuration (for now).

2. Works for CCIR, but should work for RS-170 (not tested) This is made also during kernel configuration.

3. Could work for multiple dt3155 frame grabbers in a PC, (private data is allocated during PCI probe() method), but is not tested due to lack of a second board.

4. Not tested on a BIG ENDIAN architecture.

5. Many others you could find .... :-)

All critics, comments, suggestions are wellcome.

Marin Mitov

================================================================================

drivers/staging/dt3155v4l/Kconfig +28 -0
diff -uN a/drivers/staging/dt3155v4l/Kconfig b/drivers/staging/dt3155v4l/Kconfig
@@ -0,0 +1,28 @@
+config VIDEO_DT3155
+	tristate "DT3155 frame grabber, Video4Linux interface"
+	depends on PCI && VIDEO_DEV && VIDEO_V4L2
+	select VIDEOBUF_DMA_CONTIG
+	default n
+	---help---
+	  Enables dt3155 device driver for the DataTranslation DT3155 frame grabber.
+	  Say Y here if you have this hardware.
+	  In doubt, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called dt3155_v4l.
+
+config DT3155_CCIR
+	bool "Selects CCIR/50Hz vertical refresh"
+	depends on VIDEO_DT3155
+	default y
+	---help---
+	  Select it for CCIR/50Hz (European region),
+	  or leave it unselected for RS-170/60Hz (North America).
+
+config DT3155_STREAMING
+	bool "Selects mmap streaming instead of read method"
+	depends on VIDEO_DT3155
+	default y
+	---help---
+	  Select it if you wish to try mmap streaming, or
+	  or leave it unselected for using read method.
drivers/staging/dt3155v4l/Makefile +4 -0
diff -uN a/drivers/staging/dt3155v4l/Makefile b/drivers/staging/dt3155v4l/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_VIDEO_DT3155)	+= dt3155_v4l.o
+dt3155_v4l-objs :=	\
+		dt3155-bufs.o	\
+		dt3155v4l.o
drivers/staging/dt3155v4l/dt3155-bufs.c +256 -0

256 lines not on this page · raw message

drivers/staging/dt3155v4l/dt3155-bufs.h +88 -0

88 lines not on this page · raw message

drivers/staging/dt3155v4l/dt3155v4l.c +1537 -0

1,537 lines not on this page · raw message

drivers/staging/dt3155v4l/dt3155v4l.h +220 -0

220 lines not on this page · raw message

drivers/staging/Kconfig renamed from drivers/staging/Kconfig.orig +2 -0
@@ -137,6 +137,8 @@
 
 source "drivers/staging/dt3155/Kconfig"
 
+source "drivers/staging/dt3155v4l/Kconfig"
+
 source "drivers/staging/crystalhd/Kconfig"
 
 endif # !STAGING_EXCLUDE_BUILD
#5 lore raw
Quoted 8 lines · Marin Mitov
Quoted 1 line

I like it, want me to apply it?

Thank you for liking it. Since the time I sent the patch much in the driver has changed. Now it works (tested only with xawtv -f) with read(), as well as mmap(), but see below for the problems.

Now I send you an updated patch, but it is not reviewed. You could either review it :-) or apply the previous patch. In the last case I will prepare a difference patch and will send it.

This one worked for me, with the exception that you forgot to modify the drivers/staging/Makefile file to add the driver to the build. I've fixed that up, and it builds on my i386 box, so I've added it to my tree.

thanks,

greg k-h

#6 lore raw
Quoted 7 lines · Greg KH
Quoted 6 lines · Marin Mitov
Quoted 1 line

I like it, want me to apply it?

Thank you for liking it. Since the time I sent the patch much in the driver has changed. Now it works (tested only with xawtv -f) with read(), as well as mmap(), but see below for the problems.

Quoted 7 lines
Quoted 2 lines

Now I send you an updated patch, but it is not reviewed. You could either review it :-) or apply the previous patch. In the last case I will prepare a difference patch and will send it.

This one worked for me, with the exception that you forgot to modify the drivers/staging/Makefile file to add the driver to the build. I've fixed that up, and it builds on my i386 box, so I've added it to my tree.

Yes, this is my fault, sorry, and thank you.

Marin Mitov

Quoted 5 lines

thanks,

greg k-h