You are on page 1of 3

SAA7130 TV tuner card under Linux.

 
How To.  
saa7130 in Linux              Jobin Augustine

I thought of writing this page because lot of people are facing problems in installing with their TV tuner cards based 
on Philips chip saa7130.
it took me almost 2 ­3 months search to get it  working perfectly.
Primarily because i was using a old Linux kernel  which got driver with less card support

We should remember that the module saa7134 is written in a generic way. so that it will work with saa7130 also.
I should say saa7130 is a scale ­down version of saa7134. 
Please make sure that you got  tvtime  installed in your system before doing anything.
because i feel this is the user friendly  application for doing all the experiments.
when we are  fighting with hadware problem we cannot concentrate on application issues.

Understanding your card ‑ the hardware. 
Normally a TV tuner card can be divided into 2 section. the Video decoder and the Tuner. In this article i am 
concentrating on decoder with PHILIPS SAA7130 chip. using lspci and dmesg make sure that card got a Philips 
SAA7130 chip. its very easy to find out even you can directly look at the tuner card. But its not that simple to identify 
the tuner. in most cards i found that the manufactures buts big sticker on the tuner. since tuner sits inside a metalic 
box case, it is the right place to put the sticker :). either you can remove the sticker to findout the exact make: The 
model number.  other option is the ugly solution the card manufacuter might have given a windows driver CD. install 
the card in windows. then you can get the driver details from the windows driver. I done it both the ways to confim 
that what i know is correct. :)

Loading Kernel Module ‑ saa7134 
all recent kernels comes with generic Loadable Kernel  Modules (LKM) for SAA713* chips 
(SAA7130,SAA7133,SAA7134 etc).
this module is called saa7134. there are other submodules (dependancy) like saa7134_alsa, saa7134_dvb, tuner etc.
You can load a module like: 

modprob saa7134 card=3

But many times your system will be already loaded this  module to kernel with wrong parameters, so you need to 
remove the existing  module if any like

rmmod saa7134_alsa saa7134_dvb saa7134

after this you can load the module with right parameters. once you can load the module with correct parameters like 
card  and tuner , your card  should be working fine. To get a complete list of parameter a module can accept  use the 
modinfo command

>modinfo [option] saa7134

­d, which displays a brief description of the module,  and ­p, which lists the parameters the module supports

now you can load the module like

modprobe saa7134 card=116

if you are using a Mandrake linux or PcLinuxOs the you have a GUI to do so (HardDrake). but this is not important.

after seeting this values in modeprobe.conf, just load  the module.

>modeprobe saa7134 

Identifying the card 
I experimented with different values for card. in the card list, you can select any card with saa7130 to get the video. 
for example  3,10,21,42 etc should work fine for card.  , 

Other than this trial and error method, there is an alternate way. by looking in to Kernel source. Either you can 
download the full source from kernel.org or you can browse though the source online using sites  like: 
http://linux.sourcearchive.com/documentation/2.6.27 ­9.18/saa7134 ­cards_8c ­source.html  

As per kernel version 2.6.27 following are the list of cards coming with SAA7130 chips. card number is given after 
"=" sign 

SAA7134_BOARD_FLYVIDEO2000 = 3
SAA7134_BOARD_KWORLD = 10
SAA7134_BOARD_ELSA = 14
SAA7134_BOARD_ELSA_500TV = 15
SAA7134_BOARD_CRONOS_PLUS = 20
SAA7134_BOARD_10MOONSTVMASTER =21
SAA7134_BOARD_TG3000TV = 29
SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER = 33
SAA7134_BOARD_AVERMEDIA_STUDIO_305 = 35
SAA7134_BOARD_CINERGY200 = 38
SAA7134_BOARD_VIDEOMATE_TV_PVR = 40
SAA7134_BOARD_SABRENT_SBTTVFM = 42
SAA7134_BOARD_AVERMEDIA_305 = 52
SAA7134_BOARD_PHILIPS_TOUGH = 61
SAA7134_BOARD_VIDEOMATE_DVBT_200 = 71
SAA7134_BOARD_ELSA_700TV = 89
SAA7134_BOARD_PROTEUS_2309 = 98
SAA7134_BOARD_ENCORE_ENLTV = 106
SAA7134_BOARD_ENCORE_ENLTV_FM = 107
SAA7134_BOARD_10MOONSTVMASTER3 = 116
SAA7134_BOARD_BEHOLD_401 = 118 
SAA7134_BOARD_BEHOLD_405 = 121
SAA7134_BOARD_BEHOLD_405FM = 122
SAA7134_BOARD_BEHOLD_505FM = 126

New versions of kernels adds more and more cards to this  list.

Identifying the Tuner
Here one thing we need to remember the driver saa7134 is written such a way that
Each card got associated tuner spec also. (the default tuner for each card)
If you have default tuner, you may not required to override this by specifing like  t u n e r   =   3 7  
For getting a sutable value for tuner also 2 methods the trial and error and systematicaly looking at the source code
By trial and error i am able to find out that  values like 37,55  are working fine for me.
if you want to look in to he source code, here is the method.
first we need to look the place where linux is identifing the card and the tuner
this file is located in /drivers/media/video/tveeprom.c of the source tree
alternatively :  http://www.gelato.unsw.edu.au/lxr/source/drivers/media/video/tveeprom.c  
here most of the tuners are listed. for example, i have "TCL 2002MB 3" tuner.
in this file we can find that the tuner is pointing to TUNER_LG_PAL_NEW_TAPC
which is defined in source/include/media/tuner.h
alternatively you can look at  http://www.gelato.unsw.edu.au/lxr/source/include/media/tuner.h  
where you we can see that this tuner is identified as number 37.
which perfetly matches my trial and error experiment
How to set the parameter values?
well. just open /etc/modprobe.conf and place the line ( if it is ubuntu or debian based distribution the file will 
be /etc/modprobe.d/options 
options saa7134 card=3 tuner=55 
in ubuntu, the file name is: /etc/modprobe.d/options or in  ubuntu you can directly load the options when you are 
loading the module like:
modprobe saa7134 card=3 tuner=55 gbuffers=4

before this, you may have to  remove the already loaded modules like:
rmmod saa7134_alsa
rmmod saa7134

Using TVTime.
 once the you laoded the module, now you can connect the cable to the tv tuner card. and scan for channels.

>tvtime­scanner

now all channels will be scanned and stored in the stationlist.xml file.

at this point you should be able to use the TVTime application.
>tvtime 

saa7130 video
You will not see any problem in getting video output from the card. because the video section is same for almost all 
saa713x chips / cards. 

saa7130 audio / sound
Many times audio is the difficult part to get working. But the funniest fact is that SAA7430 is not doing any audio 
processing.
Infact that is the major differece between SAA7130 and its siblings like SAA7133,SAA7134,SAA7135 etc.
i think its worth to understand why audio is not working.
This chip just allows the audio to pass though the chip untoched.
So what could be blocking the sound?
I had to go though the datasheets provided by Philips to understand some facts,
So this chip do not have the feature to place the audio to system bus (like PCI). it just allows the sound to 
passthough (analog) and that will be availble on the card (audio out). 
So SAA7130 tuner cards will ship with a 2 end connector to connect its audio out to your line ­in.
we need to connect that audio­out to line­in of the sound card to get the sound to system.

so the end result is: modules like saa7134_alsa or saa7134_oss are not requied and will not work for 
saa7130 cards
I know lot of people still fighting with ALSA tools like  arecrod  to get the sound from this card. They may get read 
errors from the device. 
So you need not  go behind arecord  or sox. 
because your TV sound is not there. and you are looking for something does not exists :)

Before starting any experiments, please connect your speaker/aplifier input to audio ­out of the tv­tuner card bord 
directly.
The best way is to directly plug your headphone to the tuner card.
this is to ensure that the sound is not muted inside the sysetem.
if you connected to amplifier please keep the volume very less otherwise you may loose your ear drum once you 
rectify the audio problems. :)

You may find that by default TV sound is muted. why so?
here is the answer. That is because of the default behavior of SAA7130 chip. it should be like that
because SAA7130 relies on loop back cable to your sound card. so you are loosing your line­in port for other 
purposes
to address this problem SAA7130 accepts 2 audio in connections (both sterio). one set of pins for TV audio from the 
Tuner / IF section.
another is to provide line ­in fuctionality. 
SAA7130 allows you to connect your actual line ­in requiremnts like input from your cassete player
many TV cards do not have line ­in ports. but the chip sitting in the card provides that feature. sounds nonsence 
right?.
So by default SAA7130 connects it line­in input to its passthough output. and TV sound is disconnected.
Now let me tell you the problem you need to rectify. we need to initalize the card with right flags in place to connect 
its tv audio to its passthough output

So I started my efforts to findout a suitable card number, which can put my cards internal switch to pass the audio 
from TV to passthough output
it was a furstrating brute force method and spend long hours...many times ended with system reboots..
many times got noice with very low audio in the backgroud...
finally i arived at a card number which can put the right switch for audio. Now i am getting a very clear audio out!  

You might also like