ALSA tvmixer
ALSA
snd-tvmixer
Name Last modified Size Description
Parent Directory -
i2c-compat.h 12-Jun-2005 14:01 1.0K
tvmixer-2615-2616.patch 10-May-2006 13:43 943
tvmixer.102c.c 12-Jun-2005 14:01 12K
tvmixer.102c.patch 12-Jun-2005 14:01 3.0K
tvmixer.104.c 12-Jun-2005 14:01 13K
tvmixer.104.patch 12-Jun-2005 14:01 801
tvmixer.26x.c 12-Jun-2005 14:01 14K
tvmixer.26x.patch 12-Jun-2005 14:01 1.0K
tvmixer.cvs.c 12-Jun-2005 14:01 14K
tvmixer.dif 12-Jun-2005 14:01 17K
tvmixer.no_magic.diff 12-Jun-2005 14:01 1.3K
tvmixer2615.patch.bz2 09-Mar-2006 15:37 4.2K
ALSA tvmixer
When I was insipred to try out the ALSA snd drivers, I was faced with
an incomplete migration, due to the lack of an ALSA tvmixer mixer
device. I've cobled together what I think is a fully functional
snd-tvmixer, with
volume, bass and treble.
To get this far, I took Gerd Knorr's tvmixer, and spliced in the ALSA
functions needed to create the 'chip,' 'card' and 'ctrl' structures
that the snd core uses, and created the functions that the 'ctrl'
structures refer to.
This is all based on Takashi Iwai's
Writing an ALSA Driver document.
I'll be refering to other documents at the
ALSA 0.9.x Developer documentation page as I work on more features.
AlsaOpensrcOrg
has good information on setting up ALSA on your system on the Quick
Install page.
I have patches against several kernel releases. It is a moving target, so
your mileage may vary.
I now have support for the 1.0.2c and 1.0.4 releases of alsa-driver
to be used with the 2.4 kernels, and the 2.6 kernel which has ALSA
in it already. Things are a little different for each, so read
carefully!
Adding snd-tvmixer to the kernel
The patches I've be prepared for the 2.6.10 and newer kernels can be
found at the v3tv-v4l2 page. You do
not need to do any thing here.
linux-2.6.16 kernel
First apply tvmixer2615.patch.bz2, then
tvmixer-2615-2616.patch to catch up with the moving target.
Compile the kernel as usual. 'make oldconfig', 'make' and 'make
modules_install' might be all that is needed.
linux-2.6.15 kernel
Apply tvmixer2615.patch.bz2
Compile the kernel as usual. 'make oldconfig', 'make' and 'make
modules_install' might be all that is needed.
linux-2.6 kernel
Copy tvmixer.26x.c to
linux-2.6.X
/sound/drivers/tvmixer.c
With kernel releases 2.6.6 and earlier, only appy tvmixer.26x.patch to
update
Kconfig and Makefile in the linux/sound/drivers/ directory.
I have not prepared patches for kernels from 2.6.7 to 2.6.9.
At some point the snd_magic_* stuff has been removed from ALSA.
If you are keeping up with the latest, apply tvmixer.no_magic.diff.
Compile the kernel as usual. 'make oldconfig' and 'make' might be
all that is needed. Now install the modules and bzImage, and
reboot.
Adding snd-tvmixer to your local copy of cvs
alsa-driver-1.0.2c
Copy the tvmixer.102c.c file to
alsa-driver-1.0.2c/i2c/tvmixer.c
Apply the patch tvmixer.102c.patch to add support for the tvmixer to the
Makfile and Modules.dep files. (i2c-compat.h is in the patch)
alsa-driver-1.0.4
Copy the tvmixer.104.c file to
alsa-driver-1.0.4/drivers/tvmixer.c
Copy the i2c-compat.h file to
alsa-driver-1.0.4/drivers/i2c-compat.h
Apply the patch tvmixer.104.patch to add support for the tvmixer to the
Makfile and Kconfig files.
ALSA: CVS repository
Follow the directions for Anonymous CVS
Access, and checkout 'alsa-driver'
Apply the tvmixer.dif patch ( from alsa-driver's parent directory )
patch -p0 < tvmixer.dif
The first time you apply the
patch, you run cvscompile (even if you're using a snapshot) not
configure! Later, you can re-run configure to change options.
Run cvscompile, giving it any configure options you would use, and adding
'tvmixer' to the --with-cards option.
./cvscompile --with-cards=tvmixer, _your_card_here_
This will rebuild some of the config files, then pass your args to configure.
Now do make and install, and your almost there!
Configuring Modules
I've included notes on /etc/modules.conf in the
old V3TV HOWTO for the 2.4 kernels, and with the notes for the 2.6 kernel.
The main issue is identifying what ALSA mixer control the OSS 'VOLUME'
control is going to affect. The document
Notes on
Kernel OSS-Emulation has a few pointers on the 'echo' statement
needed to get OSS apps to talk to the ALSA tvmixer.
Whats going on in [snd-]tvmixer.c?
We have the standard ALSA snd module paramaters, including 'index'
which replaces 'iminor' for indicating the /dev/mixerN postion of the particular audio
chip refrenced.
The TVMIXER struct is now snd_tvmixer. Each tvmixer is
dynamically alocated by snd_device_new in snd_tvmixer_create. The
array mixers[] holds a pointer to each tvmixer.
I think it would be good to have mixers as a linked list, then the
'slot'
counter would not be needed.
The various snd_tvmixer_volume_xxx, snd_tvmixer_mute_xxx and
snd_tvmixer_bass_treble_xxx
handle the real work of changing mixer settings.
The snd_tvmixer_build function adds the mixer controls to the
tvmixer->snd_card structure.
snd_tvmixer_dev_free is the snd_device call back to rlease the tvmixer
memory allocation.
snd_tvmixer_create allocates a tvmixer struct with snd_magic_kcalloc.
The function snd_tvmixer_adapters evaluates each i2c adapter to see if
it is a video capture card, and calls snd_tvmixer_clients for each
client present.
In snd_tvmixer_clients, we first check to see if the i2c_client is
already known, in which case it is freed.
If it is not known,
then we check that mixers[] is not full. Then we need to see if
the i2c_client has a command function. Next we try to get
the audio chip's properties.
Now comes the
ALSA specific setup. We get a snd_card with snd_card_new,
and call snd_tvmixer_create to get a tvmixer allocated. After
assigning a few name strings, the mixer controls are registered by
snd_tvmixer_build.
Finally we see if it all works with a call to
snd_card_register. On success we add the new tvmixer to mixers[],
increment the cards counter, then print a happy
message to the syslog.
The rest is the usual i2c module init and exit routines.
mailto:perrye@linuxmail.org