SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) 
SiS_GetVCLK2Ptr(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short ModeIdIndex, unsigned short RefreshRateTableIndex) 
SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,                USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo){  USHORT CRT2Index,VCLKIndex=0,VCLKIndexGEN=0;  USHORT modeflag,resinfo,tempbx;  const UCHAR *CHTVVCLKPtr = NULL;  if(ModeNo <= 0x13) {     modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;     resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;     CRT2Index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;     VCLKIndexGEN = (SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)) >> 2) & 0x03;  } else {     modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;     resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;     CRT2Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;     VCLKIndexGEN = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;     if(HwInfo->jChipType < SIS_315H) VCLKIndexGEN &= 0x3f;  }  if(SiS_Pr->SiS_VBType & VB_SISVB) {    /* 30x/B/LV */     if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) {        CRT2Index >>= 6;        if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {      	/*  LCD */           if(HwInfo->jChipType < SIS_315H) {	      VCLKIndex = SiS_Pr->PanelVCLKIdx300;	      if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (SiS_Pr->SiS_LCDInfo & LCDPass11)) {	         VCLKIndex = VCLKIndexGEN;	      }	   } else {	      VCLKIndex = SiS_Pr->PanelVCLKIdx315;	      if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (SiS_Pr->SiS_LCDInfo & LCDPass11)) {		 switch(resinfo) {		 /* Only those whose IndexGEN doesn't match VBVCLK array */		 case SIS_RI_1280x720: VCLKIndex = VCLK_1280x720; break;		 case SIS_RI_720x480:  VCLKIndex = VCLK_720x480;  break;		 case SIS_RI_720x576:  VCLKIndex = VCLK_720x576;  break;		 case SIS_RI_768x576:  VCLKIndex = VCLK_768x576;  break;		 case SIS_RI_848x480:  VCLKIndex = VCLK_848x480;  break;		 case SIS_RI_856x480:  VCLKIndex = VCLK_856x480;  break;		 case SIS_RI_800x480:  VCLKIndex = VCLK_800x480;  break;		 case SIS_RI_1024x576: VCLKIndex = VCLK_1024x576; break;		 case SIS_RI_1152x864: VCLKIndex = VCLK_1152x864; break;		 case SIS_RI_1360x768: VCLKIndex = VCLK_1360x768; break;		 default:              VCLKIndex = VCLKIndexGEN;		 }		 if(ModeNo <= 0x13) {		    if(HwInfo->jChipType <= SIS_315PRO) {		       if(SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC == 1) VCLKIndex = 0x42;	            } else {		       if(SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC == 1) VCLKIndex = 0x00;		    }		 }		 if(HwInfo->jChipType <= SIS_315PRO) {		    if(VCLKIndex == 0) VCLKIndex = 0x41;		    if(VCLKIndex == 1) VCLKIndex = 0x43;		    if(VCLKIndex == 4) VCLKIndex = 0x44;		 }	      }	   }        } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {                 	/*  TV */	   if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {              if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) 		VCLKIndex = HiTVVCLKDIV2;     	      else                                  		VCLKIndex = HiTVVCLK;              if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {            	 if(modeflag & Charx8Dot) 	    		VCLKIndex = HiTVSimuVCLK;            	 else 			  	    		VCLKIndex = HiTVTextVCLK;              }           } else if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) 	VCLKIndex = YPbPr750pVCLK;	   else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p)   	VCLKIndex = TVVCLKDIV2;	   else if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO)     	VCLKIndex = TVVCLKDIV2;           else         		            	  	VCLKIndex = TVVCLK;	   if(HwInfo->jChipType < SIS_315H) VCLKIndex += TVCLKBASE_300;  	   else 	                    VCLKIndex += TVCLKBASE_315;        } else {         						/* VGA2 */	   VCLKIndex = VCLKIndexGEN;	   if(HwInfo->jChipType < SIS_315H) {              if(ModeNo > 0x13) {		 if( (HwInfo->jChipType == SIS_630) &&		     (HwInfo->jChipRevision >= 0x30)) {		    if(VCLKIndex == 0x14) VCLKIndex = 0x34;		 }		 /* Better VGA2 clock for 1280x1024@75 */		 if(VCLKIndex == 0x17) VCLKIndex = 0x45;	      }           }        }     } else {   /* If not programming CRT2 */        VCLKIndex = VCLKIndexGEN;	if(HwInfo->jChipType < SIS_315H) {           if(ModeNo > 0x13) {	      if( (HwInfo->jChipType != SIS_630) &&		  (HwInfo->jChipType != SIS_300) ) {		 if(VCLKIndex == 0x1b) VCLKIndex = 0x48;	      }	   }        }     }  } else {       /*   LVDS  */     VCLKIndex = CRT2Index;     if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) {        if( (SiS_Pr->SiS_IF_DEF_CH70xx != 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) ) {	   VCLKIndex &= 0x1f;           tempbx = 0;	   if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1;           if(SiS_Pr->SiS_TVMode & TVSetPAL) {	      tempbx += 2;	      if(SiS_Pr->SiS_ModeType > ModeVGA) {		 if(SiS_Pr->SiS_CHSOverScan) tempbx = 8;	      }	      if(SiS_Pr->SiS_TVMode & TVSetPALM) {		 tempbx = 4;		 if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1;	      } else if(SiS_Pr->SiS_TVMode & TVSetPALN) {		 tempbx = 6;		 if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1;	      }	   }       	   switch(tempbx) {             case  0: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUNTSC;  break;             case  1: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKONTSC;  break;             case  2: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPAL;   break;             case  3: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL;   break;	     case  4: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALM;  break;             case  5: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALM;  break;             case  6: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALN;  break;             case  7: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALN;  break;	     case  8: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKSOPAL;  break;	     default: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL;   break;           }           VCLKIndex = CHTVVCLKPtr[VCLKIndex];        } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {	   if(HwInfo->jChipType < SIS_315H) {	      VCLKIndex = SiS_Pr->PanelVCLKIdx300;	   } else {	      VCLKIndex = SiS_Pr->PanelVCLKIdx315;	   }	   /* Special Timing: Barco iQ Pro R series */	   if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) VCLKIndex = 0x44;	   /* Special Timing: 848x480 parallel lvds */	   if(SiS_Pr->SiS_CustomT == CUT_PANEL848) {	      if(HwInfo->jChipType < SIS_315H) {		 VCLKIndex = VCLK34_300;	         /* if(resinfo == SIS_RI_1360x768) VCLKIndex = ?; */	      } else {		 VCLKIndex = VCLK34_315;		 /* if(resinfo == SIS_RI_1360x768) VCLKIndex = ?; */	      }	   }        } else {	   VCLKIndex = VCLKIndexGEN;	   if(HwInfo->jChipType < SIS_315H) {              if(ModeNo > 0x13) {		 if( (HwInfo->jChipType == SIS_630) &&                     (HwInfo->jChipRevision >= 0x30) ) {		    if(VCLKIndex == 0x14) VCLKIndex = 0x2e;	         }              }	   }        }     } else {  /* if not programming CRT2 */        VCLKIndex = VCLKIndexGEN;	if(HwInfo->jChipType < SIS_315H) {           if(ModeNo > 0x13) {	      if( (HwInfo->jChipType != SIS_630) &&	          (HwInfo->jChipType != SIS_300) ) {		 if(VCLKIndex == 0x1b) VCLKIndex = 0x48;	      }#if 0	      if(HwInfo->jChipType == SIS_730) {		 if(VCLKIndex == 0x0b) VCLKIndex = 0x40;   /* 1024x768-70 */		 if(VCLKIndex == 0x0d) VCLKIndex = 0x41;   /* 1024x768-75 */	      }#endif	   }        }     }  }#ifdef TWDEBUG  xf86DrvMsg(0, X_INFO, "VCLKIndex %d (0x%x)\n", VCLKIndex, VCLKIndex);#endif  return(VCLKIndex);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/544393fe584d333480659a4bed30f5295355df11/init301.c/clean/drivers/video/sis/init301.c