/* FIXME: end-of-field bug workaround VINO_CLIP_X(VINO_PAL_WIDTH); */ 
static int vino_dma_setup(struct vino_channel_settings *vcs,			  struct vino_framebuffer *fb){	u32 ctrl, intr;	struct sgi_vino_channel *ch;	const struct vino_data_norm *norm;	dprintk("vino_dma_setup():\n");	vcs->field = 0;	fb->frame_counter = 0;	ch = (vcs->channel == VINO_CHANNEL_A) ? &vino->a : &vino->b;	norm = &vino_data_norms[vcs->data_norm];	ch->page_index = 0;	ch->line_count = 0;	/* VINO line size register is set 8 bytes less than actual */	ch->line_size = vcs->line_size - 8;	/* let VINO know where to transfer data */	ch->start_desc_tbl = fb->desc_table.dma;	ch->next_4_desc = fb->desc_table.dma;	/* give vino time to fetch the first four descriptors, 5 usec	 * should be more than enough time */	udelay(VINO_DESC_FETCH_DELAY);	/* set the alpha register */	ch->alpha = vcs->alpha;	/* set clipping registers */	ch->clip_start = VINO_CLIP_ODD(norm->odd.top + vcs->clipping.top / 2) |		VINO_CLIP_EVEN(norm->even.top +			       vcs->clipping.top / 2) |		VINO_CLIP_X(vcs->clipping.left);	ch->clip_end = VINO_CLIP_ODD(norm->odd.top +				     vcs->clipping.bottom / 2 - 1) |		VINO_CLIP_EVEN(norm->even.top +			       vcs->clipping.bottom / 2 - 1) |		VINO_CLIP_X(vcs->clipping.right);	/* FIXME: end-of-field bug workaround		       VINO_CLIP_X(VINO_PAL_WIDTH);	 */	/* set the size of actual content in the buffer (DECIMATION !) */	fb->data_size = ((vcs->clipping.right - vcs->clipping.left) /			 vcs->decimation) *		((vcs->clipping.bottom - vcs->clipping.top) /		 vcs->decimation) *		vino_data_formats[vcs->data_format].bpp;	ch->frame_rate = vcs->framert_reg;	ctrl = vino->control;	intr = vino->intr_status;	if (vcs->channel == VINO_CHANNEL_A) {		/* All interrupt conditions for this channel was cleared		 * so clear the interrupt status register and enable		 * interrupts */		intr &=	~VINO_INTSTAT_A;		ctrl |= VINO_CTRL_A_INT;		/* enable synchronization */		ctrl |= VINO_CTRL_A_SYNC_ENBL;		/* enable frame assembly */		ctrl |= VINO_CTRL_A_INTERLEAVE_ENBL;		/* set decimation used */		if (vcs->decimation < 2)			ctrl &= ~VINO_CTRL_A_DEC_ENBL;		else {			ctrl |= VINO_CTRL_A_DEC_ENBL;			ctrl &= ~VINO_CTRL_A_DEC_SCALE_MASK;			ctrl |= (vcs->decimation - 1) <<				VINO_CTRL_A_DEC_SCALE_SHIFT;		}		/* select input interface */		if (vcs->input == VINO_INPUT_D1)			ctrl |= VINO_CTRL_A_SELECT;		else			ctrl &= ~VINO_CTRL_A_SELECT;		/* palette */		ctrl &= ~(VINO_CTRL_A_LUMA_ONLY | VINO_CTRL_A_RGB |			  VINO_CTRL_A_DITHER);	} else {		intr &= ~VINO_INTSTAT_B;		ctrl |= VINO_CTRL_B_INT;		ctrl |= VINO_CTRL_B_SYNC_ENBL;		ctrl |= VINO_CTRL_B_INTERLEAVE_ENBL;		if (vcs->decimation < 2)			ctrl &= ~VINO_CTRL_B_DEC_ENBL;		else {			ctrl |= VINO_CTRL_B_DEC_ENBL;			ctrl &= ~VINO_CTRL_B_DEC_SCALE_MASK;			ctrl |= (vcs->decimation - 1) <<				VINO_CTRL_B_DEC_SCALE_SHIFT;		}		if (vcs->input == VINO_INPUT_D1)			ctrl |= VINO_CTRL_B_SELECT;		else			ctrl &= ~VINO_CTRL_B_SELECT;		ctrl &= ~(VINO_CTRL_B_LUMA_ONLY | VINO_CTRL_B_RGB |			  VINO_CTRL_B_DITHER);	}	/* set palette */	fb->data_format = vcs->data_format;	switch (vcs->data_format) {		case VINO_DATA_FMT_GREY:			ctrl |= (vcs->channel == VINO_CHANNEL_A) ?				VINO_CTRL_A_LUMA_ONLY : VINO_CTRL_B_LUMA_ONLY;			break;		case VINO_DATA_FMT_RGB32:			ctrl |= (vcs->channel == VINO_CHANNEL_A) ?				VINO_CTRL_A_RGB : VINO_CTRL_B_RGB;			break;		case VINO_DATA_FMT_YUV:			/* nothing needs to be done */			break;		case VINO_DATA_FMT_RGB332:			ctrl |= (vcs->channel == VINO_CHANNEL_A) ?				VINO_CTRL_A_RGB | VINO_CTRL_A_DITHER :				VINO_CTRL_B_RGB | VINO_CTRL_B_DITHER;			break;	}	vino->intr_status = intr;	vino->control = ctrl;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a637a114f36b94a1ad8b9867f43bac0414958420/vino.c/buggy/drivers/media/video/vino.c