Merge branch 'for-greg' of git://gitorious.org/usb/usb into usb-linus
[pandora-kernel.git] / Documentation / video4linux / bttv / Sound-FAQ
1
2 bttv and sound mini howto
3 =========================
4
5 There are a lot of different bt848/849/878/879 based boards available.
6 Making video work often is not a big deal, because this is handled
7 completely by the bt8xx chip, which is common on all boards.  But
8 sound is handled in slightly different ways on each board.
9
10 To handle the grabber boards correctly, there is a array tvcards[] in
11 bttv-cards.c, which holds the information required for each board.
12 Sound will work only, if the correct entry is used (for video it often
13 makes no difference).  The bttv driver prints a line to the kernel
14 log, telling which card type is used.  Like this one:
15
16         bttv0: model: BT848(Hauppauge old) [autodetected]
17
18 You should verify this is correct.  If it isn't, you have to pass the
19 correct board type as insmod argument, "insmod bttv card=2" for
20 example.  The file CARDLIST has a list of valid arguments for card.
21 If your card isn't listed there, you might check the source code for
22 new entries which are not listed yet.  If there isn't one for your
23 card, you can check if one of the existing entries does work for you
24 (just trial and error...).
25
26 Some boards have an extra processor for sound to do stereo decoding
27 and other nice features.  The msp34xx chips are used by Hauppauge for
28 example.  If your board has one, you might have to load a helper
29 module like msp3400.o to make sound work.  If there isn't one for the
30 chip used on your board:  Bad luck.  Start writing a new one.  Well,
31 you might want to check the video4linux mailing list archive first...
32
33 Of course you need a correctly installed soundcard unless you have the
34 speakers connected directly to the grabber board.  Hint: check the
35 mixer settings too.  ALSA for example has everything muted by default.
36
37
38 How sound works in detail
39 =========================
40
41 Still doesn't work?  Looks like some driver hacking is required.
42 Below is a do-it-yourself description for you.
43
44 The bt8xx chips have 32 general purpose pins, and registers to control
45 these pins.  One register is the output enable register
46 (BT848_GPIO_OUT_EN), it says which pins are actively driven by the
47 bt848 chip.  Another one is the data register (BT848_GPIO_DATA), where
48 you can get/set the status if these pins.  They can be used for input
49 and output.
50
51 Most grabber board vendors use these pins to control an external chip
52 which does the sound routing.  But every board is a little different.
53 These pins are also used by some companies to drive remote control
54 receiver chips.  Some boards use the i2c bus instead of the gpio pins
55 to connect the mux chip.
56
57 As mentioned above, there is a array which holds the required
58 informations for each known board.  You basically have to create a new
59 line for your board.  The important fields are these two:
60
61 struct tvcard
62 {
63         [ ... ]
64         u32 gpiomask;
65         u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */
66 };
67
68 gpiomask specifies which pins are used to control the audio mux chip.
69 The corresponding bits in the output enable register
70 (BT848_GPIO_OUT_EN) will be set as these pins must be driven by the
71 bt848 chip.
72
73 The audiomux[] array holds the data values for the different inputs
74 (i.e. which pins must be high/low for tuner/mute/...).  This will be
75 written to the data register (BT848_GPIO_DATA) to switch the audio
76 mux.
77
78
79 What you have to do is figure out the correct values for gpiomask and
80 the audiomux array.  If you have Windows and the drivers four your
81 card installed, you might to check out if you can read these registers
82 values used by the windows driver.  A tool to do this is available
83 from ftp://telepresence.dmem.strath.ac.uk/pub/bt848/winutil, but it
84 does'nt work with bt878 boards according to some reports I received.
85 Another one with bt878 suport is available from
86 http://btwincap.sourceforge.net/Files/btspy2.00.zip
87
88 You might also dig around in the *.ini files of the Windows applications.
89 You can have a look at the board to see which of the gpio pins are
90 connected at all and then start trial-and-error ...
91
92
93 Starting with release 0.7.41 bttv has a number of insmod options to
94 make the gpio debugging easier:
95
96 bttv_gpio=0/1           enable/disable gpio debug messages
97 gpiomask=n              set the gpiomask value
98 audiomux=i,j,...        set the values of the audiomux array
99 audioall=a              set the values of the audiomux array (one
100                         value for all array elements, useful to check
101                         out which effect the particular value has).
102
103 The messages printed with bttv_gpio=1 look like this:
104
105         bttv0: gpio: en=00000027, out=00000024 in=00ffffd8 [audio: off]
106
107 en  =   output _en_able register (BT848_GPIO_OUT_EN)
108 out =   _out_put bits of the data register (BT848_GPIO_DATA),
109         i.e. BT848_GPIO_DATA & BT848_GPIO_OUT_EN
110 in  =   _in_put bits of the data register,
111         i.e. BT848_GPIO_DATA & ~BT848_GPIO_OUT_EN
112
113
114
115 Other elements of the tvcards array
116 ===================================
117
118 If you are trying to make a new card work you might find it useful to
119 know what the other elements in the tvcards array are good for:
120
121 video_inputs    - # of video inputs the card has
122 audio_inputs    - historical cruft, not used any more.
123 tuner           - which input is the tuner
124 svhs            - which input is svhs (all others are labeled composite)
125 muxsel          - video mux, input->registervalue mapping
126 pll             - same as pll= insmod option
127 tuner_type      - same as tuner= insmod option
128 *_modulename    - hint whenever some card needs this or that audio
129                   module loaded to work properly.
130 has_radio       - whenever this TV card has a radio tuner.
131 no_msp34xx      - "1" disables loading of msp3400.o module
132 no_tda9875      - "1" disables loading of tda9875.o module
133 needs_tvaudio   - set to "1" to load tvaudio.o module
134
135 If some config item is specified both from the tvcards array and as
136 insmod option, the insmod option takes precedence.
137
138
139
140 Good luck,
141
142   Gerd
143
144
145 PS: If you have a new working entry, mail it to me.
146
147 --
148 Gerd Knorr <kraxel@bytesex.org>