extractedLnx/linux-2.4.24/drivers/video/sis/init301.c_SiS_GetVBInfo.c
void
SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT BaseAddr,UCHAR *ROMAddr,USHORT ModeNo,
USHORT ModeIdIndex,PSIS_HW_DEVICE_INFO HwDeviceExtension,
int checkcrt2mode)
{
USHORT tempax,tempbx,temp;
USHORT modeflag, resinfo=0;
UCHAR OutputSelect = *SiS_Pr->pSiS_OutputSelect;
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
if(SiS_Pr->UseCustomMode) {
modeflag = SiS_Pr->CModeFlag;
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
}
SiS_Pr->SiS_SetFlag = 0;
SiS_Pr->SiS_ModeType = modeflag & ModeInfoFlag;
tempbx = 0;
if(SiS_BridgeIsOn(SiS_Pr,BaseAddr,HwDeviceExtension) == 0) {
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30);
#if 0
/* SiS_HiVision is only used on 315/330+30xLV */
if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV)) {
if(SiS_Pr->SiS_HiVision & 0x03) { /* New from 650/30xLV 1.10.6s */
temp &= (SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode); /* 0x83 */
temp |= SetCRT2ToHiVisionTV; /* 0x80 */
}
if(SiS_Pr->SiS_HiVision & 0x04) { /* New from 650/30xLV 1.10.6s */
temp &= (SetCRT2ToHiVisionTV | SwitchToCRT2 | SetSimuScanMode); /* 0x83 */
temp |= SetCRT2ToSVIDEO; /* 0x08 */
}
}
#endif
#if 0
if(SiS_Pr->SiS_IF_DEF_FSTN) { /* fstn must set CR30=0x21 */
temp = (SetCRT2ToLCD | SetSimuScanMode);
SiS_SetReg1(SiS_Pr->SiS_P3d4,0x30,temp);
}
#endif
tempbx |= temp;
tempax = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) << 8;
tempax &= (LoadDACFlag | DriverMode | SetDispDevSwitch | SetNotSimuMode | SetPALTV);
tempbx |= tempax;
tempbx &= ~(SetCHTVOverScan | SetInSlaveMode | DisableCRT2Display);;
#ifdef SIS315H
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(SiS_Pr->SiS_VBType & (VB_SIS302B | VB_SIS301LV | VB_SIS302LV)) {
/* From 1.10.7w, not in 1.10.8r */
if(ModeNo == 0x03) {
/* Mode 0x03 is never in driver mode */
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf);
}
/* From 1.10.7w, not in 1.10.8r */
if(!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8))) {
/* Reset LCDA setting */
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
}
if(IS_SIS650) {
if(SiS_Pr->SiS_UseLCDA) {
if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {
if((ModeNo <= 0x13) || (!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA)); /* 3 */
}
}
}
#if 0 /* We can't detect it this way; there are machines which do not use LCDA despite
* the chip revision
*/
if((tempbx & SetCRT2ToLCD) && (SiS_GetReg1(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD)) {
if((SiS_GetReg1(SiS_Pr->SiS_P3d4, 0x36) & 0x0f) == SiS_Pr->SiS_Panel1400x1050) {
if((ModeNo <= 0x13) || (!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {
if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA)); /* 3 */
}
}
} else {
if((ModeNo <= 0x13) || (!(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {
if(SiS_GetReg1(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA)); /* 3 */
}
}
}
}
#endif
}
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) {
tempbx |= SetCRT2ToLCDA;
}
}
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
if(temp & SetToLCDA)
tempbx |= SetCRT2ToLCDA;
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(temp & EnableLVDSHiVision)
tempbx |= SetCRT2ToHiVisionTV;
}
}
}
#endif /* SIS315H */
if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
temp = SetCRT2ToLCDA | SetCRT2ToSCART | SetCRT2ToLCD |
SetCRT2ToRAMDAC | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO | /* = 0x807C; */
SetCRT2ToHiVisionTV; /* = 0x80FC; */
} else {
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0)
temp = SetCRT2ToLCDA | SetCRT2ToSCART |
SetCRT2ToLCD | SetCRT2ToHiVisionTV |
SetCRT2ToAVIDEO | SetCRT2ToSVIDEO; /* = 0x80bc */
else
temp = SetCRT2ToLCDA | SetCRT2ToLCD;
} else {
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0)
temp = SetCRT2ToTV | SetCRT2ToLCD;
else
temp = SetCRT2ToLCD;
}
}
if(!(tempbx & temp)) {
tempax = DisableCRT2Display;
tempbx = 0;
}
if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
if(tempbx & SetCRT2ToLCDA) {
tempbx &= (0xFF00|SwitchToCRT2|SetSimuScanMode);
}
if(tempbx & SetCRT2ToRAMDAC) {
tempbx &= (0xFF00|SetCRT2ToRAMDAC|SwitchToCRT2|SetSimuScanMode);
}
if((tempbx & SetCRT2ToLCD) /* && (!(SiS_Pr->SiS_VBType & VB_NoLCD)) */ ) {
/* We initialize the Panel Link of the type of bridge is DH */
tempbx &= (0xFF00|SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode);
}
if(tempbx & SetCRT2ToSCART) {
tempbx &= (0xFF00|SetCRT2ToSCART|SwitchToCRT2|SetSimuScanMode);
tempbx |= SetPALTV;
}
if(tempbx & SetCRT2ToHiVisionTV) {
tempbx &= (0xFF00|SetCRT2ToHiVisionTV|SwitchToCRT2|SetSimuScanMode);
tempbx |= SetPALTV;
}
} else { /* LVDS */
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(tempbx & SetCRT2ToLCDA)
tempbx &= (0xFF00|SwitchToCRT2|SetSimuScanMode);
}
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(tempbx & SetCRT2ToTV)
tempbx &= (0xFF00|SetCRT2ToTV|SwitchToCRT2|SetSimuScanMode);
}
if(tempbx & SetCRT2ToLCD) {
tempbx &= (0xFF00|SetCRT2ToLCD|SwitchToCRT2|SetSimuScanMode);
}
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(tempbx & SetCRT2ToLCDA)
tempbx |= SetCRT2ToLCD;
}
}
if(tempax & DisableCRT2Display) {
if(!(tempbx & (SwitchToCRT2 | SetSimuScanMode))) {
tempbx = SetSimuScanMode | DisableCRT2Display;
}
}
if(!(tempbx & DriverMode)){
tempbx |= SetSimuScanMode;
}
/* LVDS (LCD/TV) and 301BDH (LCD) can only be slave in 8bpp modes */
if(SiS_Pr->SiS_ModeType <= ModeVGA) {
if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
((tempbx & SetCRT2ToLCD) && (SiS_Pr->SiS_VBType & VB_NoLCD)) ) {
modeflag &= (~CRT2Mode);
}
}
if(!(tempbx & SetSimuScanMode)) {
if(tempbx & SwitchToCRT2) {
if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {
if( (HwDeviceExtension->jChipType >= SIS_315H) &&
(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) {
if(resinfo != SIS_RI_1600x1200)
tempbx |= SetSimuScanMode;
} else {
tempbx |= SetSimuScanMode;
}
}
} else {
if(!(SiS_BridgeIsEnable(SiS_Pr,BaseAddr,HwDeviceExtension))) {
if(!(tempbx & DriverMode)) {
if(SiS_BridgeInSlave(SiS_Pr)) {
tempbx |= SetSimuScanMode;
}
}
}
}
}
if(!(tempbx & DisableCRT2Display)) {
if(tempbx & DriverMode) {
if(tempbx & SetSimuScanMode) {
if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {
if( (HwDeviceExtension->jChipType >= SIS_315H) &&
(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) {
if(resinfo != SIS_RI_1600x1200) { /* 650/301 BIOS */
tempbx |= SetInSlaveMode;
if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
if(tempbx & SetCRT2ToTV) {
if(!(tempbx & SetNotSimuMode))
SiS_Pr->SiS_SetFlag |= TVSimuMode;
}
}
} /* 650/301 BIOS */
} else {
tempbx |= SetInSlaveMode;
if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
if(tempbx & SetCRT2ToTV) {
if(!(tempbx & SetNotSimuMode))
SiS_Pr->SiS_SetFlag |= TVSimuMode;
}
}
}
}
}
} else {
tempbx |= SetInSlaveMode;
if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
if(tempbx & SetCRT2ToTV) {
if(!(tempbx & SetNotSimuMode))
SiS_Pr->SiS_SetFlag |= TVSimuMode;
}
}
}
}
if(SiS_Pr->SiS_CHOverScan) {
if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
if((temp & TVOverScan) || (SiS_Pr->SiS_CHOverScan == 1) )
tempbx |= SetCHTVOverScan;
}
if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x79);
if( (temp & 0x80) || (SiS_Pr->SiS_CHOverScan == 1) )
tempbx |= SetCHTVOverScan;
}
if(SiS_Pr->SiS_CHSOverScan) {
tempbx |= SetCHTVOverScan;
}
}
}
if(SiS_Pr->SiS_IF_DEF_LVDS == 0) {
#ifdef SIS300
if((HwDeviceExtension->jChipType==SIS_630) ||
(HwDeviceExtension->jChipType==SIS_730)) {
if(ROMAddr && SiS_Pr->SiS_UseROM) {
OutputSelect = ROMAddr[0xfe];
}
if(!(OutputSelect & EnablePALMN))
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x35,0x3F);
if(tempbx & SetCRT2ToTV) {
if(tempbx & SetPALTV) {
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x35);
if(temp & EnablePALM) tempbx &= (~SetPALTV);
}
}
}
#endif
#ifdef SIS315H
if(HwDeviceExtension->jChipType >= SIS_315H) {
if(ROMAddr && SiS_Pr->SiS_UseROM) {
OutputSelect = ROMAddr[0xf3];
if(HwDeviceExtension->jChipType >= SIS_330) {
OutputSelect = ROMAddr[0x11b];
}
}
if(!(OutputSelect & EnablePALMN))
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0x3F);
if(tempbx & SetCRT2ToTV) {
if(tempbx & SetPALTV) {
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
if(temp & EnablePALM) tempbx &= (~SetPALTV);
}
}
}
#endif
}
/* PALM/PALN on Chrontel 7019 */
SiS_Pr->SiS_CHPALM = SiS_Pr->SiS_CHPALN = FALSE;
if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
if(tempbx & SetCRT2ToTV) {
if(tempbx & SetPALTV) {
temp = SiS_GetReg1(SiS_Pr->SiS_P3d4,0x38);
if(temp & EnablePALM) SiS_Pr->SiS_CHPALM = TRUE;
else if(temp & EnablePALN) SiS_Pr->SiS_CHPALN = TRUE;
}
}
}
SiS_Pr->SiS_VBInfo = tempbx;
if(HwDeviceExtension->jChipType == SIS_630) {
SiS_SetChrontelGPIO(SiS_Pr, SiS_Pr->SiS_VBInfo);
}
#ifdef TWDEBUG
#ifdef LINUX_KERNEL
printk(KERN_DEBUG "sisfb: (VBInfo= 0x%04x, SetFlag=0x%04x)\n",
SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag);
#endif
#ifdef LINUX_XF86
xf86DrvMsgVerb(0, X_PROBED, 3, "(init301: VBInfo=0x%04x, SetFlag=0x%04x)\n",
SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag);
#endif
#endif
}
Generated by GNU enscript 1.6.4.