if(ivideo->vbflags & VB_301) { 
if(ivideo->vbflags2 & VB2_301) { 
static void __devinit SiS_Sense30x(struct sis_video_info *ivideo){    u8  backupP4_0d,backupP2_00,backupP2_4d,backupSR_1e,biosflag=0;    u16 svhs=0, svhs_c=0;    u16 cvbs=0, cvbs_c=0;    u16 vga2=0, vga2_c=0;    int myflag, result;    char stdstr[] = "sisfb: Detected";    char tvstr[]  = "TV connected to";    if(ivideo->vbflags & VB_301) {       svhs = 0x00b9; cvbs = 0x00b3; vga2 = 0x00d1;       inSISIDXREG(SISPART4,0x01,myflag);       if(myflag & 0x04) {	  svhs = 0x00dd; cvbs = 0x00ee; vga2 = 0x00fd;       }    } else if(ivideo->vbflags & (VB_301B | VB_302B)) {       svhs = 0x016b; cvbs = 0x0174; vga2 = 0x0190;    } else if(ivideo->vbflags & (VB_301LV | VB_302LV)) {       svhs = 0x0200; cvbs = 0x0100;    } else if(ivideo->vbflags & (VB_301C | VB_302ELV)) {       svhs = 0x016b; cvbs = 0x0110; vga2 = 0x0190;    } else return;    vga2_c = 0x0e08; svhs_c = 0x0404; cvbs_c = 0x0804;    if(ivideo->vbflags & (VB_301LV|VB_302LV|VB_302ELV)) {       svhs_c = 0x0408; cvbs_c = 0x0808;    }    biosflag = 2;    if(ivideo->chip == SIS_300) {       inSISIDXREG(SISSR,0x3b,myflag);       if(!(myflag & 0x01)) vga2 = vga2_c = 0;    }    inSISIDXREG(SISSR,0x1e,backupSR_1e);    orSISIDXREG(SISSR,0x1e,0x20);    inSISIDXREG(SISPART4,0x0d,backupP4_0d);    if(ivideo->vbflags & VB_301C) {       setSISIDXREG(SISPART4,0x0d,~0x07,0x01);    } else {       orSISIDXREG(SISPART4,0x0d,0x04);    }    SiS_DDC2Delay(&ivideo->SiS_Pr, 0x2000);    inSISIDXREG(SISPART2,0x00,backupP2_00);    outSISIDXREG(SISPART2,0x00,((backupP2_00 | 0x1c) & 0xfc));    inSISIDXREG(SISPART2,0x4d,backupP2_4d);    if(ivideo->vbflags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV)) {       outSISIDXREG(SISPART2,0x4d,(backupP2_4d & ~0x10));    }    if(!(ivideo->vbflags & VB_301C)) {       SISDoSense(ivideo, 0, 0);    }    andSISIDXREG(SISCR, 0x32, ~0x14);    if(vga2_c || vga2) {       if(SISDoSense(ivideo, vga2, vga2_c)) {          if(biosflag & 0x01) {	     printk(KERN_INFO "%s %s SCART output\n", stdstr, tvstr);	     orSISIDXREG(SISCR, 0x32, 0x04);	  } else {	     printk(KERN_INFO "%s secondary VGA connection\n", stdstr);	     orSISIDXREG(SISCR, 0x32, 0x10);	  }       }    }    andSISIDXREG(SISCR, 0x32, 0x3f);    if(ivideo->vbflags & VB_301C) {       orSISIDXREG(SISPART4,0x0d,0x04);    }    if((ivideo->sisvga_engine == SIS_315_VGA) &&       (ivideo->vbflags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV))) {       outSISIDXREG(SISPART2,0x4d,(backupP2_4d | 0x10));       SiS_DDC2Delay(&ivideo->SiS_Pr, 0x2000);       if((result = SISDoSense(ivideo, svhs, 0x0604))) {          if((result = SISDoSense(ivideo, cvbs, 0x0804))) {	     printk(KERN_INFO "%s %s YPbPr component output\n", stdstr, tvstr);	     orSISIDXREG(SISCR,0x32,0x80);	  }       }       outSISIDXREG(SISPART2,0x4d,backupP2_4d);    }    andSISIDXREG(SISCR, 0x32, ~0x03);    if(!(ivideo->vbflags & TV_YPBPR)) {       if((result = SISDoSense(ivideo, svhs, svhs_c))) {          printk(KERN_INFO "%s %s SVIDEO output\n", stdstr, tvstr);          orSISIDXREG(SISCR, 0x32, 0x02);       }       if((biosflag & 0x02) || (!result)) {          if(SISDoSense(ivideo, cvbs, cvbs_c)) {	     printk(KERN_INFO "%s %s COMPOSITE output\n", stdstr, tvstr);	     orSISIDXREG(SISCR, 0x32, 0x01);          }       }    }    SISDoSense(ivideo, 0, 0);    outSISIDXREG(SISPART2,0x00,backupP2_00);    outSISIDXREG(SISPART4,0x0d,backupP4_0d);    outSISIDXREG(SISSR,0x1e,backupSR_1e);    if(ivideo->vbflags & VB_301C) {       inSISIDXREG(SISPART2,0x00,biosflag);       if(biosflag & 0x20) {          for(myflag = 2; myflag > 0; myflag--) {	     biosflag ^= 0x20;	     outSISIDXREG(SISPART2,0x00,biosflag);	  }       }    }    outSISIDXREG(SISPART2,0x00,backupP2_00);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/544393fe584d333480659a4bed30f5295355df11/sis_main.c/clean/drivers/video/sis/sis_main.c