Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af249982 authored by Adrian Bunk's avatar Adrian Bunk Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (4887): Remove the broken VIDEO_ZR36120 driver



The VIDEO_ZR36120 driver has:
- already been marked as BROKEN in 2.6.0 three years ago and
- is still marked as BROKEN.
Drivers that had been marked as BROKEN for such a long time seem to be 
unlikely to be revived in the forseeable future.
But if anyone wants to ever revive this driver, the code is still 
present in the older kernel releases.

Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Acked-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent d0d30c03
Loading
Loading
Loading
Loading
+0 −162
Original line number Diff line number Diff line
Driver for Trust Computer Products Framegrabber, version 0.6.1
------ --- ----- -------- -------- ------------  ------- - - -

- ZORAN ------------------------------------------------------
 Author: Pauline Middelink <middelin@polyware.nl>
   Date: 18 September 1999
Version: 0.6.1

- Description ------------------------------------------------

Video4Linux compatible driver for an unknown brand framegrabber
(Sold in the Netherlands by TRUST Computer Products) and various
other zoran zr36120 based framegrabbers.

The card contains a ZR36120 Multimedia PCI Interface and a Philips
SAA7110 Onechip Frontend videodecoder. There is also an DSP of
which I have forgotten the number, since i will never get that thing
to work without specs from the vendor itself.

The SAA711x are capable of processing 6 different video inputs,
CVBS1..6 and Y1+C1, Y2+C2, Y3+C3. All in 50/60Hz, NTSC, PAL or
SECAM and delivering a YUV datastream.  On my card the input
'CVBS-0' corresponds to channel CVBS2 and 'S-Video' to Y2+C2.

I have some reports of other cards working with the mentioned
chip sets. For a list of other working cards please have a look
at the cards named in the tvcards struct in the beginning of
zr36120.c

After some testing, I discovered that the carddesigner messed up
on the I2C interface. The Zoran chip includes 2 lines SDA and SCL
which (s)he connected reversely. So we have to clock on the SDA
and r/w data on the SCL pin. Life is fun... Each cardtype now has
a bit which signifies if you have a card with the same deficiency.

Oh, for the completeness of this story I must mention that my
card delivers the VSYNC pulse of the SAA chip to GIRQ1, not
GIRQ0 as some other cards have. This is also incorporated in
the driver be clearing/setting the 'useirq1' bit in the tvcard
description.

Another problems of continuous capturing data with a Zoran chip
is something nasty inside the chip. It effectively halves the
fps we ought to get... Here is the scenario: capturing frames
to memory is done in the so-called snapshot mode. In this mode
the Zoran stops after capturing a frame worth of data and wait
till the application set GRAB bit to indicate readiness for the
next frame. After detecting a set bit, the chip neatly waits
till the start of a frame, captures it and it goes back to off.
Smart ppl will notice the problem here. Its the waiting on the
_next_ frame each time we set the GRAB bit... Oh well, 12,5 fps
is still plenty fast for me.
-- update 28/7/1999 --
Don't believe a word I just said... Proof is the output
of `streamer -t 300 -r 25 -f avi15 -o /dev/null`
	++--+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+- 25/25
	+-s+-+-+-+-+-+-+-+-+-+-+-+-+-s+-+-+-+-+-+-+-+-+-+-+-
	syncer: done
	writer: done
(note the /dev/null is prudent here, my system is not able to
 grab /and/ write 25 fps to a file... gifts welcome :) )
The technical reasoning follows: The zoran completed the last
frame, the VSYNC goes low, and GRAB is cleared. The interrupt
routine starts to work since its VSYNC driven, and again
activates the GRAB bit. A few ms later the VSYNC (re-)rises and
the zoran starts to work on a new and freshly broadcasted frame....

For pointers I used the specs of both chips. Below are the URLs:
  http://www.zoran.com/ftp/download/devices/pci/ZR36120/36120data.pdf
  http://www-us.semiconductor.philips.com/acrobat/datasheets/SAA_7110_A_1.pdf
Some alternatives for the Philips SAA 7110 datasheet are:
  http://www.datasheetcatalog.com/datasheets_pdf/S/A/A/7/SAA7110.shtml
  http://www.datasheetarchive.com/search.php?search=SAA7110&sType=part

The documentation has very little on absolute numbers or timings
needed for the various modes/resolutions, but there are other
programs you can borrow those from.

------ Install --------------------------------------------
Read the file called TODO.  Note its long list of limitations.

Build a kernel with VIDEO4LINUX enabled. Activate the
BT848 driver; we need this because we have need for the
other modules (i2c and videodev) it enables.

To install this software, extract it into a suitable directory.
Examine the makefile and change anything you don't like.  Type "make".

After making the modules check if you have the much needed
/dev/video devices. If not, execute the following 4 lines:
	mknod /dev/video c 81 0
	mknod /dev/video1 c 81 1
	mknod /dev/video2 c 81 2
	mknod /dev/video3 c 81 3
	mknod /dev/video4 c 81 4

After making/checking the devices do:
	modprobe i2c
	modprobe videodev
	modprobe saa7110	(optional)
	modprobe saa7111	(optional)
	modprobe tuner		(optional)
	insmod zoran cardtype=<n>

<n> is the cardtype of the card you have. The cardnumber can
be found in the source of zr36120. Look for tvcards. If your
card is not there, please try if any other card gives some
response, and mail me if you got a working tvcard addition.

PS. <TVCard editors behold!)
    Don't forget to set video_input to the number of inputs
    you defined in the video_mux part of the tvcard definition.
    It's a common error to add a channel but not incrementing
    video_input and getting angry with me/v4l/linux/linus :(

You are now ready to test the framegrabber with your favorite
video4linux compatible tool

------ Application ----------------------------------------

This device works with all Video4Linux compatible applications,
given the limitations in the TODO file.

------ API ------------------------------------------------

This uses the V4L interface as of kernel release 2.1.116, and in
fact has not been tested on any lower version.  There are a couple
of minor differences due to the fact that the amount of data returned
with each frame varies, and no doubt there are discrepancies due to my
misunderstanding of the API.  I intend to convert this driver to the
new V4L2 API when it has stabilized more.

------ Current state --------------------------------------

The driver is capable of overlaying a video image in screen, and
even capable of grabbing frames. It uses the BIGPHYSAREA patch
to allocate lots of large memory blocks when tis patch is
found in the kernel, but it doesn't need it.
The consequence is that, when loading the driver as a module,
the module may tell you it's out of memory, but 'free' says
otherwise. The reason is simple; the modules wants its memory
contiguous, not fragmented, and after a long uptime there
probably isn't a fragment of memory large enough...

The driver uses a double buffering scheme, which should really
be an n-way buffer, depending on the size of allocated framebuffer
and the requested grab-size/format.
This current version also fixes a dead-lock situation during irq
time, which really, really froze my system... :)

Good luck.
  Pauline
+0 −12
Original line number Diff line number Diff line
@@ -575,18 +575,6 @@ config VIDEO_ZORAN_AVS6EYES
	help
	  Support for the AverMedia 6 Eyes video surveillance card.

config VIDEO_ZR36120
	tristate "Zoran ZR36120/36125 Video For Linux"
	depends on PCI && I2C && VIDEO_V4L1 && BROKEN
	help
	  Support for ZR36120/ZR36125 based frame grabber/overlay boards.
	  This includes the Victor II, WaveWatcher, Video Wonder, Maxi-TV,
	  and Buster boards. Please read the material in
	  <file:Documentation/video4linux/zr36120.txt> for more information.

	  To compile this driver as a module, choose M here: the
	  module will be called zr36120.

config VIDEO_MEYE
	tristate "Sony Vaio Picturebook Motion Eye Video For Linux"
	depends on PCI && SONYPI && VIDEO_V4L1
+0 −2
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
# Makefile for the video capture/playback device drivers.
#

zoran-objs      :=	zr36120.o zr36120_i2c.o zr36120_mem.o
zr36067-objs	:=	zoran_procfs.o zoran_device.o \
			zoran_driver.o zoran_card.o
tuner-objs	:=	tuner-core.o tuner-types.o tuner-simple.o \
@@ -23,7 +22,6 @@ obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o
obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o
obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o

obj-$(CONFIG_VIDEO_ZR36120) += zoran.o
obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o
obj-$(CONFIG_VIDEO_SAA5246A) += saa5246a.o
obj-$(CONFIG_VIDEO_SAA5249) += saa5249.o

drivers/media/video/zr36120.c

deleted100644 → 0
+0 −2079

File deleted.

Preview size limit exceeded, changes collapsed.

drivers/media/video/zr36120.h

deleted100644 → 0
+0 −279
Original line number Diff line number Diff line
/*
    zr36120.h - Zoran 36120/36125 based framegrabbers

    Copyright (C) 1998-1999 Pauline Middelink (middelin@polyware.nl)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _ZR36120_H
#define _ZR36120_H

#ifdef __KERNEL__

#include <linux/types.h>
#include <linux/wait.h>

#include <linux/i2c-old.h>
#include <linux/videodev.h>

#include <asm/io.h>

/*
 * Debug macro's, place an x behind the ) for actual debug-compilation
 * E.g. #define DEBUG(x...)	x
 */
#define DEBUG(x...)			/* Debug driver */
#define IDEBUG(x...)			/* Debug interrupt handler */
#define PDEBUG		0		/* Debug PCI writes */

/* defined in zr36120_i2c */
extern struct i2c_bus zoran_i2c_bus_template;

#define	ZORAN_MAX_FBUFFERS	2
#define	ZORAN_MAX_FBUFFER	(768*576*2)
#define	ZORAN_MAX_FBUFSIZE	(ZORAN_MAX_FBUFFERS*ZORAN_MAX_FBUFFER)

#define	ZORAN_VBI_BUFFERS	2
#define	ZORAN_VBI_BUFSIZE	(22*1024*2)

struct tvcard {
	char*	name;		/* name of the cardtype */
	int	video_inputs;	/* number of channels defined in video_mux */
	int	audio_inputs;	/* number of channels defined in audio_mux */
	__u32	swapi2c:1,	/* need to swap i2c wires SDA/SCL? */
		usegirq1:1,	/* VSYNC at GIRQ1 instead of GIRQ0? */
		vsync_pos:1,	/* positive VSYNC signal? */
		hsync_pos:1,	/* positive HSYNC signal? */
		gpdir:8,	/* General Purpose Direction register */
		gpval:8;	/* General Purpose Value register */
	int	video_mux[6];	/* mapping channel number to physical input */
#define		IS_TUNER	0x80
#define		IS_SVHS		0x40
#define		CHANNEL_MASK	0x3F
	int	audio_mux[6];	/* mapping channel number to physical input */
};
#define	TUNER(x)	((x)|IS_TUNER)
#define	SVHS(x)		((x)|IS_SVHS)

struct vidinfo {
	struct	vidinfo* next;	/* next active buffer			*/
	uint	kindof;
#define	FBUFFER_OVERLAY		0
#define	FBUFFER_GRAB		1
#define	FBUFFER_VBI		2
	uint	status;
#define FBUFFER_FREE		0
#define FBUFFER_BUSY		1
#define FBUFFER_DONE		2
	ulong	fieldnr;	/* # of field, not framer!		*/
	uint	x,y;
	int	w,h;		/* w,h can be negative!			*/
	uint	format;		/* index in palette2fmt[]		*/
	uint	bpp;		/* lookup from palette2fmt[]		*/
	uint	bpl;		/* calc: width * bpp			*/
	ulong	busadr;		/* bus addr for DMA engine		*/
	char*	memadr;		/* kernel addr for making copies	*/
	ulong*	overlay;	/* kernel addr of overlay mask		*/
};

struct zoran
{
	struct video_device video_dev;
#define CARD_DEBUG	KERN_DEBUG "%s(%lu): "
#define CARD_INFO	KERN_INFO "%s(%lu): "
#define CARD_ERR	KERN_ERR "%s(%lu): "
#define CARD		ztv->video_dev.name,ztv->fieldnr

	/* zoran chip specific details */
	struct i2c_bus	i2c;		/* i2c registration data	*/
	struct pci_dev*	dev;		/* ptr to PCI device		*/
	ulong		zoran_adr;	/* bus address of IO memory	*/
	char*		zoran_mem;	/* kernel address of IO memory	*/
	struct tvcard*	card;		/* the cardtype			*/
	uint		norm;		/* 0=PAL, 1=NTSC, 2=SECAM	*/
	uint		tuner_freq;	/* Current freq in kHz		*/
	struct video_picture picture;	/* Current picture params	*/

	/* videocard details */
	uint		swidth;		/* screen width			*/
	uint		sheight;	/* screen height		*/
	uint		depth;		/* depth in bits		*/

	/* State details */
	char*		fbuffer;	/* framebuffers for mmap	*/
	struct vidinfo	overinfo;	/* overlay data			*/
	struct vidinfo	grabinfo[ZORAN_MAX_FBUFFERS];	/* grabbing data*/
	wait_queue_head_t grabq;	/* grabbers queue		*/

	/* VBI details */
	struct video_device vbi_dev;
	struct vidinfo	readinfo[2];	/* VBI data - flip buffers	*/
	wait_queue_head_t vbiq;		/* vbi queue			*/

	/* maintenance data */
	int		have_decoder;	/* did we detect a mux?		*/
	int		have_tuner;	/* did we detect a tuner?	*/
	int		users;		/* howmany video/vbi open?	*/
	int		tuner_type;	/* tuner type, when found	*/
	int		running;	/* are we rolling?		*/
	rwlock_t	lock;
	long		state;		/* what is requested of us?	*/
#define STATE_OVERLAY	0
#define STATE_VBI	1
	struct vidinfo*	workqueue;	/* buffers to grab, head is active */
	ulong		fieldnr;	/* #field, ticked every VSYNC	*/
	ulong		lastfieldnr;	/* #field, ticked every GRAB	*/

	int		vidInterlace;	/* calculated */
	int		vidXshift;	/* calculated */
	uint		vidWidth;	/* calculated */
	uint		vidHeight;	/* calculated */
};

#define zrwrite(dat,adr)    writel((dat),(char *) (ztv->zoran_mem+(adr)))
#define zrread(adr)         readl(ztv->zoran_mem+(adr))

#if PDEBUG == 0
#define zrand(dat,adr)      zrwrite((dat) & zrread(adr), adr)
#define zror(dat,adr)       zrwrite((dat) | zrread(adr), adr)
#define zraor(dat,mask,adr) zrwrite( ((dat)&~(mask)) | ((mask)&zrread(adr)), adr)
#else
#define zrand(dat, adr) \
do { \
	ulong data = (dat) & zrread((adr)); \
	zrwrite(data, (adr)); \
	if (0 != (~(dat) & zrread((adr)))) \
		printk(KERN_DEBUG "zoran: zrand at %d(%d) detected set bits(%x)\n", __LINE__, (adr), (dat)); \
} while(0)

#define zror(dat, adr) \
do { \
	ulong data = (dat) | zrread((adr)); \
	zrwrite(data, (adr)); \
	if ((dat) != ((dat) & zrread(adr))) \
		printk(KERN_DEBUG "zoran: zror at %d(%d) detected unset bits(%x)\n", __LINE__, (adr), (dat)); \
} while(0)

#define zraor(dat, mask, adr) \
do { \
	ulong data; \
	if ((dat) & (mask)) \
		printk(KERN_DEBUG "zoran: zraor at %d(%d) detected bits(%x:%x)\n", __LINE__, (adr), (dat), (mask)); \
	data = ((dat)&~(mask)) | ((mask) & zrread((adr))); \
	zrwrite(data,(adr)); \
	if ( (dat) != (~(mask) & zrread((adr))) ) \
		printk(KERN_DEBUG "zoran: zraor at %d(%d) could not set all bits(%x:%x)\n", __LINE__, (adr), (dat), (mask)); \
} while(0)
#endif

#endif

/* zoran PCI address space */
#define ZORAN_VFEH		0x000	/* Video Front End Horizontal Conf. */
#define	ZORAN_VFEH_HSPOL	(1<<30)
#define	ZORAN_VFEH_HSTART	(0x3FF<<10)
#define	ZORAN_VFEH_HEND		(0x3FF<<0)

#define ZORAN_VFEV		0x004	/* Video Front End Vertical Conf. */
#define	ZORAN_VFEV_VSPOL	(1<<30)
#define	ZORAN_VFEV_VSTART	(0x3FF<<10)
#define	ZORAN_VFEV_VEND		(0x3FF<<0)

#define	ZORAN_VFEC		0x008	/* Video Front End Scaler and Pixel */
#define ZORAN_VFEC_EXTFL	(1<<26)
#define	ZORAN_VFEC_TOPFIELD	(1<<25)
#define	ZORAN_VFEC_VCLKPOL	(1<<24)
#define	ZORAN_VFEC_HFILTER	(7<<21)
#define	ZORAN_VFEC_HFILTER_1	(0<<21)	/* no lumi,    3-tap chromo */
#define	ZORAN_VFEC_HFILTER_2	(1<<21)	/* 3-tap lumi, 3-tap chromo */
#define	ZORAN_VFEC_HFILTER_3	(2<<21)	/* 4-tap lumi, 4-tap chromo */
#define	ZORAN_VFEC_HFILTER_4	(3<<21)	/* 5-tap lumi, 4-tap chromo */
#define	ZORAN_VFEC_HFILTER_5	(4<<21)	/* 4-tap lumi, 4-tap chromo */
#define	ZORAN_VFEC_DUPFLD	(1<<20)
#define	ZORAN_VFEC_HORDCM	(63<<14)
#define	ZORAN_VFEC_VERDCM	(63<<8)
#define	ZORAN_VFEC_DISPMOD	(1<<6)
#define	ZORAN_VFEC_RGB		(3<<3)
#define	ZORAN_VFEC_RGB_YUV422	(0<<3)
#define	ZORAN_VFEC_RGB_RGB888	(1<<3)
#define	ZORAN_VFEC_RGB_RGB565	(2<<3)
#define	ZORAN_VFEC_RGB_RGB555	(3<<3)
#define	ZORAN_VFEC_ERRDIF	(1<<2)
#define	ZORAN_VFEC_PACK24	(1<<1)
#define	ZORAN_VFEC_LE		(1<<0)

#define	ZORAN_VTOP		0x00C	/* Video Display "Top" */

#define	ZORAN_VBOT		0x010	/* Video Display "Bottom" */

#define	ZORAN_VSTR		0x014	/* Video Display Stride */
#define	ZORAN_VSTR_DISPSTRIDE	(0xFFFF<<16)
#define	ZORAN_VSTR_VIDOVF	(1<<8)
#define	ZORAN_VSTR_SNAPSHOT	(1<<1)
#define	ZORAN_VSTR_GRAB		(1<<0)

#define	ZORAN_VDC		0x018	/* Video Display Conf. */
#define	ZORAN_VDC_VIDEN		(1<<31)
#define	ZORAN_VDC_MINPIX	(0x1F<<25)
#define	ZORAN_VDC_TRICOM	(1<<24)
#define	ZORAN_VDC_VIDWINHT	(0x3FF<<12)
#define	ZORAN_VDC_VIDWINWID	(0x3FF<<0)

#define	ZORAN_MTOP		0x01C	/* Masking Map "Top" */

#define	ZORAN_MBOT		0x020	/* Masking Map "Bottom" */

#define	ZORAN_OCR		0x024	/* Overlay Control */
#define	ZORAN_OCR_OVLEN		(1<<15)
#define	ZORAN_OCR_MASKSTRIDE	(0xFF<<0)

#define	ZORAN_PCI		0x028	/* System, PCI and GPP Control */
#define	ZORAN_PCI_SOFTRESET	(1<<24)
#define	ZORAN_PCI_WAITSTATE	(3<<16)
#define	ZORAN_PCI_GENPURDIR	(0xFF<<0)

#define	ZORAN_GUEST		0x02C	/* GuestBus Control */

#define	ZORAN_CSOURCE		0x030	/* Code Source Address */

#define	ZORAN_CTRANS		0x034	/* Code Transfer Control */

#define	ZORAN_CMEM		0x038	/* Code Memory Pointer */

#define	ZORAN_ISR		0x03C	/* Interrupt Status Register */
#define	ZORAN_ISR_CODE		(1<<28)
#define	ZORAN_ISR_GIRQ0		(1<<29)
#define	ZORAN_ISR_GIRQ1		(1<<30)

#define	ZORAN_ICR		0x040	/* Interrupt Control Register */
#define	ZORAN_ICR_EN		(1<<24)
#define	ZORAN_ICR_CODE		(1<<28)
#define	ZORAN_ICR_GIRQ0		(1<<29)
#define	ZORAN_ICR_GIRQ1		(1<<30)

#define	ZORAN_I2C		0x044	/* I2C-Bus */
#define ZORAN_I2C_SCL		(1<<1)
#define ZORAN_I2C_SDA		(1<<0)

#define	ZORAN_POST		0x48	/* PostOffice */
#define	ZORAN_POST_PEN		(1<<25)
#define	ZORAN_POST_TIME		(1<<24)
#define	ZORAN_POST_DIR		(1<<23)
#define	ZORAN_POST_GUESTID	(3<<20)
#define	ZORAN_POST_GUEST	(7<<16)
#define	ZORAN_POST_DATA		(0xFF<<0)

#endif
Loading