mxb->cur_freq = freq; 
static int mxb_init_done(struct saa7146_dev* dev){	struct mxb* mxb = (struct mxb*)dev->ext_priv;	struct video_decoder_init init;	struct i2c_msg msg;	struct tuner_setup tun_setup;	int i = 0, err = 0;	struct	tea6415c_multiplex vm;		/* select video mode in saa7111a */	i = VIDEO_MODE_PAL;	/* fixme: currently pointless: gets overwritten by configuration below */	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_NORM, &i);	/* write configuration to saa7111a */	init.data = mxb_saa7111_init;	init.len = sizeof(mxb_saa7111_init);	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_INIT, &init);	/* select tuner-output on saa7111a */	i = 0;	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_INPUT, &i);	/* enable vbi bypass */	i = 1;	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i);	/* select a tuner type */	tun_setup.mode_mask = T_ANALOG_TV;	tun_setup.addr = ADDR_UNSET;	tun_setup.type = 5;	mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup);		/* mute audio on tea6420s */	mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);	mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_line[6][1]);	mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_cd[6][0]);	mxb->tea6420_2->driver->command(mxb->tea6420_2,TEA6420_SWITCH, &TEA6420_cd[6][1]);	/* switch to tuner-channel on tea6415c*/	vm.out = 17;	vm.in  = 3;	mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm);	/* select tuner-output on multicable on tea6415c*/	vm.in  = 3;	vm.out = 13;	mxb->tea6415c->driver->command(mxb->tea6415c,TEA6415C_SWITCH, &vm);					/* tune in some frequency on tuner */	mxb->tuner->driver->command(mxb->tuner, VIDIOCSFREQ, &freq);	/* the rest for mxb */	mxb->cur_input = 0;	mxb->cur_freq = freq;	mxb->cur_mute = 1;	mxb->cur_mode = V4L2_TUNER_MODE_STEREO;	mxb->tda9840->driver->command(mxb->tda9840, TDA9840_SWITCH, &mxb->cur_mode);				/* check if the saa7740 (aka 'sound arena module') is present	   on the mxb. if so, we must initialize it. due to lack of 	   informations about the saa7740, the values were reverse	   engineered. */	msg.addr = 0x1b;	msg.flags = 0;	msg.len = mxb_saa7740_init[0].length;	msg.buf = &mxb_saa7740_init[0].data[0];	if( 1 == (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) {		/* the sound arena module is a pos, that's probably the reason		   philips refuses to hand out a datasheet for the saa7740...		   it seems to screw up the i2c bus, so we disable fast irq		   based i2c transactions here and rely on the slow and safe		   polling method ... */		extension.flags &= ~SAA7146_USE_I2C_IRQ;		for(i = 1;;i++) {			if( -1 == mxb_saa7740_init[i].length ) {				break;			}			msg.len = mxb_saa7740_init[i].length;					msg.buf = &mxb_saa7740_init[i].data[0];			if( 1 != (err = i2c_transfer(&mxb->i2c_adapter, &msg, 1))) {				DEB_D(("failed to initialize 'sound arena module'.\n"));				goto err;			}		}		INFO(("'sound arena module' detected.\n"));	}err:		/* the rest for saa7146: you should definitely set some basic values	   for the input-port handling of the saa7146. */	/* ext->saa has been filled by the core driver */	   	/* some stuff is done via variables */	saa7146_set_hps_source_and_sync(dev, input_port_selection[mxb->cur_input].hps_source, input_port_selection[mxb->cur_input].hps_sync);	/* some stuff is done via direct write to the registers */	/* this is ugly, but because of the fact that this is completely	   hardware dependend, it should be done directly... */      	saa7146_write(dev, DD1_STREAM_B,	0x00000000);	saa7146_write(dev, DD1_INIT,		0x02000200);	saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/9d2599d98e9cb511f326b2d1b353e462bc360774/mxb.c/clean/drivers/media/video/mxb.c