t->muted=(va->flags & VIDEO_AUDIO_MUTE); 
t->muted=(va->flags & VIDEO_AUDIO_MUTE); 
static int tda7432_command(struct i2c_client *client,			   unsigned int cmd, void *arg){	struct tda7432 *t = i2c_get_clientdata(client);	d2printk("tda7432: In tda7432_command\n");	switch (cmd) {	/* --- v4l ioctls --- */	/* take care: bttv does userspace copying, we'll get a	   kernel pointer here... */	/* Query card - scale from TDA7432 settings to V4L settings */	case VIDIOCGAUDIO:	{		struct video_audio *va = arg;		dprintk("tda7432: VIDIOCGAUDIO\n");		va->flags |= VIDEO_AUDIO_VOLUME |			VIDEO_AUDIO_BASS |			VIDEO_AUDIO_TREBLE |			VIDEO_AUDIO_MUTABLE;		if (t->muted)			va->flags |= VIDEO_AUDIO_MUTE;		va->mode |= VIDEO_SOUND_STEREO;		/* Master volume control		 * V4L volume is min 0, max 65535		 * TDA7432 Volume:		 * Min (-79dB) is 0x6f		 * Max (+20dB) is 0x07 (630)		 * Max (0dB) is 0x20 (829)		 * (Mask out bit 7 of vol - it's for the loudness setting)		 */		if (!maxvol){  /* max +20db */			va->volume = ( 0x6f - (t->volume & 0x7F) ) * 630;		} else {       /* max 0db   */			va->volume = ( 0x6f - (t->volume & 0x7F) ) * 829;		}		/* Balance depends on L,R attenuation		 * V4L balance is 0 to 65535, middle is 32768		 * TDA7432 attenuation: min (0dB) is 0, max (-37.5dB) is 0x1f		 * to scale up to V4L numbers, mult by 1057		 * attenuation exists for lf, lr, rf, rr		 * we use only lf and rf (front channels)		 */		if ( (t->lf) < (t->rf) )			/* right is attenuated, balance shifted left */			va->balance = (32768 - 1057*(t->rf));		else			/* left is attenuated, balance shifted right */			va->balance = (32768 + 1057*(t->lf));		/* Bass/treble 4 bits each */		va->bass=t->bass;		if(va->bass >= 0x8)			va->bass = ~(va->bass - 0x8) & 0xf;		va->bass = (va->bass << 12)+(va->bass << 8)+(va->bass << 4)+(va->bass);		va->treble=t->treble;		if(va->treble >= 0x8)			va->treble = ~(va->treble - 0x8) & 0xf;		va->treble = (va->treble << 12)+(va->treble << 8)+(va->treble << 4)+(va->treble);		break; /* VIDIOCGAUDIO case */	}	/* Set card - scale from V4L settings to TDA7432 settings */	case VIDIOCSAUDIO:	{		struct video_audio *va = arg;		dprintk("tda7432: VIDEOCSAUDIO\n");		if(va->flags & VIDEO_AUDIO_VOLUME){			if(!maxvol){ /* max +20db */				t->volume = 0x6f - ((va->volume)/630);			} else {    /* max 0db   */				t->volume = 0x6f - ((va->volume)/829);			}		if (loudness)		/* Turn on the loudness bit */			t->volume |= TDA7432_LD_ON;			tda7432_write(client,TDA7432_VL, t->volume);		}		if(va->flags & VIDEO_AUDIO_BASS)		{			t->bass = va->bass >> 12;			if(t->bass>= 0x8)					t->bass = (~t->bass & 0xf) + 0x8 ;		}		if(va->flags & VIDEO_AUDIO_TREBLE)		{			t->treble= va->treble >> 12;			if(t->treble>= 0x8)					t->treble = (~t->treble & 0xf) + 0x8 ;		}		if(va->flags & (VIDEO_AUDIO_TREBLE| VIDEO_AUDIO_BASS))			tda7432_write(client,TDA7432_TN, 0x10 | (t->bass << 4) | t->treble );		if(va->flags & VIDEO_AUDIO_BALANCE)	{		if (va->balance < 32768)		{			/* shifted to left, attenuate right */			t->rr = (32768 - va->balance)/1057;			t->rf = t->rr;			t->lr = TDA7432_ATTEN_0DB;			t->lf = TDA7432_ATTEN_0DB;		}		else if(va->balance > 32769)		{			/* shifted to right, attenuate left */			t->lf = (va->balance - 32768)/1057;			t->lr = t->lf;			t->rr = TDA7432_ATTEN_0DB;			t->rf = TDA7432_ATTEN_0DB;		}		else		{			/* centered */			t->rr = TDA7432_ATTEN_0DB;			t->rf = TDA7432_ATTEN_0DB;			t->lf = TDA7432_ATTEN_0DB;			t->lr = TDA7432_ATTEN_0DB;		}		}	 	t->muted=(va->flags & VIDEO_AUDIO_MUTE);		if (t->muted)		{			/* Mute & update balance*/			tda7432_write(client,TDA7432_LF, t->lf | TDA7432_MUTE);			tda7432_write(client,TDA7432_LR, t->lr | TDA7432_MUTE);			tda7432_write(client,TDA7432_RF, t->rf | TDA7432_MUTE);			tda7432_write(client,TDA7432_RR, t->rr | TDA7432_MUTE);		} else {			tda7432_write(client,TDA7432_LF, t->lf);			tda7432_write(client,TDA7432_LR, t->lr);			tda7432_write(client,TDA7432_RF, t->rf);			tda7432_write(client,TDA7432_RR, t->rr);		}		break;	} /* end of VIDEOCSAUDIO case */	default: /* Not VIDEOCGAUDIO or VIDEOCSAUDIO */		/* nothing */		d2printk("tda7432: Default\n");	} /* end of (cmd) switch */	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4ac97914c6c35f6bf132071c718e034d0846b9f5/tda7432.c/clean/drivers/media/video/tda7432.c