} /* Wow to deal with V4L2_TUNER_CAP_LOW ? For now, it accepts from low at 62.5KHz step  to high at 62.5 Hz */ tuner->rangelow = tv_range[0] * 16;   tuner->rangehigh = tv_range[1] * 16384; break; } 
tuner->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; tuner->audmode = t->audmode;  tuner->rangelow = radio_range[0] * 16000; tuner->rangehigh = radio_range[1] * 16000; } else { tuner->rangelow = tv_range[0] * 16; tuner->rangehigh = tv_range[1] * 16; } break; } case VIDIOC_S_TUNER: /* Allow changing radio range and audio mode */ { struct v4l2_tuner *tuner = arg;  CHECK_ADDR(radio_tuner,"VIDIOC_S_TUNER","radio"); SWITCH_V4L2;  /* To switch the audio mode, applications initialize the index and audmode fields and the reserved array and call the VIDIOC_S_TUNER ioctl. */ /* rxsubchannels: V4L2_TUNER_MODE_MONO, V4L2_TUNER_MODE_STEREO, V4L2_TUNER_MODE_LANG1, V4L2_TUNER_MODE_LANG2, V4L2_TUNER_MODE_SAP */  if (tuner->audmode == V4L2_TUNER_MODE_MONO) t->audmode = V4L2_TUNER_MODE_MONO; else t->audmode = V4L2_TUNER_MODE_STEREO;  set_radio_freq(client, t->freq); break; } case TDA9887_SET_CONFIG: /* Nothing to do on tuner-core */ break; 
tuner_command(struct i2c_client *client, unsigned int cmd, void *arg){	struct tuner *t = i2c_get_clientdata(client);        unsigned int *iarg = (int*)arg;        switch (cmd) {	/* --- configuration --- */	case TUNER_SET_TYPE:		set_type(client,*iarg);		break;	case TUNER_SET_TYPE_ADDR:		set_addr(client,(struct tuner_addr *)arg);		break;	case AUDC_SET_RADIO:		t->mode = V4L2_TUNER_RADIO;		CHECK_ADDR(tv_tuner,"AUDC_SET_RADIO","TV");		if (V4L2_TUNER_RADIO != t->mode) {			set_tv_freq(client,400 * 16);		}		break;	case AUDC_CONFIG_PINNACLE:		CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE","TV");		switch (*iarg) {		case 2:			tuner_dbg("pinnacle pal\n");			t->radio_if2 = 33300 * 1000;			break;		case 3:			tuner_dbg("pinnacle ntsc\n");			t->radio_if2 = 41300 * 1000;			break;		}                break;	/* --- v4l ioctls --- */	/* take care: bttv does userspace copying, we'll get a	   kernel pointer here... */	case VIDIOCSCHAN:	{		static const v4l2_std_id map[] = {			[ VIDEO_MODE_PAL   ] = V4L2_STD_PAL,			[ VIDEO_MODE_NTSC  ] = V4L2_STD_NTSC_M,			[ VIDEO_MODE_SECAM ] = V4L2_STD_SECAM,			[ 4 /* bttv */     ] = V4L2_STD_PAL_M,			[ 5 /* bttv */     ] = V4L2_STD_PAL_N,			[ 6 /* bttv */     ] = V4L2_STD_NTSC_M_JP,		};		struct video_channel *vc = arg;		CHECK_V4L2;		t->mode = V4L2_TUNER_ANALOG_TV;		CHECK_ADDR(tv_tuner,"VIDIOCSCHAN","TV");		if (vc->norm < ARRAY_SIZE(map))			t->std = map[vc->norm];		tuner_fixup_std(t);		if (t->freq)			set_tv_freq(client,t->freq);		return 0;	}	case VIDIOCSFREQ:	{		unsigned long *v = arg;		CHECK_MODE("VIDIOCSFREQ");		CHECK_V4L2;		set_freq(client,*v);		return 0;	}	case VIDIOCGTUNER:	{		struct video_tuner *vt = arg;		CHECK_ADDR(radio_tuner,"VIDIOCGTUNER","radio");		CHECK_V4L2;		if (V4L2_TUNER_RADIO == t->mode) {			if (t->has_signal)				vt->signal = t->has_signal(client);			if (t->is_stereo) {				if (t->is_stereo(client))					vt-> flags |= VIDEO_TUNER_STEREO_ON;				else					vt-> flags &= 0xffff ^ VIDEO_TUNER_STEREO_ON;			}			vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */		}		return 0;	}	case VIDIOCGAUDIO:	{		struct video_audio *va = arg;		CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO","radio");		CHECK_V4L2;		if (V4L2_TUNER_RADIO == t->mode  &&  t->is_stereo)			va->mode = t->is_stereo(client)				? VIDEO_SOUND_STEREO				: VIDEO_SOUND_MONO;		return 0;	}	case VIDIOC_S_STD:	{		v4l2_std_id *id = arg;		SWITCH_V4L2;		t->mode = V4L2_TUNER_ANALOG_TV;		CHECK_ADDR(tv_tuner,"VIDIOC_S_STD","TV");		t->std = *id;		tuner_fixup_std(t);		if (t->freq)			set_freq(client,t->freq);		break;	}	case VIDIOC_S_FREQUENCY:	{		struct v4l2_frequency *f = arg;		CHECK_MODE("VIDIOC_S_FREQUENCY");		SWITCH_V4L2;		if (V4L2_TUNER_RADIO == f->type &&		    V4L2_TUNER_RADIO != t->mode)			set_tv_freq(client,400*16);		t->mode  = f->type;		set_freq(client,f->frequency);		break;	}	case VIDIOC_G_FREQUENCY:	{		struct v4l2_frequency *f = arg;		CHECK_MODE("VIDIOC_G_FREQUENCY");		SWITCH_V4L2;		f->type = t->mode;		f->frequency = t->freq;		break;	}	case VIDIOC_G_TUNER:	{		struct v4l2_tuner *tuner = arg;		CHECK_MODE("VIDIOC_G_TUNER");		SWITCH_V4L2;		if (V4L2_TUNER_RADIO == t->mode) {			if (t->has_signal)				tuner -> signal = t->has_signal(client);			if (t->is_stereo) {				if (t->is_stereo(client)) {					tuner -> capability |= V4L2_TUNER_CAP_STEREO;					tuner -> rxsubchans |= V4L2_TUNER_SUB_STEREO;				} else {					tuner -> rxsubchans &= 0xffff ^ V4L2_TUNER_SUB_STEREO;				}			}		}		/* Wow to deal with V4L2_TUNER_CAP_LOW ? For now, it accepts from low at 62.5KHz step  to high at 62.5 Hz */		tuner->rangelow = tv_range[0] * 16;//		tuner->rangehigh = tv_range[1] * 16;//		tuner->rangelow = tv_range[0] * 16384;		tuner->rangehigh = tv_range[1] * 16384;		break;	}	default:		tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd);		/* nothing */		break;	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/586b0cab2516640fec4dffc3049c4d8bca188f89/tuner-core.c/clean/drivers/media/video/tuner-core.c