3DFX Voodoo3 3500 TV

TV Drivers for the Linux Kernel

Here you will find my works in progress to port the v3tv project to the current I2C API and the V4L2 API.

2.4 kernel

I've retired the old HOWTO for the 2.4 kernel to a back page and updated things for the 2.6 kernel. I don't intend to do any work on the 2.4 kernel, so if for some reason you need to use the 2.4 kernel, you will have to go through the same learning curve I did.

Please read the Installation Guide for i2c and lm_sensors 2.9.1 and let them explain.

ALSA TV-MIXER

snd-tvmixer

The tvmixer is an integral part of the build process, but if you want more information about how it fits in, look here.

GETTING STARTED

In the past getting the V3TV driver to work with the 2.4 kernel required several patches that existed outside of the main kernel. Fortunately these features are built in to the 2.6 kernel, so things are much simpler.

Drift over to the v3tv-v4l2 directory for more details about adding the V3TV driver to the 2.6 kernel.

Think you have a defective card?

If you find yourself with a card that has noise on the audio channel, and possibly a noisy video signal, you may just need to replace the surface mount capacitors.

You should be certain you have a good signal, and all cables are in good condition.

These are the parts that I've used from Digi-Key.com, just plug in the Digi-Key or Panasonic number in the search field, and you will find links to the more detailed information about the parts.

Digikey         Panasonic        Desc
PCE3062CT-ND    ECE-V1CA100SR    CAP 10UF 16V VS ELECT SMD
PCE3182CT-ND    ECE-V1CA101WP    CAP 100UF 16V ELECT VS SMD

Adding a fan to the card

I tinkered with making dual fan assemblies for the card, then I found out that attaching a fan to the heatsink is as trivial as using a #6 machine screw that is a few mm longer than the 40mm fan is deep. First the holes in the fan need to be enlarged to let the #6 screw pass freely, but not too much play, then the fan can be positioned a notch or two off center, and it will be anchored quite sercurly.
Write to Me!

Chage Log

28 February, 2004
My changes to the v4l_voodoo_irq function may not be as effective as I first thought.  On a couple of occasions now the machine has locked up hard.  I'm still working on porting the voodoo-dump module to a printk format that can be called when the irq function dies.  You would probably need to have a serial console configured to see the output.  The kgdb page linked above has some notes on setting this up.

voodoo.c & voodoo.h
Add 'model', 'type', and 'tuner' members to the voodoo struct.

voodoo-i2c.c
Use I2C_HW_B_VOO in favor of I2C_HM_SMBUS_VOODOO3 to identify i2c_adapters.

voodoo-v4l.c
v4l_voodoo_open; move call to TUNER_SET_TYPE to v4l_voodoo_init ,and merge case statement with model detection case.

Comment out call to mute audio.  All audio volume control will be up to the app.

19 February, 2004
I've seen the v4l_voodoo_irq function lock up twice now with the current busy loop in place.     Rather than the machine freezing up completly, the irq is now released, and the Voodoo3 VMI interupt is disabled.  On the first occasion, I unloaded and reloaded all the v3tv related modules, then went back to viewing without incident.  The second time, I did not unload the modules, and the machine froze up when I launched motv.

voodoo-audiochip.h
Use the AUDIO_EXTERN_1|2 parameters to AUDC_SET_INPUT msp3400 io control.

voodoo-v4l.c
VIDIOCGCHAN now correctly reports the tv norm supported by the card based on the PCI ID.

Gerd has replied to my questions about the VIDIOCSCHAN io control, and I think this should be the last major change here.  We now use the parameters AUDIO_EXTERN_2 and AUDIO_TUNER to the AUDC_SET_INPUT io control for the msp3400.

16 February, 2004
The most significant change is that I now use a constant sized video input field, calculated when the tv standard is selected.  This removes the need for the non-standard ioctl for the vpx3224, DECODER_SET_WINDOW.  Since it seems none of the other pixel decoders use the decimation feature, I've decided not to go forward with it.  The voodoo3_update_overlay_setup function already has the ability to configure the Voodoo3 to do all scaling.

voodoo.c
Optimized while loop around pci_find_dev function.

voodoo.h
Added variables from voodoo3_overlay_setup to struct voodoo_data.
voodoo3_set_overlay passes no args.

voodoo-overlay.c
Changed x and y values of 'struct video_capture video_standard' to zeros.  We can establish these crop values in vpx3224.  I need PAL and SECAM users to experiment with these.  They might be good to have as module options.  I need to see what other pixel decoder drivers do.

Moved some of the local variables in voodoo3_update_overlay_setup to voodoo_data.  Moved the two 'if' statements that calculate magnification/decimation to the new function voodoo3_calc_scale.  The values for voodoo->vidOrig[Width|Height] will always come from the video_standard array.  voodoo->overlay[Width|Height] will reflect the values given by the app.

voodoo3_set_overlay is much simplified, since the vpx3224 no longer does decimation.  It just copies the values from the app to the voodoo_data struct variables used by voodoo3_update_overlay_setup.  Some of these voodoo_data variables may be redundant.

Some of the inital values used by voodoo3_overlay_setup are now assigned in v4l_voodoo_init.  voodoo3_overlay_setup is now called any time the tv standard is changed, to recalculate the captureBuf and vidInAddr registers.

voodoo-v4l.c
Radical changes to the v4l_voodoo_irq function.  Your at my mercy as I try to find a way to recover from whatever it is that causes the Voodoo3 to freeze up.

More changes to the VIDIOCSCHAN ioctl.  After some disscussion with Gerd Knorr, I'm going to try using the msp3400's AUDC_SET_INPUT command to select the external audio input from the pod.    VIDIOCSCHAN will be called first to inform the msp3400 what tv standard is being used.  You will need to apply more patches to the msp3400.c and audiochip.h files.

The ioctl's VIDIOCGAUDIO and VIDIOCSAUDIO were not doing the copy_[to|from]_user.

voodoo-audiochip.h ( linux/drivers/media/video/audiochip.h )
Add two defines to support selecting audio input source on msp3400.

vpx3224.c
The vpx3224 module will no longer do decimation ( scaling ) so the ioctl DECODER_SET_WINDOW is no longer needed.  The video_decoder.diff will not be needed.


10 February, 2004
Let's call this update "V3TV-Light!"

I've stripped the I2C adapter code from the v3tv module, making it that much lighter, and utilizing the kernel module i2c-voodoo3.o.  For the moment, I've set up a compile time option to include or exclude the i2c adapter code.  As distributed, the v3tv/Makefile is set to exclude the i2c adapter.  Uncomment the INCLUDE_I2C variable if you want to build with the v3tv i2c adapter?  I've also set the other EXCLUDE options to not build the various voodoo-xxx modules now available in the kernel to make building quicker.

I've also expaned the patch against the msp3400 module to change the audio input source to the rca jacks on the pod when you select Composite or S-VGA input.  It's in the kernel-diffs directory as msp3400.i2c.diff.

I went through and made all of the printk statements write "v3tv:" rather than "voodoo:" or nothing at all in some cases.  This is a prelude to posibly renaming all of the functions "v3tv_xxx_yyy()"

voodoo.h
Added "struct i2c_adapter *voodoo_i2c_adapter" to voodoo structure.

Cleaned up list of functions with global prototypes.

voodoo.c
Significant changes related to removing the i2c adapter code.  The adapter is not really gone, just made optional at compile time.  The only thing left here related to i2c are two calls to the new function voodoo3_i2c_setup that either enables or disables the i2c interface.

Removed some other cruft related to older kernels.

voodoo-i2c.c
Everything above the function voodoo3_get_adapter is excluded if INCLUDE_I2C is not defined.

The new function voodoo3_get_adapter finds the i2c-voodoo3.o i2c bus.

The procedures in the new function voodoo3_i2c_setup is dependent on if INCLUDE_I2C is defined when compiled.  If INCLUDE_I2C is defined it does what it always did to add or delete the i2c and ddc busses.  Otherwise it installs a dummy i2c driver.

The procedures in the voodoo3_call_i2c_client are also dependent on if INCLUDE_I2C is defined when compiled.  If INCLUDE_I2C is defined it does what it always did to call the clients. Otherwise it calls them in a similar manner, using the i2c-voodoo3 i2c_adapter it got earlier.

voodoo-v4l.c
Moved the v4l_voodoo_irq function here, with it's attendant global variables and the new function v4l_irq_printk. 

Added the new function v4l_set_palette to examine the dstFormat register and set picture_settings->palette and depth accordingly.

Added a procedure to v4l_voodoo_open that sets the tuner type, only if INCLUDE_I2C is defined when compiled.

Added a call to v4l_set_palette in v4l_voodoo_open so that palette and depth will be correct durring subsequent calls to DECODER_SET_PALETTE and voodoo3_capture_frame will have correct values.  This is the intent, but action is yet to be taken.

Optimized the VIDIOCCAPTURE ioctl somewhat.

voodoo-capture.c
Reworked the busy loop in the voodoo3_MakeRoom function use a while loop.

Added a call to the new function v4l_set_palette an effort to set the overlay palette correctly.  This may be unneeded, and is not fully implemented yet.  I'm thinking it wil be needed when frame grabbing is done.

Moved v4l_voodoo_irq function to voodoo-v4l.c.  I we worked the busy loop to use a while loop, and hopefully not lock the machine down hard.  Yet to see it in action.

voodoo-overlay.c
Moved the struct video_capture video_standard to the top so it can be used in more places.

Made voodoo3_overlay_setup use the video_standard struct to get values for calculating the video in memory buffers.  This should also come in handy when frame grabbing is implemented.

At some point it will be usefull to know the pixel depth, so the dstFormat register is examined, but no real use is made of it yet.

3 February, 2004
voodoo.h
Add 'struct video_buffer' to, and remove 'int palette' from voodoo_data.  Use voodoo_data->video_window->palette.

voodoo-capture.c
Add debug printk statements to IRQ function.  Something goes wrong with the Voodoo3 chip, and v4l_voodoo_irq loops forever.

voodoo-overlay.c
Add a few debug statements.

voodoo-tuner.h
#define TUNER_SAMSUNG_PAL      32 - to be compatible with kernel tuner.h.

voodoo-v4l.c
Use voodoo->fb and voodoo->capture_win.  Fix argument passing to VIDIOCSPICT that I broke.


24 January, 2004
It is possible to use the kernel versiones of tvmixer and tuner.  They need to be patched with the diffs in here.  To get them to compile, apply the patches, and add the vpx3224 module as well.

voodoo-audiochip.h
Removed defines for MIN and MAX, and added type casts to min/max statements in voodoo-msp3400.c.

voodoo-i2c.c
A little work on voodoo_call_i2c_client's printk statement, and changed assigment statements in i2c_adapter and i2c_algo_bit_data structures.

voodoo-mixer.c
Removed some dead code and other clean up.  Changed MIN and MAX to min/max, with type casting as needed.  Replaced tvmixer_llseek with no_llseek.  Included i2c-compat.h.

voodoo-msp3400.c
Changed MIN and MAX to min/max, with type casting as needed.

21 January, 2004
There are two significant changes that have taken place.  The first is no longer being dependent on i2c_get_client.  I looked at i2c-compat.h again, and something clicked when I took a momnet to understand the i2c_clients_command function.  I had seen some thing similar in the voodoo source, and sure enough, we have voodoo_call_i2c_client in voodoo-i2c.c.  Removing the i2c_get_client calls means we don't have access to the client structure, so the printk's that accompanied them were no longer relevant.  This reduced each function in voodoo-func.c that called i2c_get_client to just 2 or four calls to voodoo_call_i2c_client.  I opted to move the calls to voodoo_call_i2c_client to the functions that call into voodoo-func.c.  I added a printk to voodoo_call_i2c_client that will identify any i2c client that is not available.

I then looked at the functions in voodoo-func.c that called the voodoo3_conf function.  They were one liners, or a single conditional to enable or disable a feature.  I chose to move these to the calling functions as well.

That only left voodoo3_print_status, which is only used by vdebug.c.  I've chosen not to get involved with the vdebug.c, and related files.  They will not be updated, and will definitly be broken.  If write access to the registers is needed, I'll add a proc/sys/dev/sensors directory like I've started to do for the vpx3224 module.

Inlcuding i2c-compat.h also provides i2c_get_clientdata, which is only in the 260 kernel.  this eliminates some preprocessor conditionals.

voodoo.c
The voodoo3_initial_setup call is replaced with the voodoo3_init_reg[] structure and a call to voodoo_3_conf.

voodoo-i2c.c
Added a printk statment to identify any i2c client that was not found.

voodoo-overlay.c
Added include statements for slab.h and video_decoder.h to support functions moved from voodoo-func.c.
Rearanged some things around the calls to voodoo3_conf.

voodoo-v4l.c
Added include statement for video_decoder.h to support calls to  voodoo_call_i2c_client.
Moved video_device structures toward the bottom of the file closer to v4l_voodoo_init and v4l_voodoo_cleanup.

voodoo-msp3400.c
Removed conditinals around i2c_get_clientdata.

vpx322x.c
DECODER_GET_STATUS:  Added code from vpx3224 module to support things I'm trying to do in other places.
Replaced init_module and cleanup_module with module_init and module_exit.

vpx322x-i2c.c
Moved miscelaneous fuctions from v-util.c.

17 January, 2004

I've spent the last couple of weeks working on a new vpx3224 module.  It combines the best features of the vpx322x we all know and love, and the structure and methods of the vpx3220 module found in the 2.6.0 kernel, plus a few features from other places.

Many changes have been made since christmas... Where to begin?

The file video_decoder.diff needs to be applied.  This one liner removes the dependency between v3tv and vpx322x.

Added i2c-compat.h to eliminate some of the conditional compile statements.

voodoo.c
include i2c-compat.h in anticipation of further revisions.

voodoo-func.c
include slab.c for memory management.
create function voodoo3_enable_output to call DECODER_ENABLE_OUTPUT.
moved voodoo3_set_overlay from voodoo-overlay.c to voodoo-func.c since it now calls DECODER_SET_WINDOW.  No more dependency on vpx322x.c.

voodoo-mixer.c
comment out MOD_INC|DEC_USE_COUNT.  Need to figure out where to put them.

voodoo-msp3400.c
comment out MOD_INC|DEC_USE_COUNT.  Need to figure out where to put them.

voodoo-overlay.c
removed voodoo3_set_overlay to voodoo-func.c, and eliminated dependency on vpx322x.c.

voodoo-v4l.c
many readablilty changes.
removed struct file_operations radio_fops, and added v4l_voodoo_radio->open = v4l_radio_open.
removed seemingly redundant calls to voodoo3_set_overlay.

vpx3224-i2c.c
simplified conditional compile option for vpx322x_detect function header.
added try_module_get and module_put conditional statements.
added some clever printk statements, making the module very noisey.
included linux/byteorder/swab.h, to simplify the FP read/write functions.
reworked the FP read/write functions, making them noisey.

vpx3224.c
remove conditionals around i2c_get_clientdata.
fix DECODER_ENABLE_OUTPUT so it toggles R_oena on or off.
make DECODER_SET_WINDOW use videodev struct video_capture *window to pass capture window parameters.  Sent one line patch to Alan Cox to add DECODER_SET_WINDOW to video_decoder.h.


25 December, 2003 - Merry Christmas!
My sisters computer went Fitz, so with the stores closed, I've sacrificed my computer with the STB TV-PCI card, yielding a supposedly functioning power supply. Turns out the PS fan has failed, so I'll be buying two PS before the year is out. The up shot of this is that I can't do any further testing of tv-out for now. I'd gotten as far as the static patterns changing when I tinkered with the settings in /proc/sys/dev/sensors/bt869*/

voodoo-mixer.c
Following Frank's guide again, I've added/modified as appropriate, and commented out those new sections that are as yet not implemented. The module compiles and loads clean. Testing shall have to wait for v3tv.o to be ready. Some parts of the attach function, tvmixer_adapters, that are commented out should be implemented sooner rather than later. It appears to me that the detach function, tvmixer_clients, actually does more than just detach, and evaluates-performs some commands. I haven't yet grokked how this distinction is made. Maybe I'm reading more into it than really exists.

voodoo-tuner.c
Thank you Lars Munch! I made only a few trivial changes. Removed the deprecated 'default:' label at the end of the tuner_command() case structure. Added decoder statements to tuner_attach(). They are commented out until I understand the correct usage. Changed the i2c_drive struct from a coma separated list to a 'label: value,' structure. Gave the i2c_driver driver structure a more explicit name. Gave the i2c_client structure a name. Added MODULE_LICENSE("GPL"); to silence modprobe.

voodoo-msp3400.c
Again, thanks go to to Lars. I made similar trivial changes as with the tuner.

v3tv.o: Seven files to tinker with to get v3tv.o
voodoo.c : no significant change
voodoo-i2c.c : Removed voodoo3_inc/dec in
voodoo3_i2c/ddc_adapter struct's,
and rewite to use 'label: value,' form.
This has less than I expected,
so I've done less.
voodoo-func.c : This is all high level stuff.
voodoo-util.c : PCI regs and Memory management
voodoo-overlay.c : No i2c struct or funct defined.
voodoo-capture.c : No i2c struct or funct defined.
voodoo-v4l.c : No i2c struct or funct defined.

Everything builds clean, except for 4 warnings that have been there for the longest time. I'll comment out the relevent sections, as they are all 'defined but not used' messages.

I'm happy to say that it WORKS!! Just as it always has! xawtv still blanks when the mouse cursor moves between various windows. It is so good to have sensors and TV at the same time!

23 December, 2003
voodoo-dump.c and vdebug.c
Both of these modules compile and install with out modification. I did add MODULE_LICENSE("GPL"); to them, to silence the complaint by modprobe about a tainted kernel.

I wrote a few small scripts that grep /proc/voodoo-dump for the relevant sections. They can be found in the scripts directory. I put them in ~/bin on my system. I'll add one to make it simple to change the bt869 proc entries as well.

21 December, 2003
voodoo-bt869.c / bt869.c copied from lm_sensors
I'm going to try bt869.c from lm_sensors 2.8.1. The practical approach is to include bt869 in the kernel config. There is some discussion in the archives that voodoo-i2c will conflict with lm_sensors. We shall see.

It seems I can't do any thing to test the bt869 module with out i2c-voodoo from lm_sensors, or the v3tv module, which links the voodoo-i2c.o object file. I'll have to patch the kernel with lm_sensors before I can further test with i2c-voodoo3.

I've made some changes to voodoo-bt869.c to bring it in line with I2C 2.8.1. I'll also test with this module and lm_sensors i2c-voodoo3.

20 December, 2003
vpx322x-i2c.c
Following Frank's guide, I've added a few sections, and modified some things. I think I've covered all the bases. The module compiles cleanly and inserts without compliant. If there were an easy way to test it...

Some of the other modules I've looked at as references use the struct i2c_client and client_template. I saw no simple way or any immediate reason to try to implement this feature at this time.

voodoo-i2c.c no longer refrences voodoo.c functions voodoo3_{inc|dec}. The module v3tv is no longer having its use count updated!

OLD NEWS:

My main reference for this work has been Frank Davis document I2C Conversion Guide for I2C-old to the current I2C API.

So the changes for linux-2.6.0, with the exception of voodoo-4vl.c, were not that difficult. I've put in lots of conditional clauses to make it compile on 260. I can't test it since v4l is not done. It does compile, load and run on 2.4.23 after this round of changes! Module usage count may be an issue. I seems that in some cases v3tv.o needs to removed first.

One item that has been left out entirely is 'struct semaphore lock;' in the driver structure or some methode o. The exception is bt869 and msp3400, which were done by the lm_sensors people. I'll study this implementation, and see if I can spread it around a bit more. First I need to research just what the lock is for...

A key issue I have concerns licensing of this package. I have sent inquiries to the previous maintainers, many messages bounced, but some responses have been recieved.  I've been given cvs access!

I'm assuming that the intent is to place all of the work under the GPL.

I've heard from Joergen Pihlflyckt, and he indicates that the v3tv code is based on GPL'd code, so expect proper GPL statements in the future.

The only files with license statements are those borrowed from other sources. voodoo-bt868.c is from lm_sensors. There has been some discussion, found in the archives, to re-integrate this module with the lm_sensors project. The second is voodoo-tuner, which comes from the kernel, and should also be ported back if v3tv ever gets included in the kernel.

How's this for frustrating? I fetched the v4l2 patch videodevX, for the 2.4 kernel from thedirks.org and applied it to my 2.4.23 kernel. Well, it breaks the existing videodev, or it is broken, I didn't even try to figure it out yet. So I'm thinking about doing the v4l2 work against the 2.6 kernel, and having a new make target for v4l2. This is easy enough, you just fiddle with the symlink /usr/src/linux to switch between kernel trees.