/* --- v4l ioctls --- */ 
/* --- v4l ioctls --- */ 
static int tda9875_command(struct i2c_client *client,				unsigned int cmd, void *arg){	struct tda9875 *t = i2c_get_clientdata(client);	dprintk("In tda9875_command...\n");	switch (cmd) {        /* --- v4l ioctls --- */	/* take care: bttv does userspace copying, we'll get a	   kernel pointer here... */	case VIDIOCGAUDIO:	{		struct video_audio *va = arg;		int left,right;		dprintk("VIDIOCGAUDIO\n");		va->flags |= VIDEO_AUDIO_VOLUME |			VIDEO_AUDIO_BASS |			VIDEO_AUDIO_TREBLE;		/* min is -84 max is 24 */		left = (t->lvol+84)*606;		right = (t->rvol+84)*606;		va->volume=max(left,right);		va->balance=(32768*min(left,right))/			(va->volume ? va->volume : 1);		va->balance=(left<right)?			(65535-va->balance) : va->balance;		va->bass = (t->bass+12)*2427;    /* min -12 max +15 */		va->treble = (t->treble+12)*2730;/* min -12 max +12 */		va->mode |= VIDEO_SOUND_MONO;		break; /* VIDIOCGAUDIO case */	}	case VIDIOCSAUDIO:	{		struct video_audio *va = arg;		int left,right;		dprintk("VIDEOCSAUDIO...\n");		left = (min(65536 - va->balance,32768) *			va->volume) / 32768;		right = (min(va->balance,(__u16)32768) *			 va->volume) / 32768;		t->lvol = ((left/606)-84) & 0xff;		if (t->lvol > 24)		 t->lvol = 24;		if (t->lvol < -84)		 t->lvol = -84 & 0xff;		t->rvol = ((right/606)-84) & 0xff;		if (t->rvol > 24)		 t->rvol = 24;		if (t->rvol < -84)		 t->rvol = -84 & 0xff;		t->bass = ((va->bass/2400)-12) & 0xff;		if (t->bass > 15)		 t->bass = 15;		if (t->bass < -12)		 t->bass = -12 & 0xff;		t->treble = ((va->treble/2700)-12) & 0xff;		if (t->treble > 12)		 t->treble = 12;		if (t->treble < -12)		 t->treble = -12 & 0xff;//printk("tda9875 bal:%04x vol:%04x bass:%04x treble:%04x\n",va->balance,va->volume,va->bass,va->treble);                tda9875_set(client);		break;	} /* end of VIDEOCSAUDIO case */	default: /* Not VIDEOCGAUDIO or VIDEOCSAUDIO */		/* nothing */		dprintk("Default\n");	} /* end of (cmd) switch */	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4ac97914c6c35f6bf132071c718e034d0846b9f5/tda9875.c/buggy/drivers/media/video/tda9875.c