aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/bt8xx/bttv-audio-hook.c173
-rw-r--r--drivers/media/video/bt8xx/bttv-audio-hook.h28
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c38
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c97
-rw-r--r--drivers/media/video/bt8xx/bttv.h7
-rw-r--r--drivers/media/video/bt8xx/bttvp.h7
6 files changed, 144 insertions, 206 deletions
diff --git a/drivers/media/video/bt8xx/bttv-audio-hook.c b/drivers/media/video/bt8xx/bttv-audio-hook.c
index 1f25cdbed7d6..a075198f8300 100644
--- a/drivers/media/video/bt8xx/bttv-audio-hook.c
+++ b/drivers/media/video/bt8xx/bttv-audio-hook.c
@@ -7,22 +7,18 @@
7 7
8#include "bttv-audio-hook.h" 8#include "bttv-audio-hook.h"
9 9
10#include <linux/delay.h>
11
10/* ----------------------------------------------------------------------- */ 12/* ----------------------------------------------------------------------- */
11/* winview */ 13/* winview */
12 14
13 void winview_audio(struct bttv *btv, struct video_audio *v, int set) 15void winview_volume(struct bttv *btv, __u16 volume)
14{ 16{
15 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */ 17 /* PT2254A programming Jon Tombs, jon@gte.esi.us.es */
16 int bits_out, loops, vol, data; 18 int bits_out, loops, vol, data;
17 19
18 if (!set) {
19 /* Fixed by Leandro Lucarella <luca@linuxmendoza.org.ar (07/31/01) */
20 v->flags |= VIDEO_AUDIO_VOLUME;
21 return;
22 }
23
24 /* 32 levels logarithmic */ 20 /* 32 levels logarithmic */
25 vol = 32 - ((v->volume>>11)); 21 vol = 32 - ((volume>>11));
26 /* units */ 22 /* units */
27 bits_out = (PT2254_DBS_IN_2>>(vol%5)); 23 bits_out = (PT2254_DBS_IN_2>>(vol%5));
28 /* tens */ 24 /* tens */
@@ -56,30 +52,28 @@
56/* mono/stereo control for various cards (which don't use i2c chips but */ 52/* mono/stereo control for various cards (which don't use i2c chips but */
57/* connect something to the GPIO pins */ 53/* connect something to the GPIO pins */
58 54
59 void 55void gvbctv3pci_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
60gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set)
61{ 56{
62 unsigned int con = 0; 57 unsigned int con = 0;
63 58
64 if (set) { 59 if (set) {
65 gpio_inout(0x300, 0x300); 60 gpio_inout(0x300, 0x300);
66 if (v->mode & VIDEO_SOUND_LANG1) 61 if (t->audmode & V4L2_TUNER_MODE_LANG1)
67 con = 0x000; 62 con = 0x000;
68 if (v->mode & VIDEO_SOUND_LANG2) 63 if (t->audmode & V4L2_TUNER_MODE_LANG2)
69 con = 0x300; 64 con = 0x300;
70 if (v->mode & VIDEO_SOUND_STEREO) 65 if (t->audmode & V4L2_TUNER_MODE_STEREO)
71 con = 0x200; 66 con = 0x200;
72/* if (v->mode & VIDEO_SOUND_MONO) 67/* if (t->audmode & V4L2_TUNER_MODE_MONO)
73 * con = 0x100; */ 68 * con = 0x100; */
74 gpio_bits(0x300, con); 69 gpio_bits(0x300, con);
75 } else { 70 } else {
76 v->mode = VIDEO_SOUND_STEREO | 71 t->audmode = V4L2_TUNER_MODE_STEREO |
77 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 72 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
78 } 73 }
79} 74}
80 75
81 void 76void gvbctv5pci_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
82gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
83{ 77{
84 unsigned int val, con; 78 unsigned int val, con;
85 79
@@ -89,8 +83,8 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
89 val = gpio_read(); 83 val = gpio_read();
90 if (set) { 84 if (set) {
91 con = 0x000; 85 con = 0x000;
92 if (v->mode & VIDEO_SOUND_LANG2) { 86 if (t->audmode & V4L2_TUNER_MODE_LANG2) {
93 if (v->mode & VIDEO_SOUND_LANG1) { 87 if (t->audmode & V4L2_TUNER_MODE_LANG1) {
94 /* LANG1 + LANG2 */ 88 /* LANG1 + LANG2 */
95 con = 0x100; 89 con = 0x100;
96 } 90 }
@@ -107,23 +101,23 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
107 } else { 101 } else {
108 switch (val & 0x70) { 102 switch (val & 0x70) {
109 case 0x10: 103 case 0x10:
110 v->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 104 t->audmode = V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
111 break; 105 break;
112 case 0x30: 106 case 0x30:
113 v->mode = VIDEO_SOUND_LANG2; 107 t->audmode = V4L2_TUNER_MODE_LANG2;
114 break; 108 break;
115 case 0x50: 109 case 0x50:
116 v->mode = VIDEO_SOUND_LANG1; 110 t->audmode = V4L2_TUNER_MODE_LANG1;
117 break; 111 break;
118 case 0x60: 112 case 0x60:
119 v->mode = VIDEO_SOUND_STEREO; 113 t->audmode = V4L2_TUNER_MODE_STEREO;
120 break; 114 break;
121 case 0x70: 115 case 0x70:
122 v->mode = VIDEO_SOUND_MONO; 116 t->audmode = V4L2_TUNER_MODE_MONO;
123 break; 117 break;
124 default: 118 default:
125 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 119 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
126 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 120 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
127 } 121 }
128 } 122 }
129} 123}
@@ -141,15 +135,15 @@ gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set)
141 * handles this with a tda9840 135 * handles this with a tda9840
142 * 136 *
143 */ 137 */
144 void 138
145avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set) 139void avermedia_tvphone_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
146{ 140{
147 int val = 0; 141 int val = 0;
148 142
149 if (set) { 143 if (set) {
150 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ 144 if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */
151 val = 0x02; 145 val = 0x02;
152 if (v->mode & VIDEO_SOUND_STEREO) 146 if (t->audmode & V4L2_TUNER_MODE_STEREO)
153 val = 0x01; 147 val = 0x01;
154 if (val) { 148 if (val) {
155 gpio_bits(0x03,val); 149 gpio_bits(0x03,val);
@@ -157,97 +151,96 @@ avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, int set)
157 bttv_gpio_tracking(btv,"avermedia"); 151 bttv_gpio_tracking(btv,"avermedia");
158 } 152 }
159 } else { 153 } else {
160 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 154 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
161 VIDEO_SOUND_LANG1; 155 V4L2_TUNER_MODE_LANG1;
162 return; 156 return;
163 } 157 }
164} 158}
165 159
166 void 160
167avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, int set) 161void avermedia_tv_stereo_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
168{ 162{
169 int val = 0; 163 int val = 0;
170 164
171 if (set) { 165 if (set) {
172 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ 166 if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */
173 val = 0x01; 167 val = 0x01;
174 if (v->mode & VIDEO_SOUND_STEREO) /* STEREO */ 168 if (t->audmode & V4L2_TUNER_MODE_STEREO) /* STEREO */
175 val = 0x02; 169 val = 0x02;
176 btaor(val, ~0x03, BT848_GPIO_DATA); 170 btaor(val, ~0x03, BT848_GPIO_DATA);
177 if (bttv_gpio) 171 if (bttv_gpio)
178 bttv_gpio_tracking(btv,"avermedia"); 172 bttv_gpio_tracking(btv,"avermedia");
179 } else { 173 } else {
180 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 174 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
181 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 175 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
182 return; 176 return;
183 } 177 }
184} 178}
185 179
186/* Lifetec 9415 handling */ 180/* Lifetec 9415 handling */
187 void 181
188lt9415_audio(struct bttv *btv, struct video_audio *v, int set) 182void lt9415_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
189{ 183{
190 int val = 0; 184 int val = 0;
191 185
192 if (gpio_read() & 0x4000) { 186 if (gpio_read() & 0x4000) {
193 v->mode = VIDEO_SOUND_MONO; 187 t->audmode = V4L2_TUNER_MODE_MONO;
194 return; 188 return;
195 } 189 }
196 190
197 if (set) { 191 if (set) {
198 if (v->mode & VIDEO_SOUND_LANG2) /* A2 SAP */ 192 if (t->audmode & V4L2_TUNER_MODE_LANG2) /* A2 SAP */
199 val = 0x0080; 193 val = 0x0080;
200 if (v->mode & VIDEO_SOUND_STEREO) /* A2 stereo */ 194 if (t->audmode & V4L2_TUNER_MODE_STEREO) /* A2 stereo */
201 val = 0x0880; 195 val = 0x0880;
202 if ((v->mode & VIDEO_SOUND_LANG1) || 196 if ((t->audmode & V4L2_TUNER_MODE_LANG1) ||
203 (v->mode & VIDEO_SOUND_MONO)) 197 (t->audmode & V4L2_TUNER_MODE_MONO))
204 val = 0; 198 val = 0;
205 gpio_bits(0x0880, val); 199 gpio_bits(0x0880, val);
206 if (bttv_gpio) 200 if (bttv_gpio)
207 bttv_gpio_tracking(btv,"lt9415"); 201 bttv_gpio_tracking(btv,"lt9415");
208 } else { 202 } else {
209 /* autodetect doesn't work with this card :-( */ 203 /* autodetect doesn't work with this card :-( */
210 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 204 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
211 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 205 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
212 return; 206 return;
213 } 207 }
214} 208}
215 209
216/* TDA9821 on TerraTV+ Bt848, Bt878 */ 210/* TDA9821 on TerraTV+ Bt848, Bt878 */
217 void 211void terratv_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
218terratv_audio(struct bttv *btv, struct video_audio *v, int set)
219{ 212{
220 unsigned int con = 0; 213 unsigned int con = 0;
221 214
222 if (set) { 215 if (set) {
223 gpio_inout(0x180000,0x180000); 216 gpio_inout(0x180000,0x180000);
224 if (v->mode & VIDEO_SOUND_LANG2) 217 if (t->audmode & V4L2_TUNER_MODE_LANG2)
225 con = 0x080000; 218 con = 0x080000;
226 if (v->mode & VIDEO_SOUND_STEREO) 219 if (t->audmode & V4L2_TUNER_MODE_STEREO)
227 con = 0x180000; 220 con = 0x180000;
228 gpio_bits(0x180000, con); 221 gpio_bits(0x180000, con);
229 if (bttv_gpio) 222 if (bttv_gpio)
230 bttv_gpio_tracking(btv,"terratv"); 223 bttv_gpio_tracking(btv,"terratv");
231 } else { 224 } else {
232 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 225 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
233 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 226 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
234 } 227 }
235} 228}
236 229
237 void 230
238winfast2000_audio(struct bttv *btv, struct video_audio *v, int set) 231void winfast2000_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
239{ 232{
240 unsigned long val = 0; 233 unsigned long val = 0;
241 234
242 if (set) { 235 if (set) {
243 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/ 236 /*btor (0xc32000, BT848_GPIO_OUT_EN);*/
244 if (v->mode & VIDEO_SOUND_MONO) /* Mono */ 237 if (t->audmode & V4L2_TUNER_MODE_MONO) /* Mono */
245 val = 0x420000; 238 val = 0x420000;
246 if (v->mode & VIDEO_SOUND_LANG1) /* Mono */ 239 if (t->audmode & V4L2_TUNER_MODE_LANG1) /* Mono */
247 val = 0x420000; 240 val = 0x420000;
248 if (v->mode & VIDEO_SOUND_LANG2) /* SAP */ 241 if (t->audmode & V4L2_TUNER_MODE_LANG2) /* SAP */
249 val = 0x410000; 242 val = 0x410000;
250 if (v->mode & VIDEO_SOUND_STEREO) /* Stereo */ 243 if (t->audmode & V4L2_TUNER_MODE_STEREO) /* Stereo */
251 val = 0x020000; 244 val = 0x020000;
252 if (val) { 245 if (val) {
253 gpio_bits(0x430000, val); 246 gpio_bits(0x430000, val);
@@ -255,8 +248,8 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
255 bttv_gpio_tracking(btv,"winfast2000"); 248 bttv_gpio_tracking(btv,"winfast2000");
256 } 249 }
257 } else { 250 } else {
258 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 251 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
259 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 252 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
260 } 253 }
261} 254}
262 255
@@ -268,8 +261,7 @@ winfast2000_audio(struct bttv *btv, struct video_audio *v, int set)
268 * Note: There are card variants without tda9874a. Forcing the "stereo sound route" 261 * Note: There are card variants without tda9874a. Forcing the "stereo sound route"
269 * will mute this cards. 262 * will mute this cards.
270 */ 263 */
271 void 264void pvbt878p9b_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
272pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
273{ 265{
274 unsigned int val = 0; 266 unsigned int val = 0;
275 267
@@ -277,11 +269,11 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
277 return; 269 return;
278 270
279 if (set) { 271 if (set) {
280 if (v->mode & VIDEO_SOUND_MONO) { 272 if (t->audmode & V4L2_TUNER_MODE_MONO) {
281 val = 0x01; 273 val = 0x01;
282 } 274 }
283 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) 275 if ((t->audmode & (V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2))
284 || (v->mode & VIDEO_SOUND_STEREO)) { 276 || (t->audmode & V4L2_TUNER_MODE_STEREO)) {
285 val = 0x02; 277 val = 0x02;
286 } 278 }
287 if (val) { 279 if (val) {
@@ -290,8 +282,8 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
290 bttv_gpio_tracking(btv,"pvbt878p9b"); 282 bttv_gpio_tracking(btv,"pvbt878p9b");
291 } 283 }
292 } else { 284 } else {
293 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 285 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
294 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 286 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
295 } 287 }
296} 288}
297 289
@@ -300,8 +292,7 @@ pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set)
300 * sound control for FlyVideo 2000S (with tda9874 decoder) 292 * sound control for FlyVideo 2000S (with tda9874 decoder)
301 * based on pvbt878p9b_audio() - this is not tested, please fix!!! 293 * based on pvbt878p9b_audio() - this is not tested, please fix!!!
302 */ 294 */
303 void 295void fv2000s_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
304fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
305{ 296{
306 unsigned int val = 0xffff; 297 unsigned int val = 0xffff;
307 298
@@ -309,11 +300,11 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
309 return; 300 return;
310 301
311 if (set) { 302 if (set) {
312 if (v->mode & VIDEO_SOUND_MONO) { 303 if (t->audmode & V4L2_TUNER_MODE_MONO) {
313 val = 0x0000; 304 val = 0x0000;
314 } 305 }
315 if ((v->mode & (VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2)) 306 if ((t->audmode & (V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2))
316 || (v->mode & VIDEO_SOUND_STEREO)) { 307 || (t->audmode & V4L2_TUNER_MODE_STEREO)) {
317 val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */ 308 val = 0x1080; /*-dk-???: 0x0880, 0x0080, 0x1800 ... */
318 } 309 }
319 if (val != 0xffff) { 310 if (val != 0xffff) {
@@ -322,8 +313,8 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
322 bttv_gpio_tracking(btv,"fv2000s"); 313 bttv_gpio_tracking(btv,"fv2000s");
323 } 314 }
324 } else { 315 } else {
325 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 316 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
326 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 317 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
327 } 318 }
328} 319}
329 320
@@ -331,19 +322,18 @@ fv2000s_audio(struct bttv *btv, struct video_audio *v, int set)
331 * sound control for Canopus WinDVR PCI 322 * sound control for Canopus WinDVR PCI
332 * Masaki Suzuki <masaki@btree.org> 323 * Masaki Suzuki <masaki@btree.org>
333 */ 324 */
334 void 325void windvr_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
335windvr_audio(struct bttv *btv, struct video_audio *v, int set)
336{ 326{
337 unsigned long val = 0; 327 unsigned long val = 0;
338 328
339 if (set) { 329 if (set) {
340 if (v->mode & VIDEO_SOUND_MONO) 330 if (t->audmode & V4L2_TUNER_MODE_MONO)
341 val = 0x040000; 331 val = 0x040000;
342 if (v->mode & VIDEO_SOUND_LANG1) 332 if (t->audmode & V4L2_TUNER_MODE_LANG1)
343 val = 0; 333 val = 0;
344 if (v->mode & VIDEO_SOUND_LANG2) 334 if (t->audmode & V4L2_TUNER_MODE_LANG2)
345 val = 0x100000; 335 val = 0x100000;
346 if (v->mode & VIDEO_SOUND_STEREO) 336 if (t->audmode & V4L2_TUNER_MODE_STEREO)
347 val = 0; 337 val = 0;
348 if (val) { 338 if (val) {
349 gpio_bits(0x140000, val); 339 gpio_bits(0x140000, val);
@@ -351,8 +341,8 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set)
351 bttv_gpio_tracking(btv,"windvr"); 341 bttv_gpio_tracking(btv,"windvr");
352 } 342 }
353 } else { 343 } else {
354 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 344 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
355 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 345 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
356 } 346 }
357} 347}
358 348
@@ -360,8 +350,7 @@ windvr_audio(struct bttv *btv, struct video_audio *v, int set)
360 * sound control for AD-TVK503 350 * sound control for AD-TVK503
361 * Hiroshi Takekawa <sian@big.or.jp> 351 * Hiroshi Takekawa <sian@big.or.jp>
362 */ 352 */
363 void 353void adtvk503_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
364adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
365{ 354{
366 unsigned int con = 0xffffff; 355 unsigned int con = 0xffffff;
367 356
@@ -369,13 +358,13 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
369 358
370 if (set) { 359 if (set) {
371 /* btor(***, BT848_GPIO_OUT_EN); */ 360 /* btor(***, BT848_GPIO_OUT_EN); */
372 if (v->mode & VIDEO_SOUND_LANG1) 361 if (t->audmode & V4L2_TUNER_MODE_LANG1)
373 con = 0x00000000; 362 con = 0x00000000;
374 if (v->mode & VIDEO_SOUND_LANG2) 363 if (t->audmode & V4L2_TUNER_MODE_LANG2)
375 con = 0x00180000; 364 con = 0x00180000;
376 if (v->mode & VIDEO_SOUND_STEREO) 365 if (t->audmode & V4L2_TUNER_MODE_STEREO)
377 con = 0x00000000; 366 con = 0x00000000;
378 if (v->mode & VIDEO_SOUND_MONO) 367 if (t->audmode & V4L2_TUNER_MODE_MONO)
379 con = 0x00060000; 368 con = 0x00060000;
380 if (con != 0xffffff) { 369 if (con != 0xffffff) {
381 gpio_bits(0x1e0000,con); 370 gpio_bits(0x1e0000,con);
@@ -383,7 +372,7 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
383 bttv_gpio_tracking(btv, "adtvk503"); 372 bttv_gpio_tracking(btv, "adtvk503");
384 } 373 }
385 } else { 374 } else {
386 v->mode = VIDEO_SOUND_MONO | VIDEO_SOUND_STEREO | 375 t->audmode = V4L2_TUNER_MODE_MONO | V4L2_TUNER_MODE_STEREO |
387 VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 376 V4L2_TUNER_MODE_LANG1 | V4L2_TUNER_MODE_LANG2;
388 } 377 }
389} 378}
diff --git a/drivers/media/video/bt8xx/bttv-audio-hook.h b/drivers/media/video/bt8xx/bttv-audio-hook.h
index 9770cacc17b9..159d07adeff8 100644
--- a/drivers/media/video/bt8xx/bttv-audio-hook.h
+++ b/drivers/media/video/bt8xx/bttv-audio-hook.h
@@ -7,17 +7,17 @@
7 7
8#include "bttvp.h" 8#include "bttvp.h"
9 9
10static void winview_audio(struct bttv *btv, struct video_audio *v, int set); 10void winview_volume (struct bttv *btv, __u16 volume);
11static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); 11
12static void avermedia_tvphone_audio(struct bttv *btv, struct video_audio *v, 12void lt9415_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
13 int set); 13void avermedia_tvphone_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
14static void avermedia_tv_stereo_audio(struct bttv *btv, struct video_audio *v, 14void avermedia_tv_stereo_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
15 int set); 15void terratv_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
16static void terratv_audio(struct bttv *btv, struct video_audio *v, int set); 16void gvbctv3pci_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
17static void gvbctv3pci_audio(struct bttv *btv, struct video_audio *v, int set); 17void gvbctv5pci_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
18static void gvbctv5pci_audio(struct bttv *btv, struct video_audio *v, int set); 18void winfast2000_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
19static void winfast2000_audio(struct bttv *btv, struct video_audio *v, int set); 19void pvbt878p9b_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
20static void pvbt878p9b_audio(struct bttv *btv, struct video_audio *v, int set); 20void fv2000s_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
21static void fv2000s_audio(struct bttv *btv, struct video_audio *v, int set); 21void windvr_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
22static void windvr_audio(struct bttv *btv, struct video_audio *v, int set); 22void adtvk503_audio(struct bttv *btv, struct v4l2_tuner *tuner, int set);
23static void adtvk503_audio(struct bttv *btv, struct video_audio *v, int set); 23
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index 78e5e29748ac..63a47cd4c161 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -414,7 +414,7 @@ struct tvcard bttv_tvcards[] = {
414 .tuner_type = UNSET, 414 .tuner_type = UNSET,
415 .tuner_addr = ADDR_UNSET, 415 .tuner_addr = ADDR_UNSET,
416 .radio_addr = ADDR_UNSET, 416 .radio_addr = ADDR_UNSET,
417 .audio_hook = avermedia_tvphone_audio, 417 .audio_mode_gpio= avermedia_tvphone_audio,
418 .has_remote = 1, 418 .has_remote = 1,
419 }, 419 },
420 [BTTV_BOARD_MATRIX_VISION] = { 420 [BTTV_BOARD_MATRIX_VISION] = {
@@ -526,7 +526,7 @@ struct tvcard bttv_tvcards[] = {
526 .tuner_type = TUNER_PHILIPS_PAL, 526 .tuner_type = TUNER_PHILIPS_PAL,
527 .tuner_addr = ADDR_UNSET, 527 .tuner_addr = ADDR_UNSET,
528 .radio_addr = ADDR_UNSET, 528 .radio_addr = ADDR_UNSET,
529 .audio_hook = avermedia_tv_stereo_audio, 529 .audio_mode_gpio= avermedia_tv_stereo_audio,
530 .no_gpioirq = 1, 530 .no_gpioirq = 1,
531 }, 531 },
532 [BTTV_BOARD_VHX] = { 532 [BTTV_BOARD_VHX] = {
@@ -591,7 +591,7 @@ struct tvcard bttv_tvcards[] = {
591 .tuner_type = UNSET, 591 .tuner_type = UNSET,
592 .tuner_addr = ADDR_UNSET, 592 .tuner_addr = ADDR_UNSET,
593 .radio_addr = ADDR_UNSET, 593 .radio_addr = ADDR_UNSET,
594 .audio_hook = winview_audio, 594 .volume_gpio = winview_volume,
595 .has_radio = 1, 595 .has_radio = 1,
596 }, 596 },
597 [BTTV_BOARD_AVEC_INTERCAP] = { 597 [BTTV_BOARD_AVEC_INTERCAP] = {
@@ -715,7 +715,7 @@ struct tvcard bttv_tvcards[] = {
715 .tuner_type = TUNER_PHILIPS_PAL, 715 .tuner_type = TUNER_PHILIPS_PAL,
716 .tuner_addr = ADDR_UNSET, 716 .tuner_addr = ADDR_UNSET,
717 .radio_addr = ADDR_UNSET, 717 .radio_addr = ADDR_UNSET,
718 .audio_hook = terratv_audio, 718 .audio_mode_gpio= terratv_audio,
719 }, 719 },
720 [BTTV_BOARD_HAUPPAUG_WCAM] = { 720 [BTTV_BOARD_HAUPPAUG_WCAM] = {
721 .name = "Hauppauge WinCam newer (bt878)", 721 .name = "Hauppauge WinCam newer (bt878)",
@@ -763,7 +763,7 @@ struct tvcard bttv_tvcards[] = {
763 .tuner_type = TUNER_PHILIPS_PAL, 763 .tuner_type = TUNER_PHILIPS_PAL,
764 .tuner_addr = ADDR_UNSET, 764 .tuner_addr = ADDR_UNSET,
765 .radio_addr = ADDR_UNSET, 765 .radio_addr = ADDR_UNSET,
766 .audio_hook = terratv_audio, 766 .audio_mode_gpio= terratv_audio,
767 /* GPIO wiring: 767 /* GPIO wiring:
768 External 20 pin connector (for Active Radio Upgrade board) 768 External 20 pin connector (for Active Radio Upgrade board)
769 gpio00: i2c-sda 769 gpio00: i2c-sda
@@ -902,7 +902,7 @@ struct tvcard bttv_tvcards[] = {
902 .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */ 902 .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */
903 .tuner_addr = ADDR_UNSET, 903 .tuner_addr = ADDR_UNSET,
904 .radio_addr = ADDR_UNSET, 904 .radio_addr = ADDR_UNSET,
905 .audio_hook = winfast2000_audio, 905 .audio_mode_gpio= winfast2000_audio,
906 .has_remote = 1, 906 .has_remote = 1,
907 }, 907 },
908 [BTTV_BOARD_CHRONOS_VS2] = { 908 [BTTV_BOARD_CHRONOS_VS2] = {
@@ -1022,7 +1022,7 @@ struct tvcard bttv_tvcards[] = {
1022 .tuner_addr = ADDR_UNSET, 1022 .tuner_addr = ADDR_UNSET,
1023 .radio_addr = ADDR_UNSET, 1023 .radio_addr = ADDR_UNSET,
1024 .has_radio = 1, 1024 .has_radio = 1,
1025 .audio_hook = avermedia_tvphone_audio, 1025 .audio_mode_gpio= avermedia_tvphone_audio,
1026 }, 1026 },
1027 [BTTV_BOARD_PV951] = { 1027 [BTTV_BOARD_PV951] = {
1028 .name = "ProVideo PV951", /* pic16c54 */ 1028 .name = "ProVideo PV951", /* pic16c54 */
@@ -1154,7 +1154,7 @@ struct tvcard bttv_tvcards[] = {
1154 .tuner_type = TUNER_ALPS_TSHC6_NTSC, 1154 .tuner_type = TUNER_ALPS_TSHC6_NTSC,
1155 .tuner_addr = ADDR_UNSET, 1155 .tuner_addr = ADDR_UNSET,
1156 .radio_addr = ADDR_UNSET, 1156 .radio_addr = ADDR_UNSET,
1157 .audio_hook = gvbctv3pci_audio, 1157 .audio_mode_gpio= gvbctv3pci_audio,
1158 }, 1158 },
1159 [BTTV_BOARD_PXELVWPLTVPAK] = { 1159 [BTTV_BOARD_PXELVWPLTVPAK] = {
1160 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP", 1160 .name = "Prolink PV-BT878P+4E / PixelView PlayTV PAK / Lenco MXTV-9578 CP",
@@ -1459,7 +1459,7 @@ struct tvcard bttv_tvcards[] = {
1459 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ 1459 /* -dk-???: set mute=0x1800 for tda9874h daughterboard */
1460 .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, 1460 .gpiomux = { 0x0000,0x0800,0x1000,0x1000 },
1461 .gpiomute = 0x1800, 1461 .gpiomute = 0x1800,
1462 .audio_hook = fv2000s_audio, 1462 .audio_mode_gpio= fv2000s_audio,
1463 .no_msp34xx = 1, 1463 .no_msp34xx = 1,
1464 .no_tda9875 = 1, 1464 .no_tda9875 = 1,
1465 .needs_tvaudio = 1, 1465 .needs_tvaudio = 1,
@@ -1500,7 +1500,7 @@ struct tvcard bttv_tvcards[] = {
1500 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, 1500 .tuner_type = TUNER_SHARP_2U5JF5540_NTSC,
1501 .tuner_addr = ADDR_UNSET, 1501 .tuner_addr = ADDR_UNSET,
1502 .radio_addr = ADDR_UNSET, 1502 .radio_addr = ADDR_UNSET,
1503 .audio_hook = gvbctv3pci_audio, 1503 .audio_mode_gpio= gvbctv3pci_audio,
1504 }, 1504 },
1505 1505
1506 /* ---- card 0x44 ---------------------------------- */ 1506 /* ---- card 0x44 ---------------------------------- */
@@ -1619,7 +1619,7 @@ struct tvcard bttv_tvcards[] = {
1619 .tuner_type = TUNER_PHILIPS_PAL, 1619 .tuner_type = TUNER_PHILIPS_PAL,
1620 .tuner_addr = ADDR_UNSET, 1620 .tuner_addr = ADDR_UNSET,
1621 .radio_addr = ADDR_UNSET, 1621 .radio_addr = ADDR_UNSET,
1622 .audio_hook = pvbt878p9b_audio, /* Note: not all cards have stereo */ 1622 .audio_mode_gpio= pvbt878p9b_audio, /* Note: not all cards have stereo */
1623 .has_radio = 1, /* Note: not all cards have radio */ 1623 .has_radio = 1, /* Note: not all cards have radio */
1624 .has_remote = 1, 1624 .has_remote = 1,
1625 /* GPIO wiring: 1625 /* GPIO wiring:
@@ -1697,7 +1697,7 @@ struct tvcard bttv_tvcards[] = {
1697 .tuner_type = TUNER_PHILIPS_NTSC, 1697 .tuner_type = TUNER_PHILIPS_NTSC,
1698 .tuner_addr = ADDR_UNSET, 1698 .tuner_addr = ADDR_UNSET,
1699 .radio_addr = ADDR_UNSET, 1699 .radio_addr = ADDR_UNSET,
1700 .audio_hook = windvr_audio, 1700 .audio_mode_gpio= windvr_audio,
1701 }, 1701 },
1702 [BTTV_BOARD_GRANDTEC_MULTI] = { 1702 [BTTV_BOARD_GRANDTEC_MULTI] = {
1703 .name = "GrandTec Multi Capture Card (Bt878)", 1703 .name = "GrandTec Multi Capture Card (Bt878)",
@@ -1794,7 +1794,7 @@ struct tvcard bttv_tvcards[] = {
1794 .tuner_type = TUNER_PHILIPS_NTSC_M, 1794 .tuner_type = TUNER_PHILIPS_NTSC_M,
1795 .tuner_addr = ADDR_UNSET, 1795 .tuner_addr = ADDR_UNSET,
1796 .radio_addr = ADDR_UNSET, 1796 .radio_addr = ADDR_UNSET,
1797 .audio_hook = gvbctv5pci_audio, 1797 .audio_mode_gpio= gvbctv5pci_audio,
1798 .has_radio = 1, 1798 .has_radio = 1,
1799 }, 1799 },
1800 [BTTV_BOARD_OSPREY1x0] = { 1800 [BTTV_BOARD_OSPREY1x0] = {
@@ -2093,7 +2093,7 @@ struct tvcard bttv_tvcards[] = {
2093 .tuner_type = TUNER_PHILIPS_NTSC, 2093 .tuner_type = TUNER_PHILIPS_NTSC,
2094 .tuner_addr = ADDR_UNSET, 2094 .tuner_addr = ADDR_UNSET,
2095 .radio_addr = ADDR_UNSET, 2095 .radio_addr = ADDR_UNSET,
2096 .audio_hook = adtvk503_audio, 2096 .audio_mode_gpio= adtvk503_audio,
2097 }, 2097 },
2098 2098
2099 /* ---- card 0x64 ---------------------------------- */ 2099 /* ---- card 0x64 ---------------------------------- */
@@ -3160,8 +3160,8 @@ static void flyvideo_gpio(struct bttv *btv)
3160 /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80 3160 /* LR90 Audio Routing is done by 2 hef4052, so Audio_Mask has 4 bits: 0x001c80
3161 * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00 3161 * LR26/LR50 only has 1 hef4052, Audio_Mask 0x000c00
3162 * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */ 3162 * Audio options: from tuner, from tda9821/tda9821(mono,stereo,sap), from tda9874, ext., mute */
3163 if(has_tda9820_tda9821) btv->audio_hook = lt9415_audio; 3163 if(has_tda9820_tda9821) btv->audio_mode_gpio = lt9415_audio;
3164 /* todo: if(has_tda9874) btv->audio_hook = fv2000s_audio; */ 3164 /* todo: if(has_tda9874) btv->audio_mode_gpio = fv2000s_audio; */
3165} 3165}
3166 3166
3167static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1, 3167static int miro_tunermap[] = { 0,6,2,3, 4,5,6,0, 3,0,4,5, 5,2,16,1,
@@ -3581,8 +3581,10 @@ void __devinit bttv_init_card2(struct bttv *btv)
3581 btv->has_remote=1; 3581 btv->has_remote=1;
3582 if (!bttv_tvcards[btv->c.type].no_gpioirq) 3582 if (!bttv_tvcards[btv->c.type].no_gpioirq)
3583 btv->gpioirq=1; 3583 btv->gpioirq=1;
3584 if (bttv_tvcards[btv->c.type].audio_hook) 3584 if (bttv_tvcards[btv->c.type].volume_gpio)
3585 btv->audio_hook=bttv_tvcards[btv->c.type].audio_hook; 3585 btv->volume_gpio=bttv_tvcards[btv->c.type].volume_gpio;
3586 if (bttv_tvcards[btv->c.type].audio_mode_gpio)
3587 btv->audio_mode_gpio=bttv_tvcards[btv->c.type].audio_mode_gpio;
3586 3588
3587 if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) { 3589 if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) {
3588 /* detect Bt832 chip for quartzsight digital camera */ 3590 /* detect Bt832 chip for quartzsight digital camera */
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 13221da6e40f..db0e4b78e7dd 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1434,20 +1434,6 @@ static void bttv_reinit_bt848(struct bttv *btv)
1434 1434
1435static int get_control(struct bttv *btv, struct v4l2_control *c) 1435static int get_control(struct bttv *btv, struct v4l2_control *c)
1436{ 1436{
1437#ifdef CONFIG_VIDEO_V4L1
1438 if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
1439 struct video_audio va;
1440
1441 memset(&va,0,sizeof(va));
1442 btv->audio_hook(btv,&va,0);
1443 switch (c->id) {
1444 case V4L2_CID_AUDIO_VOLUME:
1445 c->value = va.volume;
1446 break;
1447 }
1448 return 0;
1449 }
1450#endif
1451 switch (c->id) { 1437 switch (c->id) {
1452 case V4L2_CID_BRIGHTNESS: 1438 case V4L2_CID_BRIGHTNESS:
1453 c->value = btv->bright; 1439 c->value = btv->bright;
@@ -1513,21 +1499,6 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
1513{ 1499{
1514 int val; 1500 int val;
1515 1501
1516#ifdef CONFIG_VIDEO_V4L1
1517 if (btv->audio_hook && (c->id == V4L2_CID_AUDIO_VOLUME)) {
1518 struct video_audio va;
1519
1520 memset(&va,0,sizeof(va));
1521 btv->audio_hook(btv,&va,0);
1522 switch (c->id) {
1523 case V4L2_CID_AUDIO_VOLUME:
1524 va.volume = c->value;
1525 break;
1526 }
1527 btv->audio_hook(btv,&va,1);
1528 return 0;
1529 }
1530#endif
1531 switch (c->id) { 1502 switch (c->id) {
1532 case V4L2_CID_BRIGHTNESS: 1503 case V4L2_CID_BRIGHTNESS:
1533 bt848_bright(btv,c->value); 1504 bt848_bright(btv,c->value);
@@ -1545,6 +1516,11 @@ static int set_control(struct bttv *btv, struct v4l2_control *c)
1545 audio_mute(btv, c->value); 1516 audio_mute(btv, c->value);
1546 /* fall through */ 1517 /* fall through */
1547 case V4L2_CID_AUDIO_VOLUME: 1518 case V4L2_CID_AUDIO_VOLUME:
1519 if (btv->volume_gpio) {
1520 btv->volume_gpio (btv, c->value);
1521 }
1522 bttv_call_i2c_clients(btv,VIDIOC_S_CTRL,c);
1523 break;
1548 case V4L2_CID_AUDIO_BALANCE: 1524 case V4L2_CID_AUDIO_BALANCE:
1549 case V4L2_CID_AUDIO_BASS: 1525 case V4L2_CID_AUDIO_BASS:
1550 case V4L2_CID_AUDIO_TREBLE: 1526 case V4L2_CID_AUDIO_TREBLE:
@@ -1953,22 +1929,10 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg)
1953 return -EINVAL; 1929 return -EINVAL;
1954 mutex_lock(&btv->lock); 1930 mutex_lock(&btv->lock);
1955 bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t); 1931 bttv_call_i2c_clients(btv, VIDIOC_S_TUNER, t);
1956#ifdef CONFIG_VIDEO_V4L1 1932
1957 if (btv->audio_hook) { 1933 if (btv->audio_mode_gpio) {
1958 struct video_audio va; 1934 btv->audio_mode_gpio (btv,t,1);
1959 memset(&va, 0, sizeof(struct video_audio));
1960 if (t->audmode == V4L2_TUNER_MODE_MONO)
1961 va.mode = VIDEO_SOUND_MONO;
1962 else if (t->audmode == V4L2_TUNER_MODE_STEREO ||
1963 t->audmode == V4L2_TUNER_MODE_LANG1_LANG2)
1964 va.mode = VIDEO_SOUND_STEREO;
1965 else if (t->audmode == V4L2_TUNER_MODE_LANG1)
1966 va.mode = VIDEO_SOUND_LANG1;
1967 else if (t->audmode == V4L2_TUNER_MODE_LANG2)
1968 va.mode = VIDEO_SOUND_LANG2;
1969 btv->audio_hook(btv,&va,1);
1970 } 1935 }
1971#endif
1972 mutex_unlock(&btv->lock); 1936 mutex_unlock(&btv->lock);
1973 return 0; 1937 return 0;
1974 } 1938 }
@@ -2846,19 +2810,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2846 return 0; 2810 return 0;
2847 } 2811 }
2848 *c = bttv_ctls[i]; 2812 *c = bttv_ctls[i];
2849#ifdef CONFIG_VIDEO_V4L1 2813
2850 if (btv->audio_hook && i >= 4 && i <= 8) { 2814 if (!btv->volume_gpio &&
2851 struct video_audio va; 2815 (bttv_ctls[i].id == V4L2_CID_AUDIO_VOLUME))
2852 memset(&va,0,sizeof(va)); 2816 *c = no_ctl;
2853 btv->audio_hook(btv,&va,0); 2817
2854 switch (bttv_ctls[i].id) {
2855 case V4L2_CID_AUDIO_VOLUME:
2856 if (!(va.flags & VIDEO_AUDIO_VOLUME))
2857 *c = no_ctl;
2858 break;
2859 }
2860 }
2861#endif
2862 return 0; 2818 return 0;
2863 } 2819 }
2864 case VIDIOC_G_PARM: 2820 case VIDIOC_G_PARM:
@@ -2890,26 +2846,11 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2890 t->type = V4L2_TUNER_ANALOG_TV; 2846 t->type = V4L2_TUNER_ANALOG_TV;
2891 if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC) 2847 if (btread(BT848_DSTATUS)&BT848_DSTATUS_HLOC)
2892 t->signal = 0xffff; 2848 t->signal = 0xffff;
2893#ifdef CONFIG_VIDEO_V4L1 2849
2894 if (btv->audio_hook) { 2850 if (btv->audio_mode_gpio) {
2895 /* Hmmm ... */ 2851 btv->audio_mode_gpio (btv,t,0);
2896 struct video_audio va;
2897 memset(&va, 0, sizeof(struct video_audio));
2898 btv->audio_hook(btv,&va,0);
2899 t->audmode = V4L2_TUNER_MODE_MONO;
2900 t->rxsubchans = V4L2_TUNER_SUB_MONO;
2901 if(va.mode & VIDEO_SOUND_STEREO) {
2902 t->audmode = V4L2_TUNER_MODE_STEREO;
2903 t->rxsubchans = V4L2_TUNER_SUB_STEREO;
2904 }
2905 if(va.mode & VIDEO_SOUND_LANG2) {
2906 t->audmode = V4L2_TUNER_MODE_LANG1;
2907 t->rxsubchans = V4L2_TUNER_SUB_LANG1
2908 | V4L2_TUNER_SUB_LANG2;
2909 }
2910 } 2852 }
2911#endif 2853
2912 /* FIXME: fill capability+audmode */
2913 mutex_unlock(&btv->lock); 2854 mutex_unlock(&btv->lock);
2914 return 0; 2855 return 0;
2915 } 2856 }
@@ -3403,6 +3344,10 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
3403 3344
3404 bttv_call_i2c_clients(btv, VIDIOC_G_TUNER, t); 3345 bttv_call_i2c_clients(btv, VIDIOC_G_TUNER, t);
3405 3346
3347 if (btv->audio_mode_gpio) {
3348 btv->audio_mode_gpio (btv,t,0);
3349 }
3350
3406 mutex_unlock(&btv->lock); 3351 mutex_unlock(&btv->lock);
3407 3352
3408 return 0; 3353 return 0;
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index 2edef15ba35c..bf4c339a520c 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -241,9 +241,10 @@ struct tvcard
241 unsigned int radio_addr; 241 unsigned int radio_addr;
242 242
243 unsigned int has_radio; 243 unsigned int has_radio;
244#ifdef CONFIG_VIDEO_V4L1 244
245 void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); 245 void (*volume_gpio)(struct bttv *btv, __u16 volume);
246#endif 246 void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set);
247
247 void (*muxsel_hook)(struct bttv *btv, unsigned int input); 248 void (*muxsel_hook)(struct bttv *btv, unsigned int input);
248}; 249};
249 250
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h
index fdd78f8b1dc3..4a02f0a8a467 100644
--- a/drivers/media/video/bt8xx/bttvp.h
+++ b/drivers/media/video/bt8xx/bttvp.h
@@ -336,9 +336,10 @@ struct bttv {
336 /* old gpio interface */ 336 /* old gpio interface */
337 wait_queue_head_t gpioq; 337 wait_queue_head_t gpioq;
338 int shutdown; 338 int shutdown;
339#ifdef CONFIG_VIDEO_V4L1 339
340 void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); 340 void (*volume_gpio)(struct bttv *btv, __u16 volume);
341#endif 341 void (*audio_mode_gpio)(struct bttv *btv, struct v4l2_tuner *tuner, int set);
342
342 /* new gpio interface */ 343 /* new gpio interface */
343 spinlock_t gpio_lock; 344 spinlock_t gpio_lock;
344 345