if(ivideo->chip >= SIS_661) { cr38 |= 0x04; if(ivideo->vbflags & TV_YPBPR525P)       cr35 |= 0x20; 
if(ivideo->chip >= SIS_661) { cr38 |= 0x04; if(ivideo->vbflags & TV_YPBPR525P)       cr35 |= 0x20; 
sisfb_pre_setmode(struct sis_video_info *ivideo){	u8 cr30 = 0, cr31 = 0, cr33 = 0, cr35 = 0, cr38 = 0;	int tvregnum = 0;	ivideo->currentvbflags &= (VB_VIDEOBRIDGE | VB_DISPTYPE_DISP2);	inSISIDXREG(SISCR, 0x31, cr31);	cr31 &= ~0x60;	cr31 |= 0x04;	cr33 = ivideo->rate_idx & 0x0F;#ifdef CONFIG_FB_SIS_315	if(ivideo->sisvga_engine == SIS_315_VGA) {	   if(ivideo->chip >= SIS_661) {	      inSISIDXREG(SISCR, 0x38, cr38);	      cr38 &= ~0x07;  /* Clear LCDA/DualEdge and YPbPr bits */	   } else {	      tvregnum = 0x38;	      inSISIDXREG(SISCR, tvregnum, cr38);	      cr38 &= ~0x3b;  /* Clear LCDA/DualEdge and YPbPr bits */	   }	}#endif#ifdef CONFIG_FB_SIS_300	if(ivideo->sisvga_engine == SIS_300_VGA) {	   tvregnum = 0x35;	   inSISIDXREG(SISCR, tvregnum, cr38);	}#endif	SiS_SetEnableDstn(&ivideo->SiS_Pr, FALSE);	SiS_SetEnableFstn(&ivideo->SiS_Pr, FALSE);	switch(ivideo->currentvbflags & VB_DISPTYPE_DISP2) {	   case CRT2_TV:	      cr38 &= ~0xc0;   /* Clear PAL-M / PAL-N bits */	      if((ivideo->vbflags & TV_YPBPR) && (ivideo->vbflags & (VB_301C|VB_301LV|VB_302LV))) {#ifdef CONFIG_FB_SIS_315	         if(ivideo->chip >= SIS_661) {	            cr38 |= 0x04;	            if(ivideo->vbflags & TV_YPBPR525P)       cr35 |= 0x20;		    else if(ivideo->vbflags & TV_YPBPR750P)  cr35 |= 0x40;		    else if(ivideo->vbflags & TV_YPBPR1080I) cr35 |= 0x60;		    cr30 |= SIS_SIMULTANEOUS_VIEW_ENABLE;		    cr35 &= ~0x01;		    ivideo->currentvbflags |= (TV_YPBPR | (ivideo->vbflags & TV_YPBPRALL));	         } else if(ivideo->sisvga_engine == SIS_315_VGA) {	            cr30 |= (0x80 | SIS_SIMULTANEOUS_VIEW_ENABLE);		    cr38 |= 0x08;	            if(ivideo->vbflags & TV_YPBPR525P)       cr38 |= 0x10;		    else if(ivideo->vbflags & TV_YPBPR750P)  cr38 |= 0x20;		    else if(ivideo->vbflags & TV_YPBPR1080I) cr38 |= 0x30;		    cr31 &= ~0x01;		    ivideo->currentvbflags |= (TV_YPBPR | (ivideo->vbflags & TV_YPBPRALL));	         }#endif	      } else if((ivideo->vbflags & TV_HIVISION) && (ivideo->vbflags & (VB_301|VB_301B|VB_302B))) {	         if(ivideo->chip >= SIS_661) {	            cr38 |= 0x04;	            cr35 |= 0x60;	         } else {	            cr30 |= 0x80;	         }		 cr30 |= SIS_SIMULTANEOUS_VIEW_ENABLE;	         cr31 |= 0x01;	         cr35 |= 0x01;		 ivideo->currentvbflags |= TV_HIVISION;	      } else if(ivideo->vbflags & TV_SCART) {		 cr30 = (SIS_VB_OUTPUT_SCART | SIS_SIMULTANEOUS_VIEW_ENABLE);		 cr31 |= 0x01;		 cr35 |= 0x01;		 ivideo->currentvbflags |= TV_SCART;	      } else {		 if(ivideo->vbflags & TV_SVIDEO) {		    cr30 = (SIS_VB_OUTPUT_SVIDEO | SIS_SIMULTANEOUS_VIEW_ENABLE);		    ivideo->currentvbflags |= TV_SVIDEO;		 }		 if(ivideo->vbflags & TV_AVIDEO) {		    cr30 = (SIS_VB_OUTPUT_COMPOSITE | SIS_SIMULTANEOUS_VIEW_ENABLE);		    ivideo->currentvbflags |= TV_AVIDEO;		 }	      }	      cr31 |= SIS_DRIVER_MODE;	      if(ivideo->vbflags & (TV_AVIDEO|TV_SVIDEO)) {	         if(ivideo->vbflags & TV_PAL) {		    cr31 |= 0x01; cr35 |= 0x01;		    ivideo->currentvbflags |= TV_PAL;		    if(ivideo->vbflags & TV_PALM) {		       cr38 |= 0x40; cr35 |= 0x04;		       ivideo->currentvbflags |= TV_PALM;		    } else if(ivideo->vbflags & TV_PALN) {		       cr38 |= 0x80; cr35 |= 0x08;		       ivideo->currentvbflags |= TV_PALN;	  	    }                 } else {		    cr31 &= ~0x01; cr35 &= ~0x01;		    ivideo->currentvbflags |= TV_NTSC;		    if(ivideo->vbflags & TV_NTSCJ) {		       cr38 |= 0x40; cr35 |= 0x02;		       ivideo->currentvbflags |= TV_NTSCJ;	 	    }		 }	      }	      break;	   case CRT2_LCD:	      cr30  = (SIS_VB_OUTPUT_LCD | SIS_SIMULTANEOUS_VIEW_ENABLE);	      cr31 |= SIS_DRIVER_MODE;	      SiS_SetEnableDstn(&ivideo->SiS_Pr, ivideo->sisfb_dstn);	      SiS_SetEnableFstn(&ivideo->SiS_Pr, ivideo->sisfb_fstn);	      break;	   case CRT2_VGA:	      cr30 = (SIS_VB_OUTPUT_CRT2 | SIS_SIMULTANEOUS_VIEW_ENABLE);	      cr31 |= SIS_DRIVER_MODE;	      if(ivideo->sisfb_nocrt2rate) {		 cr33 |= (sisbios_mode[ivideo->sisfb_mode_idx].rate_idx << 4);	      } else {		 cr33 |= ((ivideo->rate_idx & 0x0F) << 4);	      }	      break;	   default:	/* disable CRT2 */	      cr30 = 0x00;	      cr31 |= (SIS_DRIVER_MODE | SIS_VB_OUTPUT_DISABLE);	}	outSISIDXREG(SISCR, 0x30, cr30);	outSISIDXREG(SISCR, 0x33, cr33);	if(ivideo->chip >= SIS_661) {#ifdef CONFIG_FB_SIS_315	   cr31 &= ~0x01;                          /* Clear PAL flag (now in CR35) */	   setSISIDXREG(SISCR, 0x35, ~0x10, cr35); /* Leave overscan bit alone */	   cr38 &= 0x07;                           /* Use only LCDA and HiVision/YPbPr bits */	   setSISIDXREG(SISCR, 0x38, 0xf8, cr38);#endif	} else if(ivideo->chip != SIS_300) {	   outSISIDXREG(SISCR, tvregnum, cr38);	}	outSISIDXREG(SISCR, 0x31, cr31);	if(ivideo->accel) sisfb_syncaccel(ivideo);	ivideo->SiS_Pr.SiS_UseOEM = ivideo->sisfb_useoem;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/544393fe584d333480659a4bed30f5295355df11/sis_main.c/clean/drivers/video/sis/sis_main.c