#else { struct video_channel c; memset(&c,0,sizeof(c)); c.channel = core->input; c.norm = VIDEO_MODE_PAL; if ((norm->id & (V4L2_STD_NTSC_M|V4L2_STD_NTSC_M_JP))) c.norm = VIDEO_MODE_NTSC; if (norm->id & V4L2_STD_SECAM) c.norm = VIDEO_MODE_SECAM; cx88_call_i2c_clients(core,VIDIOCSCHAN,&c); } #endif 
int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm){	u32 fsc8;	u32 adc_clock;	u32 vdec_clock;	u32 step_db,step_dr;	u64 tmp64;	u32 bdelay,agcdelay,htotal;	core->tvnorm = norm;	fsc8       = norm_fsc8(norm);	adc_clock  = xtal;	vdec_clock = fsc8;	step_db    = fsc8;	step_dr    = fsc8;	if (norm->id & V4L2_STD_SECAM) {		step_db = 4250000 * 8;		step_dr = 4406250 * 8;	}	dprintk(1,"set_tvnorm: \"%s\" fsc8=%d adc=%d vdec=%d db/dr=%d/%d\n",		norm->name, fsc8, adc_clock, vdec_clock, step_db, step_dr);	set_pll(core,2,vdec_clock);	dprintk(1,"set_tvnorm: MO_INPUT_FORMAT  0x%08x [old=0x%08x]\n",		norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);	cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat);#if 1	// FIXME: as-is from DScaler	dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",		norm->cxoformat, cx_read(MO_OUTPUT_FORMAT));	cx_write(MO_OUTPUT_FORMAT, norm->cxoformat);#endif	// MO_SCONV_REG = adc clock / video dec clock * 2^17	tmp64  = adc_clock * (u64)(1 << 17);	do_div(tmp64, vdec_clock);	dprintk(1,"set_tvnorm: MO_SCONV_REG     0x%08x [old=0x%08x]\n",		(u32)tmp64, cx_read(MO_SCONV_REG));	cx_write(MO_SCONV_REG, (u32)tmp64);	// MO_SUB_STEP = 8 * fsc / video dec clock * 2^22	tmp64  = step_db * (u64)(1 << 22);	do_div(tmp64, vdec_clock);	dprintk(1,"set_tvnorm: MO_SUB_STEP      0x%08x [old=0x%08x]\n",		(u32)tmp64, cx_read(MO_SUB_STEP));	cx_write(MO_SUB_STEP, (u32)tmp64);	// MO_SUB_STEP_DR = 8 * 4406250 / video dec clock * 2^22	tmp64  = step_dr * (u64)(1 << 22);	do_div(tmp64, vdec_clock);	dprintk(1,"set_tvnorm: MO_SUB_STEP_DR   0x%08x [old=0x%08x]\n",		(u32)tmp64, cx_read(MO_SUB_STEP_DR));	cx_write(MO_SUB_STEP_DR, (u32)tmp64);	// bdelay + agcdelay	bdelay   = vdec_clock * 65 / 20000000 + 21;	agcdelay = vdec_clock * 68 / 20000000 + 15;	dprintk(1,"set_tvnorm: MO_AGC_BURST     0x%08x [old=0x%08x,bdelay=%d,agcdelay=%d]\n",		(bdelay << 8) | agcdelay, cx_read(MO_AGC_BURST), bdelay, agcdelay);	cx_write(MO_AGC_BURST, (bdelay << 8) | agcdelay);	// htotal	tmp64 = norm_htotal(norm) * (u64)vdec_clock;	do_div(tmp64, fsc8);	htotal = (u32)tmp64 | (norm_notchfilter(norm) << 11);	dprintk(1,"set_tvnorm: MO_HTOTAL        0x%08x [old=0x%08x,htotal=%d]\n",		htotal, cx_read(MO_HTOTAL), (u32)tmp64);	cx_write(MO_HTOTAL, htotal);	// vbi stuff	cx_write(MO_VBI_PACKET, ((1 << 11) | /* (norm_vdelay(norm)   << 11) | */				 norm_vbipack(norm)));	// this is needed as well to set all tvnorm parameter	cx88_set_scale(core, 320, 240, V4L2_FIELD_INTERLACED);	// audio	set_tvaudio(core);	// tell i2c chips#ifdef V4L2_I2C_CLIENTS	cx88_call_i2c_clients(core,VIDIOC_S_STD,&norm->id);#else	{		struct video_channel c;		memset(&c,0,sizeof(c));		c.channel = core->input;		c.norm = VIDEO_MODE_PAL;		if ((norm->id & (V4L2_STD_NTSC_M|V4L2_STD_NTSC_M_JP)))			c.norm = VIDEO_MODE_NTSC;		if (norm->id & V4L2_STD_SECAM)			c.norm = VIDEO_MODE_SECAM;		cx88_call_i2c_clients(core,VIDIOCSCHAN,&c);	}#endif	// done	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a82decf64d34e79a0cc622997866c754350f18f8/cx88-core.c/buggy/drivers/media/video/cx88/cx88-core.c