return saa7191_set_norm(client, SAA7191_NORM_AUTO); 
return saa7191_autodetect_norm(client); 
static int saa7191_command(struct i2c_client *client, unsigned int cmd,			   void *arg){	struct saa7191 *decoder = i2c_get_clientdata(client);	switch (cmd) {	case DECODER_GET_CAPABILITIES: {		struct video_decoder_capability *cap = arg;		cap->flags  = VIDEO_DECODER_PAL | VIDEO_DECODER_NTSC |			      VIDEO_DECODER_SECAM | VIDEO_DECODER_AUTO;		cap->inputs = (client->adapter->id == I2C_HW_SGI_VINO) ? 2 : 1;		cap->outputs = 1;		break;	}	case DECODER_GET_STATUS: {		int *iarg = arg;		unsigned char status;		int res = 0;		if (saa7191_read_status(client, &status)) {			return -EIO;		}		if ((status & SAA7191_STATUS_HLCK) == 0)			res |= DECODER_STATUS_GOOD;		if (status & SAA7191_STATUS_CODE)			res |= DECODER_STATUS_COLOR;		switch (decoder->norm) {		case SAA7191_NORM_NTSC:			res |= DECODER_STATUS_NTSC;			break;		case SAA7191_NORM_PAL:			res |= DECODER_STATUS_PAL;			break;		case SAA7191_NORM_SECAM:			res |= DECODER_STATUS_SECAM;			break;		case SAA7191_NORM_AUTO:		default:			if (status & SAA7191_STATUS_FIDT)				res |= DECODER_STATUS_NTSC;			else				res |= DECODER_STATUS_PAL;			break;		}		*iarg = res;		break;	}	case DECODER_SET_NORM: {		int *iarg = arg;		switch (*iarg) {		case VIDEO_MODE_AUTO:			return saa7191_set_norm(client, SAA7191_NORM_AUTO);		case VIDEO_MODE_PAL:			return saa7191_set_norm(client, SAA7191_NORM_PAL);		case VIDEO_MODE_NTSC:			return saa7191_set_norm(client, SAA7191_NORM_NTSC);		case VIDEO_MODE_SECAM:			return saa7191_set_norm(client, SAA7191_NORM_SECAM);		default:			return -EINVAL;		}		break;	}	case DECODER_SET_INPUT:	{		int *iarg = arg;		switch (client->adapter->id) {		case I2C_HW_SGI_VINO:			return saa7191_set_input(client, *iarg);		default:			if (*iarg != 0)				return -EINVAL;		}		break;	}	case DECODER_SET_OUTPUT: {		int *iarg = arg;		/* not much choice of outputs */		if (*iarg != 0)			return -EINVAL;		break;	}	case DECODER_ENABLE_OUTPUT: {		/* Always enabled */		break;	}	case DECODER_SET_PICTURE: {		struct video_picture *pic = arg;		unsigned val;		int err;		val = (pic->hue >> 8) - 0x80;		err = saa7191_write_reg(client, SAA7191_REG_HUEC, val);		if (err)			return -EIO;		break;	}	case DECODER_SAA7191_GET_STATUS: {		struct saa7191_status *status = arg;		unsigned char status_reg;		if (saa7191_read_status(client, &status_reg))			return -EIO;		status->signal = ((status_reg & SAA7191_STATUS_HLCK) == 0)			? SAA7191_VALUE_ENABLED : SAA7191_VALUE_DISABLED;		status->ntsc = (status_reg & SAA7191_STATUS_FIDT)			? SAA7191_VALUE_ENABLED : SAA7191_VALUE_DISABLED;		status->color = (status_reg & SAA7191_STATUS_CODE)			? SAA7191_VALUE_ENABLED : SAA7191_VALUE_DISABLED;		status->input = decoder->input;		status->norm = decoder->norm;	}	case DECODER_SAA7191_SET_NORM: {		int *norm = arg;		return saa7191_set_norm(client, *norm);	}	case DECODER_SAA7191_GET_CONTROLS: {		struct saa7191_control *ctrl = arg;		return saa7191_get_controls(client, ctrl);	}	case DECODER_SAA7191_SET_CONTROLS: {		struct saa7191_control *ctrl = arg;		return saa7191_set_controls(client, ctrl);	}	default:		return -EINVAL;	}	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a637a114f36b94a1ad8b9867f43bac0414958420/saa7191.c/buggy/drivers/media/video/saa7191.c