if (chip->prevmode != VIDEO_SOUND_MONO) chip->prevmode = -1; /* reset previous mode */ 
if (chip->prevmode != VIDEO_SOUND_MONO) chip->prevmode = -1; /* reset previous mode */ 
static int chip_command(struct i2c_client *client,			unsigned int cmd, void *arg){        __u16 *sarg = arg;	struct CHIPSTATE *chip = i2c_get_clientdata(client);	struct CHIPDESC  *desc = chiplist + chip->type;	dprintk("%s: chip_command 0x%x\n", chip->c.name, cmd);	switch (cmd) {	case AUDC_SET_INPUT:		if (desc->flags & CHIP_HAS_INPUTSEL) {			if (*sarg & 0x80)				chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask);			else				chip_write_masked(chip,desc->inputreg,desc->inputmap[*sarg],desc->inputmask);		}		break;	case AUDC_SET_RADIO:		dprintk(KERN_DEBUG "tvaudio: AUDC_SET_RADIO\n");		chip->norm = VIDEO_MODE_RADIO;		chip->watch_stereo = 0;		/* del_timer(&chip->wt); */		break;	/* --- v4l ioctls --- */	/* take care: bttv does userspace copying, we'll get a	   kernel pointer here... */	case VIDIOCGAUDIO:	{		struct video_audio *va = arg;		if (desc->flags & CHIP_HAS_VOLUME) {			va->flags  |= VIDEO_AUDIO_VOLUME;			va->volume  = max(chip->left,chip->right);			if (va->volume)				va->balance = (32768*min(chip->left,chip->right))/					va->volume;			else				va->balance = 32768;		}		if (desc->flags & CHIP_HAS_BASSTREBLE) {			va->flags |= VIDEO_AUDIO_BASS | VIDEO_AUDIO_TREBLE;			va->bass   = chip->bass;			va->treble = chip->treble;		}		if (chip->norm != VIDEO_MODE_RADIO) {			if (desc->getmode)				va->mode = desc->getmode(chip);			else				va->mode = VIDEO_SOUND_MONO;		}		break;	}	case VIDIOCSAUDIO:	{		struct video_audio *va = arg;		if (desc->flags & CHIP_HAS_VOLUME) {			chip->left = (min(65536 - va->balance,32768) *				      va->volume) / 32768;			chip->right = (min(va->balance,(__u16)32768) *				       va->volume) / 32768;			chip_write(chip,desc->leftreg,desc->volfunc(chip->left));			chip_write(chip,desc->rightreg,desc->volfunc(chip->right));		}		if (desc->flags & CHIP_HAS_BASSTREBLE) {			chip->bass = va->bass;			chip->treble = va->treble;			chip_write(chip,desc->bassreg,desc->bassfunc(chip->bass));			chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));		}		if (desc->setmode && va->mode) {			chip->watch_stereo = 0;			/* del_timer(&chip->wt); */			chip->mode = va->mode;			desc->setmode(chip,va->mode);		}		break;	}	case VIDIOCSCHAN:	{		struct video_channel *vc = arg;		dprintk(KERN_DEBUG "tvaudio: VIDIOCSCHAN\n");		chip->norm = vc->norm;		break;	}	case VIDIOCSFREQ:	{	    	chip->mode = 0; /* automatic */		if (desc->checkmode) {			desc->setmode(chip,VIDEO_SOUND_MONO);		    	if (chip->prevmode != VIDEO_SOUND_MONO)		    		chip->prevmode = -1; /* reset previous mode */			mod_timer(&chip->wt, jiffies+2*HZ);			/* the thread will call checkmode() later */		}	}	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/18fc59e230bbda9725736f8f526ef88aab212348/tvaudio.c/clean/drivers/media/video/tvaudio.c