aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mxb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/mxb.c')
-rw-r--r--drivers/media/video/mxb.c469
1 files changed, 173 insertions, 296 deletions
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 8ef578caba3b..7f130284b5c7 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -27,6 +27,7 @@
27#include <media/tuner.h> 27#include <media/tuner.h>
28#include <linux/video_decoder.h> 28#include <linux/video_decoder.h>
29#include <media/v4l2-common.h> 29#include <media/v4l2-common.h>
30#include <media/saa7115.h>
30 31
31#include "mxb.h" 32#include "mxb.h"
32#include "tea6415c.h" 33#include "tea6415c.h"
@@ -122,6 +123,8 @@ static struct saa7146_extension_ioctls ioctls[] = {
122 { VIDIOC_S_FREQUENCY, SAA7146_EXCLUSIVE }, 123 { VIDIOC_S_FREQUENCY, SAA7146_EXCLUSIVE },
123 { VIDIOC_G_AUDIO, SAA7146_EXCLUSIVE }, 124 { VIDIOC_G_AUDIO, SAA7146_EXCLUSIVE },
124 { VIDIOC_S_AUDIO, SAA7146_EXCLUSIVE }, 125 { VIDIOC_S_AUDIO, SAA7146_EXCLUSIVE },
126 { VIDIOC_DBG_G_REGISTER, SAA7146_EXCLUSIVE },
127 { VIDIOC_DBG_S_REGISTER, SAA7146_EXCLUSIVE },
125 { MXB_S_AUDIO_CD, SAA7146_EXCLUSIVE }, /* custom control */ 128 { MXB_S_AUDIO_CD, SAA7146_EXCLUSIVE }, /* custom control */
126 { MXB_S_AUDIO_LINE, SAA7146_EXCLUSIVE }, /* custom control */ 129 { MXB_S_AUDIO_LINE, SAA7146_EXCLUSIVE }, /* custom control */
127 { 0, 0 } 130 { 0, 0 }
@@ -134,12 +137,12 @@ struct mxb
134 137
135 struct i2c_adapter i2c_adapter; 138 struct i2c_adapter i2c_adapter;
136 139
137 struct i2c_client* saa7111a; 140 struct i2c_client *saa7111a;
138 struct i2c_client* tda9840; 141 struct i2c_client *tda9840;
139 struct i2c_client* tea6415c; 142 struct i2c_client *tea6415c;
140 struct i2c_client* tuner; 143 struct i2c_client *tuner;
141 struct i2c_client* tea6420_1; 144 struct i2c_client *tea6420_1;
142 struct i2c_client* tea6420_2; 145 struct i2c_client *tea6420_2;
143 146
144 int cur_mode; /* current audio mode (mono, stereo, ...) */ 147 int cur_mode; /* current audio mode (mono, stereo, ...) */
145 int cur_input; /* current input */ 148 int cur_input; /* current input */
@@ -151,23 +154,23 @@ static struct saa7146_extension extension;
151 154
152static int mxb_check_clients(struct device *dev, void *data) 155static int mxb_check_clients(struct device *dev, void *data)
153{ 156{
154 struct mxb* mxb = data; 157 struct mxb *mxb = data;
155 struct i2c_client *client = i2c_verify_client(dev); 158 struct i2c_client *client = i2c_verify_client(dev);
156 159
157 if( !client ) 160 if (!client)
158 return 0; 161 return 0;
159 162
160 if( I2C_ADDR_TEA6420_1 == client->addr ) 163 if (I2C_ADDR_TEA6420_1 == client->addr)
161 mxb->tea6420_1 = client; 164 mxb->tea6420_1 = client;
162 if( I2C_ADDR_TEA6420_2 == client->addr ) 165 if (I2C_ADDR_TEA6420_2 == client->addr)
163 mxb->tea6420_2 = client; 166 mxb->tea6420_2 = client;
164 if( I2C_TEA6415C_2 == client->addr ) 167 if (I2C_TEA6415C_2 == client->addr)
165 mxb->tea6415c = client; 168 mxb->tea6415c = client;
166 if( I2C_ADDR_TDA9840 == client->addr ) 169 if (I2C_ADDR_TDA9840 == client->addr)
167 mxb->tda9840 = client; 170 mxb->tda9840 = client;
168 if( I2C_SAA7111 == client->addr ) 171 if (I2C_SAA7111 == client->addr)
169 mxb->saa7111a = client; 172 mxb->saa7111a = client;
170 if( 0x60 == client->addr ) 173 if (0x60 == client->addr)
171 mxb->tuner = client; 174 mxb->tuner = client;
172 175
173 return 0; 176 return 0;
@@ -178,23 +181,28 @@ static int mxb_probe(struct saa7146_dev* dev)
178 struct mxb* mxb = NULL; 181 struct mxb* mxb = NULL;
179 int result; 182 int result;
180 183
181 if ((result = request_module("saa7111")) < 0) { 184 result = request_module("saa7115");
185 if (result < 0) {
182 printk("mxb: saa7111 i2c module not available.\n"); 186 printk("mxb: saa7111 i2c module not available.\n");
183 return -ENODEV; 187 return -ENODEV;
184 } 188 }
185 if ((result = request_module("tea6420")) < 0) { 189 result = request_module("tea6420");
190 if (result < 0) {
186 printk("mxb: tea6420 i2c module not available.\n"); 191 printk("mxb: tea6420 i2c module not available.\n");
187 return -ENODEV; 192 return -ENODEV;
188 } 193 }
189 if ((result = request_module("tea6415c")) < 0) { 194 result = request_module("tea6415c");
195 if (result < 0) {
190 printk("mxb: tea6415c i2c module not available.\n"); 196 printk("mxb: tea6415c i2c module not available.\n");
191 return -ENODEV; 197 return -ENODEV;
192 } 198 }
193 if ((result = request_module("tda9840")) < 0) { 199 result = request_module("tda9840");
200 if (result < 0) {
194 printk("mxb: tda9840 i2c module not available.\n"); 201 printk("mxb: tda9840 i2c module not available.\n");
195 return -ENODEV; 202 return -ENODEV;
196 } 203 }
197 if ((result = request_module("tuner")) < 0) { 204 result = request_module("tuner");
205 if (result < 0) {
198 printk("mxb: tuner i2c module not available.\n"); 206 printk("mxb: tuner i2c module not available.\n");
199 return -ENODEV; 207 return -ENODEV;
200 } 208 }
@@ -207,9 +215,10 @@ static int mxb_probe(struct saa7146_dev* dev)
207 215
208 mxb->i2c_adapter = (struct i2c_adapter) { 216 mxb->i2c_adapter = (struct i2c_adapter) {
209 .class = I2C_CLASS_TV_ANALOG, 217 .class = I2C_CLASS_TV_ANALOG,
210 .name = "mxb",
211 }; 218 };
212 219
220 snprintf(mxb->i2c_adapter.name, sizeof(mxb->i2c_adapter.name), "mxb%d", mxb_num);
221
213 saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); 222 saa7146_i2c_adapter_prepare(dev, &mxb->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
214 if(i2c_add_adapter(&mxb->i2c_adapter) < 0) { 223 if(i2c_add_adapter(&mxb->i2c_adapter) < 0) {
215 DEB_S(("cannot register i2c-device. skipping.\n")); 224 DEB_S(("cannot register i2c-device. skipping.\n"));
@@ -290,38 +299,7 @@ static struct {
290 { 9, { 0x1d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } }, 299 { 9, { 0x1d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } },
291 { 9, { 0x3d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } }, 300 { 9, { 0x3d, 0xed, 0xd0, 0x68, 0x29, 0xb4, 0xe1, 0x00, 0xb8 } },
292 { 3, { 0x80, 0xb3, 0x0a } }, 301 { 3, { 0x80, 0xb3, 0x0a } },
293 {-1, { 0} } 302 {-1, { 0 } }
294};
295
296static const unsigned char mxb_saa7111_init[] = {
297 0x00, 0x00, /* 00 - ID byte */
298 0x01, 0x00, /* 01 - reserved */
299
300 /*front end */
301 0x02, 0xd8, /* 02 - FUSE=x, GUDL=x, MODE=x */
302 0x03, 0x23, /* 03 - HLNRS=0, VBSL=1, WPOFF=0, HOLDG=0, GAFIX=0, GAI1=256, GAI2=256 */
303 0x04, 0x00, /* 04 - GAI1=256 */
304 0x05, 0x00, /* 05 - GAI2=256 */
305
306 /* decoder */
307 0x06, 0xf0, /* 06 - HSB at xx(50Hz) / xx(60Hz) pixels after end of last line */
308 0x07, 0x30, /* 07 - HSS at xx(50Hz) / xx(60Hz) pixels after end of last line */
309 0x08, 0xa8, /* 08 - AUFD=x, FSEL=x, EXFIL=x, VTRC=x, HPLL=x, VNOI=x */
310 0x09, 0x02, /* 09 - BYPS=x, PREF=x, BPSS=x, VBLB=x, UPTCV=x, APER=x */
311 0x0a, 0x80, /* 0a - BRIG=128 */
312 0x0b, 0x47, /* 0b - CONT=1.109 */
313 0x0c, 0x40, /* 0c - SATN=1.0 */
314 0x0d, 0x00, /* 0d - HUE=0 */
315 0x0e, 0x01, /* 0e - CDTO=0, CSTD=0, DCCF=0, FCTC=0, CHBW=1 */
316 0x0f, 0x00, /* 0f - reserved */
317 0x10, 0xd0, /* 10 - OFTS=x, HDEL=x, VRLN=x, YDEL=x */
318 0x11, 0x8c, /* 11 - GPSW=x, CM99=x, FECO=x, COMPO=x, OEYC=1, OEHV=1, VIPB=0, COLO=0 */
319 0x12, 0x80, /* 12 - xx output control 2 */
320 0x13, 0x30, /* 13 - xx output control 3 */
321 0x14, 0x00, /* 14 - reserved */
322 0x15, 0x15, /* 15 - VBI */
323 0x16, 0x04, /* 16 - VBI */
324 0x17, 0x00, /* 17 - VBI */
325}; 303};
326 304
327/* bring hardware to a sane state. this has to be done, just in case someone 305/* bring hardware to a sane state. this has to be done, just in case someone
@@ -331,37 +309,28 @@ static const unsigned char mxb_saa7111_init[] = {
331static int mxb_init_done(struct saa7146_dev* dev) 309static int mxb_init_done(struct saa7146_dev* dev)
332{ 310{
333 struct mxb* mxb = (struct mxb*)dev->ext_priv; 311 struct mxb* mxb = (struct mxb*)dev->ext_priv;
334 struct video_decoder_init init;
335 struct i2c_msg msg; 312 struct i2c_msg msg;
336 struct tuner_setup tun_setup; 313 struct tuner_setup tun_setup;
337 v4l2_std_id std = V4L2_STD_PAL_BG; 314 v4l2_std_id std = V4L2_STD_PAL_BG;
315 struct v4l2_routing route;
338 316
339 int i = 0, err = 0; 317 int i = 0, err = 0;
340 struct tea6415c_multiplex vm; 318 struct tea6415c_multiplex vm;
341 319
342 /* select video mode in saa7111a */ 320 /* select video mode in saa7111a */
343 i = VIDEO_MODE_PAL; 321 mxb->saa7111a->driver->command(mxb->saa7111a, VIDIOC_S_STD, &std);
344 /* fixme: currently pointless: gets overwritten by configuration below */
345 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_NORM, &i);
346
347 /* write configuration to saa7111a */
348 init.data = mxb_saa7111_init;
349 init.len = sizeof(mxb_saa7111_init);
350 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_INIT, &init);
351 322
352 /* select tuner-output on saa7111a */ 323 /* select tuner-output on saa7111a */
353 i = 0; 324 i = 0;
354 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i); 325 route.input = SAA7115_COMPOSITE0;
355 326 route.output = SAA7111_FMT_CCIR | SAA7111_VBI_BYPASS;
356 /* enable vbi bypass */ 327 mxb->saa7111a->driver->command(mxb->saa7111a, VIDIOC_INT_S_VIDEO_ROUTING, &route);
357 i = 1;
358 mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i);
359 328
360 /* select a tuner type */ 329 /* select a tuner type */
361 tun_setup.mode_mask = T_ANALOG_TV; 330 tun_setup.mode_mask = T_ANALOG_TV;
362 tun_setup.addr = ADDR_UNSET; 331 tun_setup.addr = ADDR_UNSET;
363 tun_setup.type = TUNER_PHILIPS_PAL; 332 tun_setup.type = TUNER_PHILIPS_PAL;
364 mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup); 333 mxb->tuner->driver->command(mxb->tuner, TUNER_SET_TYPE_ADDR, &tun_setup);
365 /* tune in some frequency on tuner */ 334 /* tune in some frequency on tuner */
366 mxb->cur_freq.tuner = 0; 335 mxb->cur_freq.tuner = 0;
367 mxb->cur_freq.type = V4L2_TUNER_ANALOG_TV; 336 mxb->cur_freq.type = V4L2_TUNER_ANALOG_TV;
@@ -373,27 +342,26 @@ static int mxb_init_done(struct saa7146_dev* dev)
373 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); 342 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
374 343
375 /* mute audio on tea6420s */ 344 /* mute audio on tea6420s */
376 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); 345 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH, &TEA6420_line[6][0]);
377 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); 346 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH, &TEA6420_line[6][1]);
378 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_cd[6][0]); 347 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH, &TEA6420_cd[6][0]);
379 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_cd[6][1]); 348 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH, &TEA6420_cd[6][1]);
380 349
381 /* switch to tuner-channel on tea6415c*/ 350 /* switch to tuner-channel on tea6415c*/
382 vm.out = 17; 351 vm.out = 17;
383 vm.in = 3; 352 vm.in = 3;
384 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); 353 mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm);
385 354
386 /* select tuner-output on multicable on tea6415c*/ 355 /* select tuner-output on multicable on tea6415c*/
387 vm.in = 3; 356 vm.in = 3;
388 vm.out = 13; 357 vm.out = 13;
389 mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm); 358 mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm);
390 359
391 /* the rest for mxb */ 360 /* the rest for mxb */
392 mxb->cur_input = 0; 361 mxb->cur_input = 0;
393 mxb->cur_mute = 1; 362 mxb->cur_mute = 1;
394 363
395 mxb->cur_mode = V4L2_TUNER_MODE_STEREO; 364 mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
396 mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &mxb->cur_mode);
397 365
398 /* check if the saa7740 (aka 'sound arena module') is present 366 /* check if the saa7740 (aka 'sound arena module') is present
399 on the mxb. if so, we must initialize it. due to lack of 367 on the mxb. if so, we must initialize it. due to lack of
@@ -404,21 +372,22 @@ static int mxb_init_done(struct saa7146_dev* dev)
404 msg.len = mxb_saa7740_init[0].length; 372 msg.len = mxb_saa7740_init[0].length;
405 msg.buf = &mxb_saa7740_init[0].data[0]; 373 msg.buf = &mxb_saa7740_init[0].data[0];
406 374
407 if( 1 == (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) { 375 err = i2c_transfer(&mxb->i2c_adapter, &msg, 1);
376 if (err == 1) {
408 /* the sound arena module is a pos, that's probably the reason 377 /* the sound arena module is a pos, that's probably the reason
409 philips refuses to hand out a datasheet for the saa7740... 378 philips refuses to hand out a datasheet for the saa7740...
410 it seems to screw up the i2c bus, so we disable fast irq 379 it seems to screw up the i2c bus, so we disable fast irq
411 based i2c transactions here and rely on the slow and safe 380 based i2c transactions here and rely on the slow and safe
412 polling method ... */ 381 polling method ... */
413 extension.flags &= ~SAA7146_USE_I2C_IRQ; 382 extension.flags &= ~SAA7146_USE_I2C_IRQ;
414 for(i = 1;;i++) { 383 for (i = 1; ; i++) {
415 if( -1 == mxb_saa7740_init[i].length ) { 384 if (-1 == mxb_saa7740_init[i].length)
416 break; 385 break;
417 }
418 386
419 msg.len = mxb_saa7740_init[i].length; 387 msg.len = mxb_saa7740_init[i].length;
420 msg.buf = &mxb_saa7740_init[i].data[0]; 388 msg.buf = &mxb_saa7740_init[i].data[0];
421 if( 1 != (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) { 389 err = i2c_transfer(&mxb->i2c_adapter, &msg, 1);
390 if (err != 1) {
422 DEB_D(("failed to initialize 'sound arena module'.\n")); 391 DEB_D(("failed to initialize 'sound arena module'.\n"));
423 goto err; 392 goto err;
424 } 393 }
@@ -432,7 +401,8 @@ err:
432 /* ext->saa has been filled by the core driver */ 401 /* ext->saa has been filled by the core driver */
433 402
434 /* some stuff is done via variables */ 403 /* some stuff is done via variables */
435 saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source, input_port_selection[mxb->cur_input].hps_sync); 404 saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source,
405 input_port_selection[mxb->cur_input].hps_sync);
436 406
437 /* some stuff is done via direct write to the registers */ 407 /* some stuff is done via direct write to the registers */
438 408
@@ -457,24 +427,24 @@ void mxb_irq_bh(struct saa7146_dev* dev, u32* irq_mask)
457static struct saa7146_ext_vv vv_data; 427static struct saa7146_ext_vv vv_data;
458 428
459/* this function only gets called when the probing was successful */ 429/* this function only gets called when the probing was successful */
460static int mxb_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *info) 430static int mxb_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
461{ 431{
462 struct mxb* mxb = (struct mxb*)dev->ext_priv; 432 struct mxb *mxb = (struct mxb *)dev->ext_priv;
463 433
464 DEB_EE(("dev:%p\n",dev)); 434 DEB_EE(("dev:%p\n", dev));
465 435
466 /* checking for i2c-devices can be omitted here, because we 436 /* checking for i2c-devices can be omitted here, because we
467 already did this in "mxb_vl42_probe" */ 437 already did this in "mxb_vl42_probe" */
468 438
469 saa7146_vv_init(dev,&vv_data); 439 saa7146_vv_init(dev, &vv_data);
470 if( 0 != saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) { 440 if (saa7146_register_device(&mxb->video_dev, dev, "mxb", VFL_TYPE_GRABBER)) {
471 ERR(("cannot register capture v4l2 device. skipping.\n")); 441 ERR(("cannot register capture v4l2 device. skipping.\n"));
472 return -1; 442 return -1;
473 } 443 }
474 444
475 /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/ 445 /* initialization stuff (vbi) (only for revision > 0 and for extensions which want it)*/
476 if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) { 446 if (MXB_BOARD_CAN_DO_VBI(dev)) {
477 if( 0 != saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) { 447 if (saa7146_register_device(&mxb->vbi_dev, dev, "mxb", VFL_TYPE_VBI)) {
478 ERR(("cannot register vbi v4l2 device. skipping.\n")); 448 ERR(("cannot register vbi v4l2 device. skipping.\n"));
479 } 449 }
480 } 450 }
@@ -486,18 +456,18 @@ static int mxb_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data
486 i2c_use_client(mxb->saa7111a); 456 i2c_use_client(mxb->saa7111a);
487 i2c_use_client(mxb->tuner); 457 i2c_use_client(mxb->tuner);
488 458
489 printk("mxb: found 'Multimedia eXtension Board'-%d.\n",mxb_num); 459 printk("mxb: found Multimedia eXtension Board #%d.\n", mxb_num);
490 460
491 mxb_num++; 461 mxb_num++;
492 mxb_init_done(dev); 462 mxb_init_done(dev);
493 return 0; 463 return 0;
494} 464}
495 465
496static int mxb_detach(struct saa7146_dev* dev) 466static int mxb_detach(struct saa7146_dev *dev)
497{ 467{
498 struct mxb* mxb = (struct mxb*)dev->ext_priv; 468 struct mxb *mxb = (struct mxb *)dev->ext_priv;
499 469
500 DEB_EE(("dev:%p\n",dev)); 470 DEB_EE(("dev:%p\n", dev));
501 471
502 i2c_release_client(mxb->tea6420_1); 472 i2c_release_client(mxb->tea6420_1);
503 i2c_release_client(mxb->tea6420_2); 473 i2c_release_client(mxb->tea6420_2);
@@ -507,9 +477,8 @@ static int mxb_detach(struct saa7146_dev* dev)
507 i2c_release_client(mxb->tuner); 477 i2c_release_client(mxb->tuner);
508 478
509 saa7146_unregister_device(&mxb->video_dev,dev); 479 saa7146_unregister_device(&mxb->video_dev,dev);
510 if( 0 != MXB_BOARD_CAN_DO_VBI(dev)) { 480 if (MXB_BOARD_CAN_DO_VBI(dev))
511 saa7146_unregister_device(&mxb->vbi_dev,dev); 481 saa7146_unregister_device(&mxb->vbi_dev, dev);
512 }
513 saa7146_vv_release(dev); 482 saa7146_vv_release(dev);
514 483
515 mxb_num--; 484 mxb_num--;
@@ -523,7 +492,7 @@ static int mxb_detach(struct saa7146_dev* dev)
523static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 492static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
524{ 493{
525 struct saa7146_dev *dev = fh->dev; 494 struct saa7146_dev *dev = fh->dev;
526 struct mxb* mxb = (struct mxb*)dev->ext_priv; 495 struct mxb *mxb = (struct mxb *)dev->ext_priv;
527 struct saa7146_vv *vv = dev->vv_data; 496 struct saa7146_vv *vv = dev->vv_data;
528 497
529 switch(cmd) { 498 switch(cmd) {
@@ -532,11 +501,9 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
532 struct v4l2_input *i = arg; 501 struct v4l2_input *i = arg;
533 502
534 DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index)); 503 DEB_EE(("VIDIOC_ENUMINPUT %d.\n",i->index));
535 if( i->index < 0 || i->index >= MXB_INPUTS) { 504 if (i->index < 0 || i->index >= MXB_INPUTS)
536 return -EINVAL; 505 return -EINVAL;
537 }
538 memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input)); 506 memcpy(i, &mxb_inputs[i->index], sizeof(struct v4l2_input));
539
540 return 0; 507 return 0;
541 } 508 }
542 /* the saa7146 provides some controls (brightness, contrast, saturation) 509 /* the saa7146 provides some controls (brightness, contrast, saturation)
@@ -550,7 +517,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
550 for (i = MAXCONTROLS - 1; i >= 0; i--) { 517 for (i = MAXCONTROLS - 1; i >= 0; i--) {
551 if (mxb_controls[i].id == qc->id) { 518 if (mxb_controls[i].id == qc->id) {
552 *qc = mxb_controls[i]; 519 *qc = mxb_controls[i];
553 DEB_D(("VIDIOC_QUERYCTRL %d.\n",qc->id)); 520 DEB_D(("VIDIOC_QUERYCTRL %d.\n", qc->id));
554 return 0; 521 return 0;
555 } 522 }
556 } 523 }
@@ -562,56 +529,51 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
562 int i; 529 int i;
563 530
564 for (i = MAXCONTROLS - 1; i >= 0; i--) { 531 for (i = MAXCONTROLS - 1; i >= 0; i--) {
565 if (mxb_controls[i].id == vc->id) { 532 if (mxb_controls[i].id == vc->id)
566 break; 533 break;
567 }
568 } 534 }
569 535
570 if( i < 0 ) { 536 if (i < 0)
571 return -EAGAIN; 537 return -EAGAIN;
572 }
573 538
574 switch (vc->id ) { 539 if (vc->id == V4L2_CID_AUDIO_MUTE) {
575 case V4L2_CID_AUDIO_MUTE: { 540 vc->value = mxb->cur_mute;
576 vc->value = mxb->cur_mute; 541 DEB_D(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n", vc->value));
577 DEB_D(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n",vc->value)); 542 return 0;
578 return 0;
579 }
580 } 543 }
581 544
582 DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n",vc->value)); 545 DEB_EE(("VIDIOC_G_CTRL V4L2_CID_AUDIO_MUTE:%d.\n", vc->value));
583 return 0; 546 return 0;
584 } 547 }
585 548
586 case VIDIOC_S_CTRL: 549 case VIDIOC_S_CTRL:
587 { 550 {
588 struct v4l2_control *vc = arg; 551 struct v4l2_control *vc = arg;
589 int i = 0; 552 int i = 0;
590 553
591 for (i = MAXCONTROLS - 1; i >= 0; i--) { 554 for (i = MAXCONTROLS - 1; i >= 0; i--) {
592 if (mxb_controls[i].id == vc->id) { 555 if (mxb_controls[i].id == vc->id)
593 break; 556 break;
594 }
595 } 557 }
596 558
597 if( i < 0 ) { 559 if (i < 0)
598 return -EAGAIN; 560 return -EAGAIN;
599 }
600 561
601 switch (vc->id ) { 562 if (vc->id == V4L2_CID_AUDIO_MUTE) {
602 case V4L2_CID_AUDIO_MUTE: { 563 mxb->cur_mute = vc->value;
603 mxb->cur_mute = vc->value; 564 if (!vc->value) {
604 if( 0 == vc->value ) { 565 /* switch the audio-source */
605 /* switch the audio-source */ 566 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
606 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[mxb->cur_input]][0]); 567 &TEA6420_line[video_audio_connect[mxb->cur_input]][0]);
607 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[mxb->cur_input]][1]); 568 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
608 } else { 569 &TEA6420_line[video_audio_connect[mxb->cur_input]][1]);
609 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]); 570 } else {
610 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]); 571 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
611 } 572 &TEA6420_line[6][0]);
612 DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n",vc->value)); 573 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
613 break; 574 &TEA6420_line[6][1]);
614 } 575 }
576 DEB_EE(("VIDIOC_S_CTRL, V4L2_CID_AUDIO_MUTE: %d.\n", vc->value));
615 } 577 }
616 return 0; 578 return 0;
617 } 579 }
@@ -620,106 +582,84 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
620 int *input = (int *)arg; 582 int *input = (int *)arg;
621 *input = mxb->cur_input; 583 *input = mxb->cur_input;
622 584
623 DEB_EE(("VIDIOC_G_INPUT %d.\n",*input)); 585 DEB_EE(("VIDIOC_G_INPUT %d.\n", *input));
624 return 0; 586 return 0;
625 } 587 }
626 case VIDIOC_S_INPUT: 588 case VIDIOC_S_INPUT:
627 { 589 {
628 int input = *(int *)arg; 590 int input = *(int *)arg;
629 struct tea6415c_multiplex vm; 591 struct tea6415c_multiplex vm;
592 struct v4l2_routing route;
630 int i = 0; 593 int i = 0;
631 594
632 DEB_EE(("VIDIOC_S_INPUT %d.\n",input)); 595 DEB_EE(("VIDIOC_S_INPUT %d.\n", input));
633 596
634 if (input < 0 || input >= MXB_INPUTS) { 597 if (input < 0 || input >= MXB_INPUTS)
635 return -EINVAL; 598 return -EINVAL;
636 }
637
638 /* fixme: locke das setzen des inputs mit hilfe des mutexes
639 mutex_lock(&dev->lock);
640 video_mux(dev,*i);
641 mutex_unlock(&dev->lock);
642 */
643
644 /* fixme: check if streaming capture
645 if ( 0 != dev->streaming ) {
646 DEB_D(("VIDIOC_S_INPUT illegal while streaming.\n"));
647 return -EPERM;
648 }
649 */
650 599
651 mxb->cur_input = input; 600 mxb->cur_input = input;
652 601
653 saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source, input_port_selection[input].hps_sync); 602 saa7146_set_hps_source_and_sync(dev, input_port_selection[input].hps_source,
603 input_port_selection[input].hps_sync);
654 604
655 /* prepare switching of tea6415c and saa7111a; 605 /* prepare switching of tea6415c and saa7111a;
656 have a look at the 'background'-file for further informations */ 606 have a look at the 'background'-file for further informations */
657 switch( input ) { 607 switch (input) {
658 608 case TUNER:
659 case TUNER: 609 i = SAA7115_COMPOSITE0;
660 { 610 vm.in = 3;
661 i = 0; 611 vm.out = 17;
662 vm.in = 3; 612
663 vm.out = 17; 613 if (mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm)) {
664 614 printk(KERN_ERR "VIDIOC_S_INPUT: could not address tea6415c #1\n");
665 if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) { 615 return -EFAULT;
666 printk("VIDIOC_S_INPUT: could not address tea6415c #1\n");
667 return -EFAULT;
668 }
669 /* connect tuner-output always to multicable */
670 vm.in = 3;
671 vm.out = 13;
672 break;
673 }
674 case AUX3_YC:
675 {
676 /* nothing to be done here. aux3_yc is
677 directly connected to the saa711a */
678 i = 5;
679 break;
680 }
681 case AUX3:
682 {
683 /* nothing to be done here. aux3 is
684 directly connected to the saa711a */
685 i = 1;
686 break;
687 }
688 case AUX1:
689 {
690 i = 0;
691 vm.in = 1;
692 vm.out = 17;
693 break;
694 } 616 }
617 /* connect tuner-output always to multicable */
618 vm.in = 3;
619 vm.out = 13;
620 break;
621 case AUX3_YC:
622 /* nothing to be done here. aux3_yc is
623 directly connected to the saa711a */
624 i = SAA7115_SVIDEO1;
625 break;
626 case AUX3:
627 /* nothing to be done here. aux3 is
628 directly connected to the saa711a */
629 i = SAA7115_COMPOSITE1;
630 break;
631 case AUX1:
632 i = SAA7115_COMPOSITE0;
633 vm.in = 1;
634 vm.out = 17;
635 break;
695 } 636 }
696 637
697 /* switch video in tea6415c only if necessary */ 638 /* switch video in tea6415c only if necessary */
698 switch( input ) { 639 switch (input) {
699 case TUNER: 640 case TUNER:
700 case AUX1: 641 case AUX1:
701 { 642 if (mxb->tea6415c->driver->command(mxb->tea6415c, TEA6415C_SWITCH, &vm)) {
702 if ( 0 != mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm)) { 643 printk(KERN_ERR "VIDIOC_S_INPUT: could not address tea6415c #3\n");
703 printk("VIDIOC_S_INPUT: could not address tea6415c #3\n"); 644 return -EFAULT;
704 return -EFAULT;
705 }
706 break;
707 }
708 default:
709 {
710 break;
711 } 645 }
646 break;
647 default:
648 break;
712 } 649 }
713 650
714 /* switch video in saa7111a */ 651 /* switch video in saa7111a */
715 if ( 0 != mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i)) { 652 route.input = i;
653 route.output = 0;
654 if (mxb->saa7111a->driver->command(mxb->saa7111a, VIDIOC_INT_S_VIDEO_ROUTING, &route))
716 printk("VIDIOC_S_INPUT: could not address saa7111a #1.\n"); 655 printk("VIDIOC_S_INPUT: could not address saa7111a #1.\n");
717 }
718 656
719 /* switch the audio-source only if necessary */ 657 /* switch the audio-source only if necessary */
720 if( 0 == mxb->cur_mute ) { 658 if( 0 == mxb->cur_mute ) {
721 mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[input]][0]); 659 mxb->tea6420_1->driver->command(mxb->tea6420_1, TEA6420_SWITCH,
722 mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[video_audio_connect[input]][1]); 660 &TEA6420_line[video_audio_connect[input]][0]);
661 mxb->tea6420_2->driver->command(mxb->tea6420_2, TEA6420_SWITCH,
662 &TEA6420_line[video_audio_connect[input]][1]);
723 } 663 }
724 664
725 return 0; 665 return 0;
@@ -727,114 +667,44 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
727 case VIDIOC_G_TUNER: 667 case VIDIOC_G_TUNER:
728 { 668 {
729 struct v4l2_tuner *t = arg; 669 struct v4l2_tuner *t = arg;
730 int byte = 0;
731 670
732 if( 0 != t->index ) { 671 if (t->index) {
733 DEB_D(("VIDIOC_G_TUNER: channel %d does not have a tuner attached.\n", t->index)); 672 DEB_D(("VIDIOC_G_TUNER: channel %d does not have a tuner attached.\n", t->index));
734 return -EINVAL; 673 return -EINVAL;
735 } 674 }
736 675
737 DEB_EE(("VIDIOC_G_TUNER: %d\n", t->index)); 676 DEB_EE(("VIDIOC_G_TUNER: %d\n", t->index));
738 677
739 memset(t,0,sizeof(*t)); 678 memset(t, 0, sizeof(*t));
740 strcpy(t->name, "Television"); 679 i2c_clients_command(&mxb->i2c_adapter, cmd, arg);
741 680
681 strlcpy(t->name, "TV Tuner", sizeof(t->name));
742 t->type = V4L2_TUNER_ANALOG_TV; 682 t->type = V4L2_TUNER_ANALOG_TV;
743 t->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP; 683 t->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO | \
744 t->rangelow = 772; /* 48.25 MHZ / 62.5 kHz = 772, see fi1216mk2-specs, page 2 */ 684 V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP;
745 t->rangehigh = 13684; /* 855.25 MHz / 62.5 kHz = 13684 */
746 /* FIXME: add the real signal strength here */
747 t->signal = 0xffff;
748 t->afc = 0;
749
750 mxb->tda9840->driver->command(mxb->tda9840,TDA9840_DETECT, &byte);
751 t->audmode = mxb->cur_mode; 685 t->audmode = mxb->cur_mode;
752
753 if( byte < 0 ) {
754 t->rxsubchans = V4L2_TUNER_SUB_MONO;
755 } else {
756 switch(byte) {
757 case TDA9840_MONO_DETECT: {
758 t->rxsubchans = V4L2_TUNER_SUB_MONO;
759 DEB_D(("VIDIOC_G_TUNER: V4L2_TUNER_MODE_MONO.\n"));
760 break;
761 }
762 case TDA9840_DUAL_DETECT: {
763 t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
764 DEB_D(("VIDIOC_G_TUNER: V4L2_TUNER_MODE_LANG1.\n"));
765 break;
766 }
767 case TDA9840_STEREO_DETECT: {
768 t->rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;
769 DEB_D(("VIDIOC_G_TUNER: V4L2_TUNER_MODE_STEREO.\n"));
770 break;
771 }
772 default: { /* TDA9840_INCORRECT_DETECT */
773 t->rxsubchans = V4L2_TUNER_MODE_MONO;
774 DEB_D(("VIDIOC_G_TUNER: TDA9840_INCORRECT_DETECT => V4L2_TUNER_MODE_MONO\n"));
775 break;
776 }
777 }
778 }
779
780 return 0; 686 return 0;
781 } 687 }
782 case VIDIOC_S_TUNER: 688 case VIDIOC_S_TUNER:
783 { 689 {
784 struct v4l2_tuner *t = arg; 690 struct v4l2_tuner *t = arg;
785 int result = 0;
786 int byte = 0;
787 691
788 if( 0 != t->index ) { 692 if (t->index) {
789 DEB_D(("VIDIOC_S_TUNER: channel %d does not have a tuner attached.\n",t->index)); 693 DEB_D(("VIDIOC_S_TUNER: channel %d does not have a tuner attached.\n",t->index));
790 return -EINVAL; 694 return -EINVAL;
791 } 695 }
792 696
793 switch(t->audmode) { 697 mxb->cur_mode = t->audmode;
794 case V4L2_TUNER_MODE_STEREO: { 698 i2c_clients_command(&mxb->i2c_adapter, cmd, arg);
795 mxb->cur_mode = V4L2_TUNER_MODE_STEREO;
796 byte = TDA9840_SET_STEREO;
797 DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n"));
798 break;
799 }
800 case V4L2_TUNER_MODE_LANG1_LANG2: {
801 mxb->cur_mode = V4L2_TUNER_MODE_LANG1_LANG2;
802 byte = TDA9840_SET_BOTH;
803 DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n"));
804 break;
805 }
806 case V4L2_TUNER_MODE_LANG1: {
807 mxb->cur_mode = V4L2_TUNER_MODE_LANG1;
808 byte = TDA9840_SET_LANG1;
809 DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1\n"));
810 break;
811 }
812 case V4L2_TUNER_MODE_LANG2: {
813 mxb->cur_mode = V4L2_TUNER_MODE_LANG2;
814 byte = TDA9840_SET_LANG2;
815 DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG2\n"));
816 break;
817 }
818 default: { /* case V4L2_TUNER_MODE_MONO: {*/
819 mxb->cur_mode = V4L2_TUNER_MODE_MONO;
820 byte = TDA9840_SET_MONO;
821 DEB_D(("VIDIOC_S_TUNER: TDA9840_SET_MONO\n"));
822 break;
823 }
824 }
825
826 if( 0 != (result = mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &byte))) {
827 printk("VIDIOC_S_TUNER error. result:%d, byte:%d\n",result,byte);
828 }
829
830 return 0; 699 return 0;
831 } 700 }
832 case VIDIOC_G_FREQUENCY: 701 case VIDIOC_G_FREQUENCY:
833 { 702 {
834 struct v4l2_frequency *f = arg; 703 struct v4l2_frequency *f = arg;
835 704
836 if(0 != mxb->cur_input) { 705 if (mxb->cur_input) {
837 DEB_D(("VIDIOC_G_FREQ: channel %d does not have a tuner!\n",mxb->cur_input)); 706 DEB_D(("VIDIOC_G_FREQ: channel %d does not have a tuner!\n",
707 mxb->cur_input));
838 return -EINVAL; 708 return -EINVAL;
839 } 709 }
840 710
@@ -847,14 +717,14 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
847 { 717 {
848 struct v4l2_frequency *f = arg; 718 struct v4l2_frequency *f = arg;
849 719
850 if (0 != f->tuner) 720 if (f->tuner)
851 return -EINVAL; 721 return -EINVAL;
852 722
853 if (V4L2_TUNER_ANALOG_TV != f->type) 723 if (V4L2_TUNER_ANALOG_TV != f->type)
854 return -EINVAL; 724 return -EINVAL;
855 725
856 if(0 != mxb->cur_input) { 726 if (mxb->cur_input) {
857 DEB_D(("VIDIOC_S_FREQ: channel %d does not have a tuner!\n",mxb->cur_input)); 727 DEB_D(("VIDIOC_S_FREQ: channel %d does not have a tuner!\n", mxb->cur_input));
858 return -EINVAL; 728 return -EINVAL;
859 } 729 }
860 730
@@ -875,7 +745,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
875 { 745 {
876 int i = *(int*)arg; 746 int i = *(int*)arg;
877 747
878 if( i < 0 || i >= MXB_AUDIOS ) { 748 if (i < 0 || i >= MXB_AUDIOS) {
879 DEB_D(("illegal argument to MXB_S_AUDIO_CD: i:%d.\n",i)); 749 DEB_D(("illegal argument to MXB_S_AUDIO_CD: i:%d.\n",i));
880 return -EINVAL; 750 return -EINVAL;
881 } 751 }
@@ -891,7 +761,7 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
891 { 761 {
892 int i = *(int*)arg; 762 int i = *(int*)arg;
893 763
894 if( i < 0 || i >= MXB_AUDIOS ) { 764 if (i < 0 || i >= MXB_AUDIOS) {
895 DEB_D(("illegal argument to MXB_S_AUDIO_LINE: i:%d.\n",i)); 765 DEB_D(("illegal argument to MXB_S_AUDIO_LINE: i:%d.\n",i));
896 return -EINVAL; 766 return -EINVAL;
897 } 767 }
@@ -906,12 +776,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
906 { 776 {
907 struct v4l2_audio *a = arg; 777 struct v4l2_audio *a = arg;
908 778
909 if( a->index < 0 || a->index > MXB_INPUTS ) { 779 if (a->index < 0 || a->index > MXB_INPUTS) {
910 DEB_D(("VIDIOC_G_AUDIO %d out of range.\n",a->index)); 780 DEB_D(("VIDIOC_G_AUDIO %d out of range.\n", a->index));
911 return -EINVAL; 781 return -EINVAL;
912 } 782 }
913 783
914 DEB_EE(("VIDIOC_G_AUDIO %d.\n",a->index)); 784 DEB_EE(("VIDIOC_G_AUDIO %d.\n", a->index));
915 memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio)); 785 memcpy(a, &mxb_audios[video_audio_connect[mxb->cur_input]], sizeof(struct v4l2_audio));
916 786
917 return 0; 787 return 0;
@@ -919,9 +789,16 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg)
919 case VIDIOC_S_AUDIO: 789 case VIDIOC_S_AUDIO:
920 { 790 {
921 struct v4l2_audio *a = arg; 791 struct v4l2_audio *a = arg;
922 DEB_D(("VIDIOC_S_AUDIO %d.\n",a->index)); 792
793 DEB_D(("VIDIOC_S_AUDIO %d.\n", a->index));
923 return 0; 794 return 0;
924 } 795 }
796#ifdef CONFIG_VIDEO_ADV_DEBUG
797 case VIDIOC_DBG_S_REGISTER:
798 case VIDIOC_DBG_G_REGISTER:
799 i2c_clients_command(&mxb->i2c_adapter, cmd, arg);
800 return 0;
801#endif
925 default: 802 default:
926/* 803/*
927 DEB2(printk("does not handle this ioctl.\n")); 804 DEB2(printk("does not handle this ioctl.\n"));
@@ -944,7 +821,7 @@ static int std_callback(struct saa7146_dev *dev, struct saa7146_standard *standa
944 /* set the 7146 gpio register -- I don't know what this does exactly */ 821 /* set the 7146 gpio register -- I don't know what this does exactly */
945 saa7146_write(dev, GPIO_CTRL, 0x00404050); 822 saa7146_write(dev, GPIO_CTRL, 0x00404050);
946 /* unset the 7111 gpio register -- I don't know what this does exactly */ 823 /* unset the 7111 gpio register -- I don't know what this does exactly */
947 mxb->saa7111a->driver->command(mxb->saa7111a, DECODER_SET_GPIO, &zero); 824 mxb->saa7111a->driver->command(mxb->saa7111a, VIDIOC_INT_S_GPIO, &zero);
948 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); 825 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
949 } else { 826 } else {
950 v4l2_std_id std = V4L2_STD_PAL_BG; 827 v4l2_std_id std = V4L2_STD_PAL_BG;
@@ -953,7 +830,7 @@ static int std_callback(struct saa7146_dev *dev, struct saa7146_standard *standa
953 /* set the 7146 gpio register -- I don't know what this does exactly */ 830 /* set the 7146 gpio register -- I don't know what this does exactly */
954 saa7146_write(dev, GPIO_CTRL, 0x00404050); 831 saa7146_write(dev, GPIO_CTRL, 0x00404050);
955 /* set the 7111 gpio register -- I don't know what this does exactly */ 832 /* set the 7111 gpio register -- I don't know what this does exactly */
956 mxb->saa7111a->driver->command(mxb->saa7111a, DECODER_SET_GPIO, &one); 833 mxb->saa7111a->driver->command(mxb->saa7111a, VIDIOC_INT_S_GPIO, &one);
957 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std); 834 mxb->tuner->driver->command(mxb->tuner, VIDIOC_S_STD, &std);
958 } 835 }
959 return 0; 836 return 0;
@@ -1029,7 +906,7 @@ static struct saa7146_extension extension = {
1029 906
1030static int __init mxb_init_module(void) 907static int __init mxb_init_module(void)
1031{ 908{
1032 if( 0 != saa7146_register_extension(&extension)) { 909 if (saa7146_register_extension(&extension)) {
1033 DEB_S(("failed to register extension.\n")); 910 DEB_S(("failed to register extension.\n"));
1034 return -ENODEV; 911 return -ENODEV;
1035 } 912 }