summaryrefslogtreecommitdiff
path: root/src/init301.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/init301.c')
-rw-r--r--src/init301.c3097
1 files changed, 1570 insertions, 1527 deletions
diff --git a/src/init301.c b/src/init301.c
index ab20ab6..abcbfa5 100644
--- a/src/init301.c
+++ b/src/init301.c
@@ -1,9 +1,10 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.13 2004/08/20 18:57:06 kem Exp $ */
/*
* Mode initializing code (CRT2 section)
* for SiS 300/305/540/630/730 and
- * SiS 315/550/650/M650/651/661FX/M661xX/740/741/M741/330/660/M660/760/M760
- * (Universal module for Linux kernel framebuffer and XFree86 4.x)
+ * SiS 315/550/650/M650/651/661FX/M661xX/740/741(GX)/M741/330/660/M660/760/M760
+ * (Universal module for Linux kernel framebuffer and XFree86/X.org 4.x)
*
* Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
@@ -115,7 +116,10 @@ SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
static void
SiS_SetRegSR11ANDOR(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DataAND, USHORT DataOR)
{
- if(HwInfo->jChipType >= SIS_661) DataAND &= 0x0f;
+ if(HwInfo->jChipType >= SIS_661) {
+ DataAND &= 0x0f;
+ DataOR &= 0x0f;
+ }
SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,DataAND,DataOR);
}
@@ -129,17 +133,29 @@ GetLCDStructPtr661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
UCHAR *myptr = NULL;
- USHORT romindex = 0;
+ USHORT romindex = 0, reg = 0, idx = 0;
- /* Use the BIOS tables only for LVDS panels; DVI is unreliable
+ /* Use the BIOS tables only for LVDS panels; TMDS is unreliable
* due to the variaty of panels the BIOS doesn't know about.
+ * Exception: If the BIOS has better knowledge (such as in case
+ * of machines with a 301C and a panel that does not support DDC)
+ * use the BIOS data as well.
*/
- if((SiS_Pr->SiS_ROMNew) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
- myptr = (UCHAR *)SiS_LCDStruct661;
- romindex = SISGETROMW(0x100); /* 10c, 0.93: 10e */
+ if((SiS_Pr->SiS_ROMNew) &&
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) || (!SiS_Pr->PanelSelfDetected))) {
+
+ if(HwInfo->jChipType < SIS_661) reg = 0x3c;
+ else reg = 0x7d;
+
+ idx = (SiS_GetReg(SiS_Pr->SiS_P3d4,reg) & 0x1f) * 26;
+
+ if(idx < (8*26)) {
+ myptr = (UCHAR *)&SiS_LCDStruct661[idx];
+ }
+ romindex = SISGETROMW(0x100);
if(romindex) {
- romindex += ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x7d) & 0x1f) * 26);
+ romindex += idx;
myptr = &ROMAddr[romindex];
}
}
@@ -152,12 +168,16 @@ GetLCDStructPtr661_2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT romptr = 0;
- /* Use the BIOS tables only for LVDS panels; DVI is unreliable
+ /* Use the BIOS tables only for LVDS panels; TMDS is unreliable
* due to the variaty of panels the BIOS doesn't know about.
+ * Exception: If the BIOS has better knowledge (such as in case
+ * of machines with a 301C and a panel that does not support DDC)
+ * use the BIOS data as well.
*/
- if((SiS_Pr->SiS_ROMNew) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
- romptr = SISGETROMW(0x102); /* 2ad */
+ if((SiS_Pr->SiS_ROMNew) &&
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) || (!SiS_Pr->PanelSelfDetected))) {
+ romptr = SISGETROMW(0x102);
romptr += ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4) * SiS_Pr->SiS661LCD2TableSize);
}
@@ -171,12 +191,11 @@ GetLCDStructPtr661_2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
static BOOLEAN
SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex, USHORT *i,
- PSIS_HW_INFO HwInfo)
+ USHORT RRTI, USHORT *i, PSIS_HW_INFO HwInfo)
{
USHORT checkmask=0,modeid,infoflag;
- modeid = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID;
+ modeid = SiS_Pr->SiS_RefIndex[RRTI + (*i)].ModeID;
if(SiS_Pr->SiS_VBType & VB_SISVB) {
@@ -237,8 +256,8 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
/* Look backwards in table for matching CRT2 mode */
- for(; SiS_Pr->SiS_RefIndex[RefreshRateTableIndex+(*i)].ModeID == modeid; (*i)--) {
- infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
+ for(; SiS_Pr->SiS_RefIndex[RRTI + (*i)].ModeID == modeid; (*i)--) {
+ infoflag = SiS_Pr->SiS_RefIndex[RRTI + (*i)].Ext_InfoFlag;
if(infoflag & checkmask) return TRUE;
if((*i) == 0) break;
}
@@ -247,13 +266,11 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
* for a matching CRT2 mode if no mode was found yet.
*/
for((*i) = 0; ; (*i)++) {
- if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID != modeid) {
- return FALSE;
- }
- infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
+ if(SiS_Pr->SiS_RefIndex[RRTI + (*i)].ModeID != modeid) break;
+ infoflag = SiS_Pr->SiS_RefIndex[RRTI + (*i)].Ext_InfoFlag;
if(infoflag & checkmask) return TRUE;
}
- return TRUE;
+ return FALSE;
}
/*********************************************/
@@ -269,16 +286,17 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00 };
- USHORT RefreshRateTableIndex,i,backup_i;
+ USHORT RRTI,i,backup_i;
USHORT modeflag,index,temp,backupindex;
/* Do NOT check for UseCustomMode here, will skrew up FIFO */
if(ModeNo == 0xfe) return 0;
- if(ModeNo <= 0x13)
+ if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
+ } else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
@@ -313,23 +331,23 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
- RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
- ModeNo = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID;
+ RRTI = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
+ ModeNo = SiS_Pr->SiS_RefIndex[RRTI].ModeID;
if(HwInfo->jChipType >= SIS_315H) {
if(!(SiS_Pr->SiS_VBInfo & DriverMode)) {
if( (SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x105) ||
(SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x107) ) {
- if(backupindex <= 1) RefreshRateTableIndex++;
+ if(backupindex <= 1) RRTI++;
}
}
}
i = 0;
do {
- if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i].ModeID != ModeNo) break;
- temp = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag;
- temp &= ModeInfoFlag;
+ if(SiS_Pr->SiS_RefIndex[RRTI + i].ModeID != ModeNo) break;
+ temp = SiS_Pr->SiS_RefIndex[RRTI + i].Ext_InfoFlag;
+ temp &= ModeTypeMask;
if(temp < SiS_Pr->SiS_ModeType) break;
i++;
index--;
@@ -337,7 +355,7 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- temp = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i - 1].Ext_InfoFlag;
+ temp = SiS_Pr->SiS_RefIndex[RRTI + i - 1].Ext_InfoFlag;
if(temp & InterlaceMode) i++;
}
}
@@ -346,12 +364,12 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if((SiS_Pr->SiS_SetFlag & ProgrammingCRT2) && (!(SiS_Pr->SiS_VBInfo & DisableCRT2Display))) {
backup_i = i;
- if(!(SiS_AdjustCRT2Rate(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, &i, HwInfo))) {
+ if(!(SiS_AdjustCRT2Rate(SiS_Pr, ModeNo, ModeIdIndex, RRTI, &i, HwInfo))) {
i = backup_i;
}
}
- return(RefreshRateTableIndex + i);
+ return(RRTI + i);
}
/*********************************************/
@@ -422,6 +440,7 @@ SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime)
}
}
+#if defined(SIS300) || defined(SIS315H)
static void
SiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay)
{
@@ -436,6 +455,7 @@ SiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay)
delay--;
}
}
+#endif
#ifdef SIS315H
static void
@@ -447,6 +467,7 @@ SiS_LongDelay(SiS_Private *SiS_Pr, USHORT delay)
}
#endif
+#if defined(SIS300) || defined(SIS315H)
static void
SiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay)
{
@@ -454,12 +475,15 @@ SiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay)
SiS_GenericDelay(SiS_Pr,0x42);
}
}
+#endif
static void
SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
{
+#if defined(SIS300) || defined(SIS315H)
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT PanelID, DelayIndex, Delay=0;
+#endif
if(HwInfo->jChipType < SIS_315H) {
@@ -474,7 +498,6 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
Delay = 3;
} else {
if(DelayTime >= 2) DelayTime -= 2;
-
if(!(DelayTime & 0x01)) {
Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0];
} else {
@@ -482,15 +505,12 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
}
if(SiS_Pr->SiS_UseROM) {
if(ROMAddr[0x220] & 0x40) {
- if(!(DelayTime & 0x01)) {
- Delay = (USHORT)ROMAddr[0x225];
- } else {
- Delay = (USHORT)ROMAddr[0x226];
- }
+ if(!(DelayTime & 0x01)) Delay = (USHORT)ROMAddr[0x225];
+ else Delay = (USHORT)ROMAddr[0x226];
}
}
}
- SiS_ShortDelay(SiS_Pr,Delay);
+ SiS_ShortDelay(SiS_Pr, Delay);
#endif /* SIS300 */
@@ -498,7 +518,10 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
#ifdef SIS315H
- if(HwInfo->jChipType >= SIS_661) {
+ if((HwInfo->jChipType >= SIS_661) ||
+ (HwInfo->jChipType <= SIS_315PRO) ||
+ (HwInfo->jChipType == SIS_330) ||
+ (SiS_Pr->SiS_ROMNew)) {
if(!(DelayTime & 0x01)) {
SiS_DDC2Delay(SiS_Pr, 0x1000);
@@ -506,11 +529,9 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
SiS_DDC2Delay(SiS_Pr, 0x4000);
}
- } else if(HwInfo->jChipType >= SIS_330) return;
-
- if((SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
+ } else if((SiS_Pr->SiS_IF_DEF_LVDS == 1) /* ||
(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) { /* 315 series, LVDS; Special */
+ (SiS_Pr->SiS_CustomT == CUT_CLEVO1400) */ ) { /* 315 series, LVDS; Special */
if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
@@ -541,7 +562,7 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
}
}
}
- SiS_ShortDelay(SiS_Pr,Delay);
+ SiS_ShortDelay(SiS_Pr, Delay);
}
} else if(SiS_Pr->SiS_VBType & VB_SISVB) { /* 315 series, all bridges */
@@ -584,7 +605,6 @@ SiS_WaitRetrace1(SiS_Private *SiS_Pr)
USHORT watchdog;
if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return;
-
if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x17) & 0x80)) return;
watchdog = 65535;
@@ -593,6 +613,7 @@ SiS_WaitRetrace1(SiS_Private *SiS_Pr)
while((!(SiS_GetRegByte(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog);
}
+#if defined(SIS300) || defined(SIS315H)
static void
SiS_WaitRetrace2(SiS_Private *SiS_Pr, USHORT reg)
{
@@ -603,6 +624,7 @@ SiS_WaitRetrace2(SiS_Private *SiS_Pr, USHORT reg)
watchdog = 65535;
while((!(SiS_GetReg(SiS_Pr->SiS_Part1Port,reg) & 0x02)) && --watchdog);
}
+#endif
static void
SiS_WaitVBRetrace(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
@@ -640,10 +662,10 @@ SiS_VBWait(SiS_Private *SiS_Pr)
tempal = SiS_GetRegByte(SiS_Pr->SiS_P3da);
if(temp & 0x01) {
if((tempal & 0x08)) continue;
- if(!(tempal & 0x08)) break;
+ else break;
} else {
if(!(tempal & 0x08)) continue;
- if((tempal & 0x08)) break;
+ else break;
}
}
temp ^= 0x01;
@@ -664,12 +686,14 @@ SiS_VBLongWait(SiS_Private *SiS_Pr)
/* HELPER: MISC */
/*********************************************/
+#ifdef SIS300
static BOOLEAN
SiS_Is301B(SiS_Private *SiS_Pr)
{
if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01) >= 0xb0) return TRUE;
return FALSE;
}
+#endif
static BOOLEAN
SiS_CRT2IsLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
@@ -715,6 +739,16 @@ SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
return FALSE;
}
+#ifdef SIS315H
+static BOOLEAN
+SiS_IsVAorLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+{
+ if(SiS_IsVAMode(SiS_Pr,HwInfo)) return TRUE;
+ if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) return TRUE;
+ return FALSE;
+}
+#endif
+
static BOOLEAN
SiS_IsDualLink(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
@@ -754,11 +788,8 @@ SiS_LCDAEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
static BOOLEAN
SiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- USHORT flag;
-
if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) {
- flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x79);
- if(flag & 0x10) return TRUE;
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x79) & 0x10) return TRUE;
}
return FALSE;
}
@@ -854,12 +885,12 @@ SiS_BridgeIsOn(SiS_Private *SiS_Pr)
USHORT flag;
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- return FALSE;
+ return TRUE;
} else if(SiS_Pr->SiS_VBType & VB_SISVB) {
flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00);
- if((flag == 1) || (flag == 2)) return FALSE;
+ if((flag == 1) || (flag == 2)) return TRUE;
}
- return TRUE;
+ return FALSE;
}
static BOOLEAN
@@ -867,21 +898,21 @@ SiS_BridgeIsEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
USHORT flag;
- if(!(SiS_BridgeIsOn(SiS_Pr))) {
+ if(SiS_BridgeIsOn(SiS_Pr)) {
flag = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
if(HwInfo->jChipType < SIS_315H) {
flag &= 0xa0;
- if((flag == 0x80) || (flag == 0x20)) return FALSE;
+ if((flag == 0x80) || (flag == 0x20)) return TRUE;
} else {
flag &= 0x50;
- if((flag == 0x40) || (flag == 0x10)) return FALSE;
+ if((flag == 0x40) || (flag == 0x10)) return TRUE;
}
}
- return TRUE;
+ return FALSE;
}
static BOOLEAN
-SiS_BridgeInSlave(SiS_Private *SiS_Pr)
+SiS_BridgeInSlavemode(SiS_Private *SiS_Pr)
{
USHORT flag1;
@@ -939,10 +970,10 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->SiS_SetFlag = 0;
- SiS_Pr->SiS_ModeType = modeflag & ModeInfoFlag;
+ SiS_Pr->SiS_ModeType = modeflag & ModeTypeMask;
tempbx = 0;
- if(SiS_BridgeIsOn(SiS_Pr) == 0) {
+ if(SiS_BridgeIsOn(SiS_Pr)) {
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
#if 0
if(HwInfo->jChipType < SIS_661) {
@@ -964,13 +995,13 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H
if(HwInfo->jChipType >= SIS_315H) {
- if(SiS_Pr->SiS_VBType & (VB_SIS301C|VB_SIS302B|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) {
+ if(SiS_Pr->SiS_VBType & VB_SISLCDA) {
if(ModeNo == 0x03) {
/* Mode 0x03 is never in driver mode */
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf);
}
if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8))) {
- /* Reset LCDA setting */
+ /* Reset LCDA setting if not driver mode */
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
}
if(IS_SIS650) {
@@ -995,13 +1026,13 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(HwInfo->jChipType >= SIS_661) {
tempbx &= ~(SetCRT2ToYPbPr525750 | SetCRT2ToHiVision);
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
- if(SiS_Pr->SiS_VBType & (VB_SIS301C|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) {
+ if(SiS_Pr->SiS_VBType & VB_SISYPBPR) {
if(temp & 0x04) {
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;
if(temp == 0x60) tempbx |= SetCRT2ToHiVision;
else tempbx |= SetCRT2ToYPbPr525750;
}
- } else if(SiS_Pr->SiS_VBType & (VB_SIS301 | VB_SIS301B | VB_SIS302B)) {
+ } else if(SiS_Pr->SiS_VBType & VB_SISHIVISION) {
if(temp & 0x04) {
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;
if(temp == 0x60) tempbx |= SetCRT2ToHiVision;
@@ -1125,9 +1156,9 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
} else {
- if(!(SiS_BridgeIsEnabled(SiS_Pr,HwInfo))) {
+ if(SiS_BridgeIsEnabled(SiS_Pr,HwInfo)) {
if(!(tempbx & DriverMode)) {
- if(SiS_BridgeInSlave(SiS_Pr)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
tempbx |= SetSimuScanMode;
}
}
@@ -1428,7 +1459,7 @@ SiS_GetBIOSLCDResInfo(SiS_Private *SiS_Pr)
USHORT temp = SiS_Pr->SiS_LCDResInfo;
/* Translate my LCDResInfo to BIOS value */
if(temp == Panel_1280x768_2) temp = Panel_1280x768;
- if(temp == Panel_1280x768_3) temp = Panel_1280x768;
+ if(temp == Panel_1280x800_2) temp = Panel_1280x800;
return temp;
}
@@ -1437,25 +1468,68 @@ SiS_GetLCDInfoBIOS(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
#ifdef SIS315H
UCHAR *ROMAddr;
+ USHORT temp;
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "Paneldata driver: [%d %d] [H %d %d] [V %d %d] [C %d 0x%02x 0x%02x]\n",
+ SiS_Pr->PanelHT, SiS_Pr->PanelVT,
+ SiS_Pr->PanelHRS, SiS_Pr->PanelHRE,
+ SiS_Pr->PanelVRS, SiS_Pr->PanelVRE,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].CLOCK,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_A,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_B);
+#endif
if((ROMAddr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
- SiS_Pr->PanelHT = SISGETROMW(6);
- SiS_Pr->PanelVT = SISGETROMW(8);
+ if((temp = SISGETROMW(6)) != SiS_Pr->PanelHT) {
+ SiS_Pr->SiS_NeedRomModeData = TRUE;
+ SiS_Pr->PanelHT = temp;
+ }
+ if((temp = SISGETROMW(8)) != SiS_Pr->PanelVT) {
+ SiS_Pr->SiS_NeedRomModeData = TRUE;
+ SiS_Pr->PanelVT = temp;
+ }
SiS_Pr->PanelHRS = SISGETROMW(10);
SiS_Pr->PanelHRE = SISGETROMW(12);
SiS_Pr->PanelVRS = SISGETROMW(14);
SiS_Pr->PanelVRE = SISGETROMW(16);
SiS_Pr->PanelVCLKIdx315 = VCLK_CUSTOM_315;
SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].CLOCK =
- SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].CLOCK = (USHORT)ROMAddr[18];
+ SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].CLOCK = (USHORT)((UCHAR)ROMAddr[18]);
SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].SR2B =
SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].Part4_A = ROMAddr[19];
- SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].SR2B =
+ SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].SR2C =
SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].Part4_B = ROMAddr[20];
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "Paneldata BIOS: [%d %d] [H %d %d] [V %d %d] [C %d 0x%02x 0x%02x]\n",
+ SiS_Pr->PanelHT, SiS_Pr->PanelVT,
+ SiS_Pr->PanelHRS, SiS_Pr->PanelHRE,
+ SiS_Pr->PanelVRS, SiS_Pr->PanelVRE,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].CLOCK,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_A,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_B);
+#endif
+
}
#endif
}
+static void
+SiS_CheckScaling(SiS_Private *SiS_Pr, USHORT resinfo, const UCHAR *nonscalingmodes)
+{
+ int i = 0;
+ while(nonscalingmodes[i] != 0xff) {
+ if(nonscalingmodes[i++] == resinfo) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ||
+ (SiS_Pr->UsePanelScaler == -1)) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
+ }
+ }
+}
+
void
SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo)
@@ -1466,7 +1540,8 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H
UCHAR *myptr = NULL;
#endif
- USHORT temp,modeflag,resinfo=0;
+ USHORT temp,modeflag,resinfo=0,modexres=0,modeyres=0;
+ BOOLEAN panelcanscale = FALSE;
const unsigned char SiS300SeriesLCDRes[] =
{ 0, 1, 2, 3, 7, 4, 5, 8,
0, 0, 10, 0, 0, 0, 0, 15 };
@@ -1478,6 +1553,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelHRE = 999; /* HSync end */
SiS_Pr->PanelVRS = 999; /* VSync start */
SiS_Pr->PanelVRE = 999; /* VSync end */
+ SiS_Pr->SiS_NeedRomModeData = FALSE;
if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return;
@@ -1488,9 +1564,14 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modexres = SiS_Pr->SiS_ModeResInfo[resinfo].HTotal;
+ modeyres = SiS_Pr->SiS_ModeResInfo[resinfo].VTotal;
}
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
+
+ /* For broken BIOSes: Assume 1024x768 */
+ if(temp == 0) temp = 0x02;
if((HwInfo->jChipType >= SIS_661) || (SiS_Pr->SiS_ROMNew)) {
SiS_Pr->SiS_LCDTypeInfo = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x39) & 0x7c) >> 2;
@@ -1505,19 +1586,20 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = SiS300SeriesLCDRes[temp];
}
+ /* Translate to our internal types */
if(HwInfo->jChipType == SIS_550) {
if(temp == Panel310_640x480_2) temp = Panel_640x480_2;
if(temp == Panel310_640x480_3) temp = Panel_640x480_3;
}
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* SiS LVDS */
+ if(SiS_Pr->SiS_VBType & VB_SISLVDS) { /* SiS LVDS */
if(temp == Panel310_1280x768) {
temp = Panel_1280x768_2;
-#ifdef SIS315H
- if((myptr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
- if((myptr[8] | (myptr[9] << 8)) == 798) temp = Panel_1280x768_3;
+ }
+ if(SiS_Pr->SiS_ROMNew) {
+ if(temp == Panel661_1280x800) {
+ temp = Panel_1280x800_2;
}
-#endif
}
}
@@ -1538,6 +1620,73 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMinLVDS)
SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMinLVDS;
}
+
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
+ SiS_Pr->SiS_LCDInfo = temp & ~0x000e;
+ /* Need temp below! */
+
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1280x960) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
+
+ panelcanscale = (SiS_Pr->SiS_LCDInfo & DontExpandLCD) ? TRUE : FALSE;
+
+ if(!SiS_Pr->UsePanelScaler) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
+ else if(SiS_Pr->UsePanelScaler == 1) SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+
+ /* Dual link, Pass 1:1 BIOS default, etc. */
+#ifdef SIS315H
+ if(HwInfo->jChipType >= SIS_661) {
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(temp & 0x08) SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ }
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ if(SiS_Pr->SiS_ROMNew) {
+ if(temp & 0x02) SiS_Pr->SiS_LCDInfo |= LCDDualLink;
+ } else if((myptr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
+ if(myptr[2] & 0x01) SiS_Pr->SiS_LCDInfo |= LCDDualLink;
+ }
+ }
+ } else if(HwInfo->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x39) & 0x01) SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ }
+ if((SiS_Pr->SiS_ROMNew) && (!(SiS_Pr->PanelSelfDetected))) {
+ SiS_Pr->SiS_LCDInfo &= ~(LCDRGB18Bit);
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35);
+ if(temp & 0x01) SiS_Pr->SiS_LCDInfo |= LCDRGB18Bit;
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ if(temp & 0x02) SiS_Pr->SiS_LCDInfo |= LCDDualLink;
+ }
+ } else if(!(SiS_Pr->SiS_ROMNew)) {
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ if((SiS_Pr->SiS_CustomT == CUT_CLEVO1024) &&
+ (SiS_Pr->SiS_LCDResInfo == Panel_1024x768)) {
+ SiS_Pr->SiS_LCDInfo |= LCDDualLink;
+ }
+ if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_1680x1050)) {
+ SiS_Pr->SiS_LCDInfo |= LCDDualLink;
+ }
+ }
+ }
+ }
+#endif
+
+ /* Pass 1:1 */
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBType & VB_NoLCD)) {
+ /* Always center screen on LVDS (if scaling is disabled) */
+ SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ } else if(SiS_Pr->SiS_VBType & VB_SISVB) {
+ if(SiS_Pr->SiS_VBType & VB_SISLVDS) {
+ /* Always center screen on SiS LVDS (if scaling is disabled) */
+ SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ } else {
+ /* By default, pass 1:1 on SiS TMDS (if scaling is supported) */
+ if(panelcanscale) SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ if(SiS_Pr->CenterScreen == 1) SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ }
+ }
SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
SiS_Pr->PanelVCLKIdx315 = VCLK108_2_315;
@@ -1569,7 +1718,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
case Panel_1024x600: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 600;
SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 800;
SiS_Pr->PanelHRS = 24; SiS_Pr->PanelHRE = 136;
- SiS_Pr->PanelVRS = 88; SiS_Pr->PanelVRE = 6;
+ SiS_Pr->PanelVRS = 2 /* 88 */ ; SiS_Pr->PanelVRE = 6;
SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
SiS_Pr->PanelVCLKIdx315 = VCLK65_315;
break;
@@ -1607,31 +1756,37 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
case Panel_1280x768: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 768;
- SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 802;
- SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRS = 112;
- SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6;
- SiS_Pr->PanelVCLKIdx300 = VCLK81_300;
- SiS_Pr->PanelVCLKIdx315 = VCLK81_315;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ SiS_Pr->PanelHT = 1408; SiS_Pr->PanelVT = 806;
+ SiS_Pr->PanelVCLKIdx300 = VCLK81_300; /* ? */
+ SiS_Pr->PanelVCLKIdx315 = VCLK81_315; /* ? */
+ } else {
+ SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 802;
+ SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRS = 112;
+ SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6;
+ SiS_Pr->PanelVCLKIdx300 = VCLK81_300;
+ SiS_Pr->PanelVCLKIdx315 = VCLK81_315;
+ }
break;
case Panel_1280x768_2: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 768;
- SiS_Pr->PanelHT = 1408; SiS_Pr->PanelVT = 806;
- SiS_Pr->PanelHRS = 16; SiS_Pr->PanelHRE = 64;
+ SiS_Pr->PanelHT = 1660; SiS_Pr->PanelVT = 806;
+ SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112;
SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6;
SiS_Pr->PanelVCLKIdx315 = VCLK_1280x768_2;
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
- case Panel_1280x768_3: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 768;
- SiS_Pr->PanelHT = 1664; SiS_Pr->PanelVT = 798;
- SiS_Pr->PanelHRS = 64; SiS_Pr->PanelHRE = 128;
- SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 7;
- SiS_Pr->PanelVCLKIdx315 = VCLK_1280x768_3;
- SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
- break;
case Panel_1280x800: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 800;
- SiS_Pr->PanelHT = 1408; SiS_Pr->PanelVT = 816;
- SiS_Pr->PanelHRS = 21; SiS_Pr->PanelHRE = 24;
- SiS_Pr->PanelVRS = 4; SiS_Pr->PanelVRE = 3;
- SiS_Pr->PanelVCLKIdx315 = VCLK69_315;
+ SiS_Pr->PanelHT = 1408; SiS_Pr->PanelVT = 816;
+ SiS_Pr->PanelHRS = 21; SiS_Pr->PanelHRE = 24;
+ SiS_Pr->PanelVRS = 4; SiS_Pr->PanelVRE = 3;
+ SiS_Pr->PanelVCLKIdx315 = VCLK_1280x800_315;
+ SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
+ break;
+ case Panel_1280x800_2: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 800;
+ SiS_Pr->PanelHT = 1552; SiS_Pr->PanelVT = 812;
+ SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112;
+ SiS_Pr->PanelVRS = 4; SiS_Pr->PanelVRE = 3;
+ SiS_Pr->PanelVCLKIdx315 = VCLK_1280x800_315_2;
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
case Panel_1280x960: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 960;
@@ -1672,6 +1827,12 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelVCLKIdx315 = VCLK121_315;
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
+ case Panel_Barco1366: SiS_Pr->PanelXRes = 1360; SiS_Pr->PanelYRes = 1024;
+ SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066;
+ break;
+ case Panel_848x480: SiS_Pr->PanelXRes = 848; SiS_Pr->PanelYRes = 480;
+ SiS_Pr->PanelHT = 1088; SiS_Pr->PanelVT = 525;
+ break;
case Panel_Custom: SiS_Pr->PanelXRes = SiS_Pr->CP_MaxX;
SiS_Pr->PanelYRes = SiS_Pr->CP_MaxY;
SiS_Pr->PanelHT = SiS_Pr->CHTotal;
@@ -1689,123 +1850,190 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelHRE -= SiS_Pr->PanelHRS;
SiS_Pr->PanelVRS -= SiS_Pr->PanelYRes;
SiS_Pr->PanelVRE -= SiS_Pr->PanelVRS;
+ if(SiS_Pr->CP_PrefClock) {
+ int idx;
+ SiS_Pr->PanelVCLKIdx315 = VCLK_CUSTOM_315;
+ SiS_Pr->PanelVCLKIdx300 = VCLK_CUSTOM_300;
+ if(HwInfo->jChipType < SIS_315H) idx = VCLK_CUSTOM_300;
+ else idx = VCLK_CUSTOM_315;
+ SiS_Pr->SiS_VCLKData[idx].CLOCK =
+ SiS_Pr->SiS_VBVCLKData[idx].CLOCK = SiS_Pr->CP_PrefClock;
+ SiS_Pr->SiS_VCLKData[idx].SR2B =
+ SiS_Pr->SiS_VBVCLKData[idx].Part4_A = SiS_Pr->CP_PrefSR2B;
+ SiS_Pr->SiS_VCLKData[idx].SR2C =
+ SiS_Pr->SiS_VBVCLKData[idx].Part4_B = SiS_Pr->CP_PrefSR2C;
+ }
}
break;
- case Panel_Barco1366: SiS_Pr->PanelXRes = 1360; SiS_Pr->PanelYRes = 1024;
- SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066;
- break;
- case Panel_848x480: SiS_Pr->PanelXRes = 848; SiS_Pr->PanelYRes = 480;
- SiS_Pr->PanelHT = 1088; SiS_Pr->PanelVT = 525;
- break;
default: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 768;
SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806;
break;
+ }
+
+ /* Special cases */
+ if( (SiS_Pr->SiS_IF_DEF_FSTN) ||
+ (SiS_Pr->SiS_IF_DEF_DSTN) ||
+ (SiS_Pr->SiS_CustomT == CUT_BARCO1366) ||
+ (SiS_Pr->SiS_CustomT == CUT_BARCO1024) ||
+ (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) {
+ SiS_Pr->PanelHRS = 999;
+ SiS_Pr->PanelHRE = 999;
}
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
- SiS_Pr->SiS_LCDInfo = temp & ~0x000e;
-
- if(!(SiS_Pr->UsePanelScaler)) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
- else if(SiS_Pr->UsePanelScaler == 1) SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ if( (SiS_Pr->SiS_CustomT == CUT_BARCO1366) ||
+ (SiS_Pr->SiS_CustomT == CUT_BARCO1024) ||
+ (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) {
+ SiS_Pr->PanelVRS = 999;
+ SiS_Pr->PanelVRE = 999;
+ }
-#ifdef SIS315H
- if(HwInfo->jChipType >= SIS_661) {
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
- if(temp & 0x08) SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ /* DontExpand overrule */
+ if((SiS_Pr->SiS_VBType & VB_SISVB) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) {
+
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (modeflag & NoSupportLCDScale)) {
+ /* No scaling for this mode on any panel */
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
}
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- if(SiS_Pr->SiS_ROMNew) {
- if(temp & 0x02) SiS_Pr->SiS_LCDInfo |= LCDDualLink;
- } else if((myptr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
- if(myptr[2] & 0x01) SiS_Pr->SiS_LCDInfo |= LCDDualLink;
+
+ switch(SiS_Pr->SiS_LCDResInfo) {
+
+ case Panel_Custom:
+ case Panel_1152x864:
+ case Panel_1280x768: /* TMDS only */
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ break;
+
+ case Panel_800x600: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1024x768: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1280x720: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ if(SiS_Pr->PanelHT == 1650) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
}
+ break;
}
- } else if(HwInfo->jChipType >= SIS_315H) {
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
- if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x39) & 0x01) SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ case Panel_1280x768_2: { /* LVDS only */
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ switch(resinfo) {
+ case SIS_RI_1280x720: if(SiS_Pr->UsePanelScaler == -1) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
+ }
+ break;
}
- if((SiS_Pr->SiS_ROMNew) && (!(SiS_Pr->PanelSelfDetected))) {
- SiS_Pr->SiS_LCDInfo &= ~(LCDRGB18Bit);
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35);
- if(temp & 0x01) SiS_Pr->SiS_LCDInfo |= LCDRGB18Bit;
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- if(temp & 0x02) SiS_Pr->SiS_LCDInfo |= LCDDualLink;
+ case Panel_1280x800: { /* SiS TMDS special (Averatec 6200 series) */
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1280x720, SIS_RI_1280x768, 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1280x800_2: { /* SiS LVDS */
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ switch(resinfo) {
+ case SIS_RI_1280x720:
+ case SIS_RI_1280x768: if(SiS_Pr->UsePanelScaler == -1) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
}
+ break;
+ }
+ case Panel_1280x960: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x720,SIS_RI_1280x768,SIS_RI_1280x800,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1280x1024: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x720,SIS_RI_1280x768,SIS_RI_1280x800,SIS_RI_1280x960,
+ 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1400x1050: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x768,SIS_RI_1280x800,SIS_RI_1280x960,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ switch(resinfo) {
+ case SIS_RI_1280x720: if(SiS_Pr->UsePanelScaler == -1) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
+ case SIS_RI_1280x1024: SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ break;
+ }
+ break;
+ }
+ case Panel_1600x1200: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x720,SIS_RI_1280x768,SIS_RI_1280x800,SIS_RI_1280x960,
+ SIS_RI_1360x768,SIS_RI_1360x1024,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1680x1050: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600, SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x960,SIS_RI_1360x768,SIS_RI_1360x1024,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
}
- }
-#endif
-
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- /* Always center screen on LVDS (if scaling is disabled) */
- SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
- } else if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- /* Always center screen on SiS LVDS (if scaling is disabled) */
- SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
- } else {
- /* By default, pass 1:1 on SiS TMDS (if scaling is disabled) */
- SiS_Pr->SiS_LCDInfo |= LCDPass11;
- if(SiS_Pr->CenterScreen == 1) SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
}
}
-
+
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
if(SiS_Pr->SiS_CustomT == CUT_PANEL848) {
SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg h/v sync, RGB24(D0 = 0) */
}
}
- if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- switch(SiS_Pr->SiS_LCDResInfo) {
- case Panel_Custom:
- /* For non-standard LCD resolution, we let the panel scale */
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- break;
- case Panel_1280x720:
- if(SiS_Pr->PanelHT == 1650) {
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- }
- case Panel_1280x768: /* TMDS only */
- /* No idea about the timing and zoom factors */
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- break;
- case Panel_1280x960:
- SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
- break;
- case Panel_1280x1024:
- if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
- if(ModeNo == 0x7c || ModeNo == 0x7d || ModeNo == 0x7e ||
- ModeNo == 0x79 || ModeNo == 0x75 || ModeNo == 0x78 ||
- ModeNo == 0x14 || ModeNo == 0x15 || ModeNo == 0x16) {
- /* We do not scale to 1280x720/800/960 (B/C bridges only) */
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- }
- if(((HwInfo->jChipType >= SIS_315H) &&
- (ModeNo == 0x23 || ModeNo == 0x24 || ModeNo == 0x25)) ||
- ((HwInfo->jChipType < SIS_315H) &&
- (ModeNo == 0x55 || ModeNo == 0x5a || ModeNo == 0x5b))) {
- /* We do not scale to 1280x768 (B/C bridges only) */
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- }
- }
- break;
- case Panel_1400x1050:
- if(ModeNo == 0x3a || ModeNo == 0x4d || ModeNo == 0x65) {
- /* We do not scale to 1280x1024 (all bridges) */
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- }
- break;
- case Panel_1600x1200:
- if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
- /* No idea about the timing and zoom factors (C bridge only) */
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- }
- break;
- }
- }
- }
-
#ifdef SIS300
if(HwInfo->jChipType < SIS_315H) {
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
@@ -1825,12 +2053,36 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif
/* Special cases */
+
+ if(modexres == SiS_Pr->PanelXRes && modeyres == SiS_Pr->PanelYRes) {
+ SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ }
+
if(SiS_Pr->SiS_IF_DEF_TRUMPION) {
SiS_Pr->SiS_LCDInfo |= (DontExpandLCD | LCDPass11);
}
-
- if(SiS_Pr->SiS_LCDResInfo == Panel_640x480) {
+
+ switch(SiS_Pr->SiS_LCDResInfo) {
+ case Panel_640x480:
SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ break;
+ case Panel_1280x800:
+ /* Don't pass 1:1 by default (TMDS special) */
+ if(SiS_Pr->CenterScreen == -1) SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ break;
+ case Panel_1280x960:
+ SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ break;
+ case Panel_Custom:
+ if((!SiS_Pr->CP_PrefClock) ||
+ (modexres > SiS_Pr->PanelXRes) || (modeyres > SiS_Pr->PanelYRes)) {
+ SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ }
+ break;
+ }
+
+ if(SiS_Pr->UseCustomMode) {
+ SiS_Pr->SiS_LCDInfo |= (DontExpandLCD | LCDPass11);
}
/* (In)validate LCDPass11 flag */
@@ -1838,70 +2090,37 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
}
- /* Special cases */
- if( (SiS_Pr->SiS_IF_DEF_FSTN) ||
- (SiS_Pr->SiS_IF_DEF_DSTN) ||
- (SiS_Pr->SiS_CustomT == CUT_BARCO1366) ||
- (SiS_Pr->SiS_CustomT == CUT_BARCO1024) ||
- (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) {
- SiS_Pr->PanelHRS = 999;
- SiS_Pr->PanelHRE = 999;
- }
-
- if( (SiS_Pr->SiS_CustomT == CUT_BARCO1366) ||
- (SiS_Pr->SiS_CustomT == CUT_BARCO1024) ||
- (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) {
- SiS_Pr->PanelVRS = 999;
- SiS_Pr->PanelVRE = 999;
- }
-
-#ifdef SIS315H
- if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) {
- if(!(SiS_Pr->SiS_ROMNew)) {
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- /* Enable 302LV/302ELV dual link mode.
- * For 661, this is done above.
- */
- if((SiS_Pr->SiS_CustomT == CUT_CLEVO1024) &&
- (SiS_Pr->SiS_LCDResInfo == Panel_1024x768)) {
- /* (Sets this in SenseLCD; new paneltypes) */
- SiS_Pr->SiS_LCDInfo |= LCDDualLink;
- }
- if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_1680x1050)) {
- SiS_Pr->SiS_LCDInfo |= LCDDualLink;
- }
- }
- }
- }
-#endif
-
+ /* LVDS DDA */
if(!((HwInfo->jChipType < SIS_315H) && (SiS_Pr->SiS_SetFlag & SetDOSMode))) {
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBType & VB_NoLCD)) {
if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {
if(ModeNo == 0x12) {
if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
}
+ } else if(ModeNo > 0x13) {
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1024x600) {
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ if((resinfo == SIS_RI_800x600) || (resinfo == SIS_RI_400x300)) {
+ SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ }
+ }
+ }
}
}
}
if(modeflag & HalfDCLK) {
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION == 1) {
+ SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ } else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
} else if(SiS_Pr->SiS_LCDResInfo == Panel_640x480) {
SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
} else if(ModeNo > 0x13) {
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
if(resinfo == SIS_RI_512x384) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
- } else if(SiS_Pr->SiS_LCDResInfo == Panel_1024x600) {
- if((resinfo == SIS_RI_800x600) || (resinfo == SIS_RI_400x300)) {
- SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
- }
} else if(SiS_Pr->SiS_LCDResInfo == Panel_800x600) {
if(resinfo == SIS_RI_400x300) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
}
@@ -1910,6 +2129,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
+ /* VESA timing */
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
if(SiS_Pr->SiS_VBInfo & SetNotSimuMode) {
SiS_Pr->SiS_SetFlag |= LCDVESATiming;
@@ -1965,14 +2185,27 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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)) {
- VCLKIndex = VCLKIndexGEN;
- if(resinfo == SIS_RI_1280x720) VCLKIndex = VCLK_1280x720;
- if(SiS_Pr->SiS_LCDResInfo == Panel_1280x720) {
- if(SiS_Pr->PanelHT == 1344) VCLKIndex = VCLK_1280x720_2;
+ 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;
@@ -2145,11 +2378,12 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
{
USHORT i,j,modeflag;
USHORT tempcl,tempah=0;
-#ifdef SIS300
- USHORT temp;
-#endif
+#if defined(SIS300) || defined(SIS315H)
+ USHORT tempbl;
+#endif
#ifdef SIS315H
- USHORT tempbl, tempah2, tempbl2;
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
+ USHORT tempah2, tempbl2;
#endif
if(ModeNo <= 0x13) {
@@ -2172,6 +2406,9 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} else {
for(i=0,j=4; i<3; i++,j++) SiS_SetReg(SiS_Pr->SiS_Part1Port,j,0);
+ if(HwInfo->jChipType >= SIS_315H) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0x7F);
+ }
tempcl = SiS_Pr->SiS_ModeType;
@@ -2181,14 +2418,14 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
/* For 301BDH: (with LCD via LVDS) */
if(SiS_Pr->SiS_VBType & VB_NoLCD) {
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32);
- temp &= 0xef;
- temp |= 0x02;
+ tempbl = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32);
+ tempbl &= 0xef;
+ tempbl |= 0x02;
if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) || (SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
- temp |= 0x10;
- temp &= 0xfd;
+ tempbl |= 0x10;
+ tempbl &= 0xfd;
}
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,tempbl);
}
if(ModeNo > 0x13) {
@@ -2362,7 +2599,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H
- unsigned char bridgerev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01);;
+ unsigned char bridgerev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01);
/* The following is nearly unpreditable and varies from machine
* to machine. Especially the 301DH seems to be a real trouble
@@ -2393,10 +2630,11 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
* in a 650 box (Jake). What is the criteria?
*/
- if((IS_SIS740) || (HwInfo->jChipType >= SIS_661)) {
+ if((IS_SIS740) || (HwInfo->jChipType >= SIS_661) || (SiS_Pr->SiS_ROMNew)) {
tempah = 0x30;
tempbl = 0xc0;
- if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
+ if((SiS_Pr->SiS_VBInfo & DisableCRT2Display) ||
+ ((SiS_Pr->SiS_ROMNew) && (!(ROMAddr[0x5b] & 0x04)))) {
tempah = 0x00;
tempbl = 0x00;
}
@@ -2427,23 +2665,23 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(IS_SIS740) {
tempah = 0x80;
- if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
- tempah = 0x00;
- }
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0x00;
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,0x7f,tempah);
} else {
tempah = 0x00;
tempbl = 0x7f;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
tempbl = 0xff;
- if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) {
- tempah = 0x80;
- }
+ if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) tempah = 0x80;
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,tempbl,tempah);
}
-
- /* 661: Sets p4 27 and 34 here, done in SetGroup4 here (old BIOS) */
+
+#if 0
+ if(SiS_Pr->SiS_VBType & VB_SIS301C) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x3a,0xc0);
+ }
+#endif
#endif /* SIS315H */
@@ -2472,9 +2710,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempbl = 0xfb;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
tempah = 0x00;
- if(SiS_IsDualEdge(SiS_Pr, HwInfo)) {
- tempbl = 0xff;
- }
+ if(SiS_IsDualEdge(SiS_Pr, HwInfo)) tempbl = 0xff;
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,tempbl,tempah);
@@ -2554,9 +2790,11 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if((SiS_Pr->SiS_VBType & VB_SISVB) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) {
+#if 0
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCDA | SetCRT2ToLCD | SetCRT2ToHiVision)) {
if(xres == 720) xres = 640;
}
+#endif
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
switch(SiS_Pr->SiS_LCDResInfo) {
@@ -2720,18 +2958,22 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
tempbx = SiS_Pr->SiS_LCDResInfo;
if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx += 32;
-
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { /* Pass 1:1 only (center-screen handled outside) */
+
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1680x1050) {
+ if (resinfo == SIS_RI_1280x800) tempal = 9;
+ else if(resinfo == SIS_RI_1400x1050) tempal = 11;
+ } else if((SiS_Pr->SiS_LCDResInfo == Panel_1280x800) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_1280x800_2)) {
+ if (resinfo == SIS_RI_1280x768) tempal = 9;
+ }
+
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ /* Pass 1:1 only (center-screen handled outside) */
+ /* This is never called for the panel's native resolution */
+ /* since Pass1:1 will not be set in this case */
tempbx = 100;
if(ModeNo >= 0x13) {
tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC_NS;
- if((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes == 1280) &&
- (SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].YRes == 768)) {
- /* Special for Fujitsu 7911 (VL-17WDX8), others custom */
- if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768) tempal = 0x08;
- else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768_2) tempal = 0x0f;
- else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768_3) tempal = 0x10;
- }
}
}
@@ -2777,13 +3019,20 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
(resinfo == SIS_RI_720x576) ||
(resinfo == SIS_RI_768x576)) {
tempal = 6;
+ if(SiS_Pr->SiS_TVMode & (TVSetPAL | TVSetPALN)) {
+ if(resinfo == SIS_RI_720x480) tempal = 9;
+ }
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) {
if(resinfo == SIS_RI_1024x768) tempal = 8;
}
if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) {
- if(resinfo == SIS_RI_1280x720) tempal = 8;
+ if((resinfo == SIS_RI_720x576) ||
+ (resinfo == SIS_RI_768x576)) {
+ tempal = 8;
+ }
+ if(resinfo == SIS_RI_1280x720) tempal = 9;
}
}
}
@@ -2796,6 +3045,7 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
tempbx = 0;
if((SiS_Pr->SiS_IF_DEF_CH70xx) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
+
tempbx = 10;
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1;
if(SiS_Pr->SiS_TVMode & TVSetPAL) {
@@ -2811,10 +3061,12 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1;
}
}
+
} else {
+
switch(SiS_Pr->SiS_LCDResInfo) {
case Panel_640x480: tempbx = 6; break;
- case Panel_640x480_2: tempbx = 30; break;
+ case Panel_640x480_2:
case Panel_640x480_3: tempbx = 30; break;
case Panel_800x600: tempbx = 0; break;
case Panel_1024x600: tempbx = 15; break;
@@ -2840,21 +3092,22 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) {
tempbx = 82;
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
} else if(SiS_Pr->SiS_CustomT == CUT_PANEL848) {
tempbx = 84;
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
}
+
+ if((SiS_Pr->SiS_CustomT != CUT_BARCO1366) &&
+ (SiS_Pr->SiS_CustomT != CUT_PANEL848)) {
+ if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) &&
+ (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) {
+ tempal = 0;
+ }
+ }
}
- if(SiS_Pr->SiS_SetFlag & SetDOSMode) {
- if(SiS_Pr->SiS_LCDResInfo != Panel_640x480) tempal = 7;
- if(HwInfo->jChipType < SIS_315H) {
- if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) tempal++;
- }
- }
-
(*CRT2Index) = tempbx;
(*ResIndex) = tempal & 0x1F;
}
@@ -2951,20 +3204,6 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
ResIndex = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
} else {
ResIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC_NS;
- /* Special for our 3 types, others custom (works with default) */
- if((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes == 1280) &&
- (SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].YRes == 768)) {
- if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768) ResIndex = 0x08;
- else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768_2) ResIndex = 0x0f;
- else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768_3) ResIndex = 0x10;
- }
- /* Special for 1280x720 TMDS <> LVDS */
- if((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes == 1280) &&
- (SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].YRes == 720)) {
- if(SiS_Pr->SiS_LCDResInfo == Panel_1280x720) {
- if(SiS_Pr->PanelHT == 1344) ResIndex = 0x12;
- }
- }
}
SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_NoScaleData[ResIndex].VGAHT;
SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_NoScaleData[ResIndex].VGAVT;
@@ -3070,11 +3309,14 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_INFO HwInfo)
{
- USHORT tempax,tempbx,modeflag;
- USHORT resinfo;
- USHORT CRT2Index,ResIndex;
+ UCHAR *ROMAddr = NULL;
+ USHORT tempax,tempbx,modeflag,romptr=0;
+ USHORT resinfo,CRT2Index,ResIndex;
const SiS_LCDDataStruct *LCDPtr = NULL;
const SiS_TVDataStruct *TVPtr = NULL;
+#ifdef SIS315H
+ SHORT resinfo661;
+#endif
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
@@ -3085,6 +3327,20 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+#ifdef SIS315H
+ resinfo661 = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].ROMMODEIDX661;
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
+ (SiS_Pr->SiS_SetFlag & LCDVESATiming) &&
+ (resinfo661 >= 0) &&
+ (SiS_Pr->SiS_NeedRomModeData) ) {
+ if((ROMAddr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
+ if((romptr = (SISGETROMW(21)))) {
+ romptr += (resinfo661 * 10);
+ ROMAddr = HwInfo->pjVirtualRomBase;
+ }
+ }
+ }
+#endif
}
SiS_Pr->SiS_NewFlickerMode = 0;
@@ -3220,23 +3476,49 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->UseCustomMode) {
- SiS_Pr->SiS_VGAHT = SiS_Pr->CHTotal;
- SiS_Pr->SiS_VGAVT = SiS_Pr->CVTotal;
- SiS_Pr->SiS_HT = SiS_Pr->CHTotal;
- SiS_Pr->SiS_VT = SiS_Pr->CVTotal;
- SiS_Pr->SiS_HDE = SiS_Pr->SiS_VGAHDE;
- SiS_Pr->SiS_VDE = SiS_Pr->SiS_VGAVDE;
+ SiS_Pr->SiS_VGAHT = SiS_Pr->CHTotal;
+ SiS_Pr->SiS_VGAVT = SiS_Pr->CVTotal;
+ SiS_Pr->SiS_HT = SiS_Pr->CHTotal;
+ SiS_Pr->SiS_VT = SiS_Pr->CVTotal;
+ SiS_Pr->SiS_HDE = SiS_Pr->SiS_VGAHDE;
+ SiS_Pr->SiS_VDE = SiS_Pr->SiS_VGAVDE;
} else {
+
+ BOOLEAN gotit = FALSE;
if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) {
- SiS_Pr->SiS_VGAHT = SiS_Pr->PanelHT;
- SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT;
- SiS_Pr->SiS_HT = SiS_Pr->PanelHT;
- SiS_Pr->SiS_VT = SiS_Pr->PanelVT;
+ SiS_Pr->SiS_VGAHT = SiS_Pr->PanelHT;
+ SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT;
+ SiS_Pr->SiS_HT = SiS_Pr->PanelHT;
+ SiS_Pr->SiS_VT = SiS_Pr->PanelVT;
+ gotit = TRUE;
- } else {
+ } else if( (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) && (romptr) && (ROMAddr) ) {
+
+#ifdef SIS315H
+ SiS_Pr->SiS_RVBHCMAX = ROMAddr[romptr];
+ SiS_Pr->SiS_RVBHCFACT = ROMAddr[romptr+1];
+ SiS_Pr->SiS_VGAHT = ROMAddr[romptr+2] | ((ROMAddr[romptr+3] & 0x0f) << 8);
+ SiS_Pr->SiS_VGAVT = ROMAddr[romptr+4] | ((ROMAddr[romptr+3] & 0xf0) << 4);
+ SiS_Pr->SiS_HT = ROMAddr[romptr+5] | ((ROMAddr[romptr+6] & 0x0f) << 8);
+ SiS_Pr->SiS_VT = ROMAddr[romptr+7] | ((ROMAddr[romptr+6] & 0xf0) << 4);
+ if(SiS_Pr->SiS_VGAHT) gotit = TRUE;
+ else {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ SiS_Pr->SiS_VGAHT = SiS_Pr->PanelHT;
+ SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT;
+ SiS_Pr->SiS_HT = SiS_Pr->PanelHT;
+ SiS_Pr->SiS_VT = SiS_Pr->PanelVT;
+ gotit = TRUE;
+ }
+#endif
+
+ }
+
+ if(!gotit) {
SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&CRT2Index,&ResIndex,HwInfo);
@@ -3248,10 +3530,10 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
case Panel_1280x720 + 32: LCDPtr = SiS_Pr->SiS_LCD1280x720Data; break;
case Panel_1280x768_2 : LCDPtr = SiS_Pr->SiS_ExtLCD1280x768_2Data; break;
case Panel_1280x768_2+ 32: LCDPtr = SiS_Pr->SiS_StLCD1280x768_2Data; break;
- case Panel_1280x768_3 :
- case Panel_1280x768_3+ 32: LCDPtr = SiS_Pr->SiS_LCD1280x768_3Data; break;
case Panel_1280x800 :
case Panel_1280x800 + 32: LCDPtr = SiS_Pr->SiS_LCD1280x800Data; break;
+ case Panel_1280x800_2 :
+ case Panel_1280x800_2+ 32: LCDPtr = SiS_Pr->SiS_LCD1280x800_2Data; break;
case Panel_1280x960 :
case Panel_1280x960 + 32: LCDPtr = SiS_Pr->SiS_LCD1280x960Data; break;
case Panel_1280x1024 : LCDPtr = SiS_Pr->SiS_ExtLCD1280x1024Data; break;
@@ -3435,8 +3717,10 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
#ifdef SIS315H
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
/* non-pass 1:1 only, see above */
- if(SiS_Pr->SiS_VGAVDE != SiS_Pr->PanelYRes) {
+ if(SiS_Pr->SiS_VGAHDE != SiS_Pr->PanelXRes) {
SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_HT - ((SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE) / 2);
+ }
+ if(SiS_Pr->SiS_VGAVDE != SiS_Pr->PanelYRes) {
SiS_Pr->SiS_LCDVDES = SiS_Pr->SiS_VT - ((SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE) / 2);
}
}
@@ -3552,207 +3836,144 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ===== For 30xB/LV ===== */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ===== For 30xB/LV ===== */
if(HwInfo->jChipType < SIS_315H) {
#ifdef SIS300 /* 300 series */
- if(HwInfo->jChipType == SIS_300) { /* For 300+301LV (A907) */
-
- if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
- }
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
+ } else {
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
}
+ SiS_PanelDelay(SiS_Pr, HwInfo, 3);
+ }
+ if(SiS_Is301B(SiS_Pr)) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0x3f);
SiS_ShortDelay(SiS_Pr,1);
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
- (!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) ) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
- }
- }
-
- } else {
-
- if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
- }
- if(SiS_Is301B(SiS_Pr)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0x3f);
- SiS_ShortDelay(SiS_Pr,1);
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- SiS_UnLockCRT2(SiS_Pr,HwInfo);
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_UnLockCRT2(SiS_Pr,HwInfo);
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x80);
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x02,0x40);
- if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
- (!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) ) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04);
- }
}
-
+ if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
+ (!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) ) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
+ } else {
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04);
+ }
+ }
+
#endif /* SIS300 */
} else {
#ifdef SIS315H /* 315 series */
+
+ BOOLEAN custom1 = ((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
+ (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) ? TRUE : FALSE;
- if(IS_SIS550650740660) { /* 550, 650, 740, 660 */
-
- modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34) & 0x7f;
+ modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34) & 0x7f;
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* LV */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
#ifdef SET_EMI
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
- }
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
}
+ }
#endif
- if( (modenum <= 0x13) ||
- (!(SiS_IsDualEdge(SiS_Pr,HwInfo))) ||
- (SiS_IsVAMode(SiS_Pr,HwInfo)) ) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
- if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
- }
- }
-
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- SiS_DDC2Delay(SiS_Pr,0xff00);
- SiS_DDC2Delay(SiS_Pr,0xe000);
-
- SiS_SetRegByte(SiS_Pr->SiS_P3c6,0x00);
-
- pushax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x06);
-
- if(IS_SIS740) {
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
- }
-
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
-
- if(!(SiS_IsNotM650orLater(SiS_Pr, HwInfo))) {
- tempah = 0xef;
- if(SiS_IsVAMode(SiS_Pr,HwInfo)) {
- tempah = 0xf7;
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah);
- }
- }
-
- } else if(SiS_Pr->SiS_VBType & VB_NoLCD) { /* B-DH */
-
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,0xef);
- }
-
+ if( (modenum <= 0x13) ||
+ (SiS_IsVAMode(SiS_Pr,HwInfo)) ||
+ (!(SiS_IsDualEdge(SiS_Pr,HwInfo))) ) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
+ if(custom1) SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
- if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,0xef);
+ if(!custom1) {
+ SiS_DDC2Delay(SiS_Pr,0xff00);
+ SiS_DDC2Delay(SiS_Pr,0xe000);
+ SiS_SetRegByte(SiS_Pr->SiS_P3c6,0x00);
+ pushax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x06);
+ if(IS_SIS740) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
+ }
+ SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- tempah = 0x3f;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- tempah = 0x7f;
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- tempah = 0xbf;
- }
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+ }
+
+ if(!(SiS_IsNotM650orLater(SiS_Pr, HwInfo))) {
+ if(HwInfo->jChipType < SIS_340) {
+ tempah = 0xef;
+ if(SiS_IsVAMode(SiS_Pr,HwInfo)) tempah = 0xf7;
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah);
}
+ }
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,~0x10);
+ }
+
+ tempah = 0x3f;
+ if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
+ tempah = 0x7f;
+ if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) tempah = 0xbf;
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
- if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13))) {
-
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- } else {
- SiS_DisplayOff(SiS_Pr);
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
- if((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13)) {
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
- }
- }
-
- } else {
-
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- if(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
- SiS_DisplayOff(SiS_Pr);
- }
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
- } else {
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- }
-
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
+ if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13))) {
+ SiS_DisplayOff(SiS_Pr);
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
+
+ }
+
+ if((!(SiS_IsVAMode(SiS_Pr,HwInfo))) ||
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13))) {
+
+ if(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
+ SiS_DisplayOff(SiS_Pr);
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
}
- if((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) &&
- (SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
-
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,~0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
- tempah = 0x3f;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- tempah = 0x7f;
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- tempah = 0xbf;
- }
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+ }
+
+ if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
+ }
- if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
+ if(!custom1) {
if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
if(!(SiS_CRT2IsLCD(SiS_Pr,HwInfo))) {
if(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
@@ -3763,89 +3984,31 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetReg(SiS_Pr->SiS_P3c4,0x06,pushax);
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- if( (SiS_IsVAMode(SiS_Pr, HwInfo)) ||
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
+ if(SiS_IsVAorLCD(SiS_Pr, HwInfo)) {
SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 20);
}
}
-
- } else if(SiS_Pr->SiS_VBType & VB_NoLCD) {
-
- /* NIL */
-
- } else if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
-
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- tempah = 0xef;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- if(modenum > 0x13) {
- tempah = 0xf7;
- }
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah);
- }
- if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- (!(SiS_IsDualEdge(SiS_Pr,HwInfo)))) {
- if((!(SiS_WeHaveBacklightCtrl(SiS_Pr, HwInfo))) ||
- (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo)))) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
- SiS_PanelDelay(SiS_Pr, HwInfo, 4);
- }
+
+ } else {
+
+ if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
+ (!(SiS_IsDualEdge(SiS_Pr,HwInfo)))) {
+ if((!(SiS_WeHaveBacklightCtrl(SiS_Pr, HwInfo))) ||
+ (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo)))) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
+ SiS_PanelDelay(SiS_Pr, HwInfo, 4);
}
}
}
-
- } else { /* 315, 330 - all bridge types */
-
- if(SiS_Is301B(SiS_Pr)) {
- tempah = 0x3f;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- tempah = 0x7f;
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- tempah = 0xbf;
- }
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
- if(SiS_IsVAMode(SiS_Pr,HwInfo)) {
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- }
- }
- if( (!(SiS_Is301B(SiS_Pr))) ||
- (!(SiS_IsVAMode(SiS_Pr,HwInfo))) ) {
-
- if( (!(SiS_Is301B(SiS_Pr))) ||
- (!(SiS_IsDualEdge(SiS_Pr,HwInfo))) ) {
-
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff(SiS_Pr);
-
- }
-
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
-
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
-
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
-
- }
-
- } /* 315/330 */
+ }
#endif /* SIS315H */
}
- } else { /* ============ For 301 ================ */
+ } else { /* ============ For 301 ================ */
if(HwInfo->jChipType < SIS_315H) {
#ifdef SIS300
@@ -3937,6 +4100,12 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef SIS315H /* 315 series */
+ if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
+ if(HwInfo->jChipType < SIS_340) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,~0x18);
+ }
+ }
+
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(HwInfo->jChipType == SIS_740) {
@@ -4067,7 +4236,6 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
BOOLEAN delaylong = FALSE;
#endif
-
if(SiS_Pr->SiS_VBType & VB_SISVB) {
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ====== For 301B et al ====== */
@@ -4076,28 +4244,55 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef SIS300 /* 300 series */
- if(HwInfo->jChipType == SIS_300) {
-
- if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
- if(!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 0);
- }
+ if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
+ } else if(SiS_Pr->SiS_VBType & VB_NoLCD) {
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
+ }
+ if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV | VB_NoLCD)) {
+ if(!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 0);
}
}
+ }
+
+ if((SiS_Pr->SiS_VBType & VB_NoLCD) &&
+ (SiS_CRT2IsLCD(SiS_Pr, HwInfo))) {
+
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* Enable CRT2 */
+ SiS_DisplayOn(SiS_Pr);
+ SiS_UnLockCRT2(SiS_Pr,HwInfo);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF);
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F);
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40);
+ }
+ if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x40)) {
+ if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 1);
+ }
+ SiS_WaitVBRetrace(SiS_Pr,HwInfo);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
+ }
+ }
+
+ } else {
+
temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
- if(SiS_BridgeInSlave(SiS_Pr)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
}
SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0);
SiS_DisplayOn(SiS_Pr);
- if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
SiS_PanelDelay(SiS_Pr, HwInfo, 1);
@@ -4106,441 +4301,284 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
}
}
+
+ }
- } else {
-
- if((SiS_Pr->SiS_VBType & VB_NoLCD) &&
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo))) {
- /* This is only for LCD output on 301B-DH via LVDS */
- SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
- if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 0);
- }
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* Enable CRT2 */
- SiS_DisplayOn(SiS_Pr);
- SiS_UnLockCRT2(SiS_Pr,HwInfo);
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF);
- if(SiS_BridgeInSlave(SiS_Pr)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F);
- } else {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40);
- }
- if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x40)) {
- if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
- if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 1);
- }
- SiS_WaitVBRetrace(SiS_Pr,HwInfo);
- SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
- }
- }
- } else {
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
- if(SiS_BridgeInSlave(SiS_Pr)) {
- tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
- }
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0);
- SiS_DisplayOn(SiS_Pr);
- }
-
- }
+
#endif /* SIS300 */
} else {
#ifdef SIS315H /* 315 series */
- if(IS_SIS550650740660) { /* 550, 650, 740, 660 */
-
- UCHAR r30=0, r31=0, r32=0, r33=0, cr36=0;
-
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+#ifdef SET_EMI
+ UCHAR r30=0, r31=0, r32=0, r33=0, cr36=0;
+ /* USHORT emidelay=0; */
+#endif
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef);
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef);
#ifdef SET_EMI
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
- }
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+ }
#endif
- }
-
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- tempah = 0x10;
- if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) {
- if(SiS_TVEnabled(SiS_Pr, HwInfo)) tempah = 0x18;
- else tempah = 0x08;
- }
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah);
- }
-
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- SiS_SetRegByte(SiS_Pr->SiS_P3c6,0x00);
- SiS_DisplayOff(SiS_Pr);
- pushax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x06);
- if(IS_SIS740) {
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
- }
- }
-
- if( (SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
- if(!(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2);
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- SiS_GenericDelay(SiS_Pr, 0x4500);
- }
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2);
- } else {
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
- SiS_PanelDelay(SiS_Pr, HwInfo, 0);
- }
- }
- }
-
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40)) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
- delaylong = TRUE;
- }
- }
-
- } else if(SiS_Pr->SiS_VBType & VB_NoLCD) {
+ }
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,0x10);
+ if(!(SiS_IsNotM650orLater(SiS_Pr, HwInfo))) {
+ if(HwInfo->jChipType < SIS_340) {
+ tempah = 0x10;
+ if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) {
+ if(SiS_TVEnabled(SiS_Pr, HwInfo)) tempah = 0x18;
+ else tempah = 0x08;
}
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah);
+ }
+ }
- } else if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
+ SiS_SetRegByte(SiS_Pr->SiS_P3c6,0x00);
+ SiS_DisplayOff(SiS_Pr);
+ pushax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x06);
+ if(IS_SIS740) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
+ }
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- tempah = 0x10;
- if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) {
- if(SiS_TVEnabled(SiS_Pr, HwInfo)) tempah = 0x18;
- else tempah = 0x08;
+ if(SiS_IsVAorLCD(SiS_Pr, HwInfo)) {
+ if(!(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2);
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_GenericDelay(SiS_Pr, 0x4500);
}
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah);
}
-
}
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
- if(SiS_BridgeInSlave(SiS_Pr)) {
- tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) {
- if(!(SiS_LCDAEnabled(SiS_Pr, HwInfo))) temp |= 0x20;
- }
- }
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
-
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
-
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2e);
- if(!(temp & 0x80)) {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
- }
- } else {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- }
- } else {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1e,0x20);
+ if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40)) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
+ delaylong = TRUE;
}
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
+ }
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2e);
- if(!(temp & 0x80)) {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+ if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
+
+ temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
+ tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
+ if(!(tempah & SetCRT2ToRAMDAC)) {
+ if(!(SiS_LCDAEnabled(SiS_Pr, HwInfo))) temp |= 0x20;
}
- }
+ }
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
- tempah = 0xc0;
- if(SiS_IsDualEdge(SiS_Pr, HwInfo)) {
- tempah = 0x80;
- if(!(SiS_IsVAMode(SiS_Pr, HwInfo))) {
- tempah = 0x40;
- }
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
+
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
}
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+
+ } else {
+
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1e,0x20);
+
+ }
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) &&
- (!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
- }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+
+ tempah = 0xc0;
+ if(SiS_IsDualEdge(SiS_Pr, HwInfo)) {
+ tempah = 0x80;
+ if(!(SiS_IsVAMode(SiS_Pr, HwInfo))) tempah = 0x40;
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah);
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- }
-#ifdef COMPAQ_HACK
- if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- }
-#endif
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
- if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) {
+ if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) {
#ifdef SET_EMI
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
- }
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+ SiS_GenericDelay(SiS_Pr, 0x500);
+ }
#endif
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c);
+
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
#ifdef SET_EMI
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
-
- cr36 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
-
- /* (P4_30|0x40) */
- /* Compal 1400x1050: 0x05, 0x60, 0x00 YES (1.10.7w; CR36=69) */
- /* Compal 1400x1050: 0x0d, 0x70, 0x40 YES (1.10.7x; CR36=69) */
- /* Acer 1280x1024: 0x12, 0xd0, 0x6b NO (1.10.9k; CR36=73) */
- /* Compaq 1280x1024: 0x0d, 0x70, 0x6b YES (1.12.04b; CR36=03) */
- /* Clevo 1024x768: 0x05, 0x60, 0x33 NO (1.10.8e; CR36=12, DL!) */
- /* Clevo 1024x768: 0x0d, 0x70, 0x40 (if type == 3) YES (1.10.8y; CR36=?2) */
- /* Clevo 1024x768: 0x05, 0x60, 0x33 (if type != 3) YES (1.10.8y; CR36=?2) */
- /* Asus 1024x768: ? ? (1.10.8o; CR36=?2) */
- /* Asus 1024x768: 0x08, 0x10, 0x3c (problematic) YES (1.10.8q; CR36=22) */
-
- if(SiS_Pr->HaveEMI) {
- r30 = SiS_Pr->EMI_30;
- r31 = SiS_Pr->EMI_31;
- r32 = SiS_Pr->EMI_32;
- r33 = SiS_Pr->EMI_33;
- } else {
- r30 = 0;
+ cr36 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
+
+ if(SiS_Pr->SiS_ROMNew) {
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
+ USHORT romptr = GetLCDStructPtr661_2(SiS_Pr, HwInfo);
+ if(romptr) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); /* Reset */
+ SiS_Pr->EMI_30 = 0;
+ SiS_Pr->EMI_31 = ROMAddr[romptr + SiS_Pr->SiS_EMIOffset + 0];
+ SiS_Pr->EMI_32 = ROMAddr[romptr + SiS_Pr->SiS_EMIOffset + 1];
+ SiS_Pr->EMI_33 = ROMAddr[romptr + SiS_Pr->SiS_EMIOffset + 2];
+ if(ROMAddr[romptr + 1] & 0x10) SiS_Pr->EMI_30 = 0x40;
+ /* emidelay = SISGETROMW((romptr + 0x22)); */
+ SiS_Pr->HaveEMI = SiS_Pr->HaveEMILCD = SiS_Pr->OverruleEMI = TRUE;
}
+ }
- /* EMI_30 is read at driver start; however, the BIOS sets this
- * (if it is used) only if the LCD is in use. In case we caught
- * the machine while on TV output, this bit is not set and we
- * don't know if it should be set - hence our detection is wrong.
- * Work-around this here:
- */
-
- if((!SiS_Pr->HaveEMI) || (!SiS_Pr->HaveEMILCD)) {
- if((cr36 & 0x0f) == 0x02) { /* 1024x768 */
- r30 |= 0x40;
- if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) {
- r30 &= ~0x40;
- }
- } else if((cr36 & 0x0f) == 0x03) { /* 1280x1024 */
- r30 |= 0x40;
- if(SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) {
- r30 &= ~0x40;
- }
- } else if((cr36 & 0x0f) == 0x09) { /* 1400x1050 */
- r30 |= 0x40;
- } else if((cr36 & 0x0f) == 0x0b) { /* 1600x1200 - unknown */
- r30 |= 0x40;
- }
- }
+ /* (P4_30|0x40) */
+ /* Compal 1400x1050: 0x05, 0x60, 0x00 YES (1.10.7w; CR36=69) */
+ /* Compal 1400x1050: 0x0d, 0x70, 0x40 YES (1.10.7x; CR36=69) */
+ /* Acer 1280x1024: 0x12, 0xd0, 0x6b NO (1.10.9k; CR36=73) */
+ /* Compaq 1280x1024: 0x0d, 0x70, 0x6b YES (1.12.04b; CR36=03) */
+ /* Clevo 1024x768: 0x05, 0x60, 0x33 NO (1.10.8e; CR36=12, DL!) */
+ /* Clevo 1024x768: 0x0d, 0x70, 0x40 (if type == 3) YES (1.10.8y; CR36=?2) */
+ /* Clevo 1024x768: 0x05, 0x60, 0x33 (if type != 3) YES (1.10.8y; CR36=?2) */
+ /* Asus 1024x768: ? ? (1.10.8o; CR36=?2) */
+ /* Asus 1024x768: 0x08, 0x10, 0x3c (problematic) YES (1.10.8q; CR36=22) */
+
+ if(SiS_Pr->HaveEMI) {
+ r30 = SiS_Pr->EMI_30; r31 = SiS_Pr->EMI_31;
+ r32 = SiS_Pr->EMI_32; r33 = SiS_Pr->EMI_33;
+ } else {
+ r30 = 0;
+ }
- if(!SiS_Pr->HaveEMI) {
- if((cr36 & 0x0f) == 0x02) {
+ /* EMI_30 is read at driver start; however, the BIOS sets this
+ * (if it is used) only if the LCD is in use. In case we caught
+ * the machine while on TV output, this bit is not set and we
+ * don't know if it should be set - hence our detection is wrong.
+ * Work-around this here:
+ */
+
+ if((!SiS_Pr->HaveEMI) || (!SiS_Pr->HaveEMILCD)) {
+ switch((cr36 & 0x0f)) {
+ case 2:
+ r30 |= 0x40;
+ if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) r30 &= ~0x40;
+ if(!SiS_Pr->HaveEMI) {
+ r31 = 0x05; r32 = 0x60; r33 = 0x33;
if((cr36 & 0xf0) == 0x30) {
r31 = 0x0d; r32 = 0x70; r33 = 0x40;
- } else {
- r31 = 0x05; r32 = 0x60; r33 = 0x33;
- }
- } else if((cr36 & 0x0f) == 0x03) {
+ }
+ }
+ break;
+ case 3: /* 1280x1024 */
+ if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) r30 |= 0x40;
+ if(!SiS_Pr->HaveEMI) {
+ r31 = 0x12; r32 = 0xd0; r33 = 0x6b;
if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) {
r31 = 0x0d; r32 = 0x70; r33 = 0x6b;
- } else {
- r31 = 0x12; r32 = 0xd0; r33 = 0x6b;
}
- } else if((cr36 & 0x0f) == 0x09) {
+ }
+ break;
+ case 9: /* 1400x1050 */
+ r30 |= 0x40;
+ if(!SiS_Pr->HaveEMI) {
+ r31 = 0x05; r32 = 0x60; r33 = 0x00;
if(SiS_Pr->SiS_CustomT == CUT_COMPAL1400_2) {
r31 = 0x0d; r32 = 0x70; r33 = 0x40; /* BIOS values */
- } else {
- r31 = 0x05; r32 = 0x60; r33 = 0x00;
}
- } else {
+ }
+ break;
+ case 11: /* 1600x1200 - unknown */
+ r30 |= 0x40;
+ if(!SiS_Pr->HaveEMI) {
r31 = 0x05; r32 = 0x60; r33 = 0x00;
}
}
+ }
- /* BIOS values don't work so well sometimes */
- if(!SiS_Pr->OverruleEMI) {
+ /* BIOS values don't work so well sometimes */
+ if(!SiS_Pr->OverruleEMI) {
#ifdef COMPAL_HACK
- if(SiS_Pr->SiS_CustomT == CUT_COMPAL1400_2) {
- if((cr36 & 0x0f) == 0x09) {
- r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x00;
- }
- }
+ if(SiS_Pr->SiS_CustomT == CUT_COMPAL1400_2) {
+ if((cr36 & 0x0f) == 0x09) {
+ r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x00;
+ }
+ }
#endif
#ifdef COMPAQ_HACK
- if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) {
- if((cr36 & 0x0f) == 0x03) {
- r30 = 0x20; r31 = 0x12; r32 = 0xd0; r33 = 0x6b; /* rev 1 */
- }
+ if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) {
+ if((cr36 & 0x0f) == 0x03) {
+ r30 = 0x20; r31 = 0x12; r32 = 0xd0; r33 = 0x6b;
}
+ }
#endif
#ifdef ASUS_HACK
- if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) {
- if((cr36 & 0x0f) == 0x02) {
- /* r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x33; */ /* rev 2 */
- /* r30 = 0x20; r31 = 0x05; r32 = 0x60; r33 = 0x33; */ /* rev 3 */
- /* r30 = 0x60; r31 = 0x0d; r32 = 0x70; r33 = 0x40; */ /* rev 4 */
- /* r30 = 0x20; r31 = 0x0d; r32 = 0x70; r33 = 0x40; */ /* rev 5 */
- }
+ if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) {
+ if((cr36 & 0x0f) == 0x02) {
+ /* r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x33; */ /* rev 2 */
+ /* r30 = 0x20; r31 = 0x05; r32 = 0x60; r33 = 0x33; */ /* rev 3 */
+ /* r30 = 0x60; r31 = 0x0d; r32 = 0x70; r33 = 0x40; */ /* rev 4 */
+ /* r30 = 0x20; r31 = 0x0d; r32 = 0x70; r33 = 0x40; */ /* rev 5 */
}
-#endif
- }
- if(!(SiS_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) {
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20);
}
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,r31);
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,r32);
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,r33);
- if(!(SiS_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) {
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
- } else {
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x00);
- }
- if( (SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
- if(r30 & 0x40) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 5);
- if(delaylong) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 5);
- delaylong = FALSE;
- }
- SiS_WaitVBRetrace(SiS_Pr,HwInfo);
- if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) {
- SiS_GenericDelay(SiS_Pr, 0x500);
- }
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40);
- }
- }
- }
#endif
- }
-
- if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) {
-
- if( (SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
- SiS_DisplayOn(SiS_Pr);
- SiS_PanelDelay(SiS_Pr, HwInfo, 1);
- SiS_WaitVBRetrace(SiS_Pr, HwInfo);
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
- if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01);
- }
+ }
+
+ if(!(SiS_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); /* Reset */
+ SiS_GenericDelay(SiS_Pr, 0x500);
}
-
- } else if(SiS_Pr->SiS_CustomT == CUT_CLEVO1400) {
-
- if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
- if( (SiS_IsVAMode(SiS_Pr, HwInfo)) ||
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
- SiS_DisplayOn(SiS_Pr);
- SiS_PanelDelay(SiS_Pr, HwInfo, 1);
- SiS_WaitVBRetrace(SiS_Pr,HwInfo);
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01);
- }
- }
-
- } else {
-
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
- if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
- if( (SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- ((SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
- if(delaylong) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
- }
- SiS_WaitVBRetrace(SiS_Pr,HwInfo);
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,r31);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,r32);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,r33);
+#endif /* SET_EMI */
+
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
+
+#ifdef SET_EMI
+ if( (SiS_LCDAEnabled(SiS_Pr, HwInfo)) ||
+ (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
+ if(r30 & 0x40) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 5);
+ if(delaylong) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 5);
+ delaylong = FALSE;
+ }
+ SiS_WaitVBRetrace(SiS_Pr,HwInfo);
+ if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) {
SiS_GenericDelay(SiS_Pr, 0x500);
}
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); /* Enable */
}
- }
-
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x06,pushax);
- SiS_DisplayOn(SiS_Pr);
- SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xff);
-
- if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
- }
-
+ }
+#endif
}
-
}
- } else { /* 315, 330 */
-
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
- if(SiS_BridgeInSlave(SiS_Pr)) {
- tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
- }
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
-
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
-
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2E);
- if(!(temp & 0x80))
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
- }
-
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
-
- if(SiS_Is301B(SiS_Pr)) {
-
- temp=SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2E);
- if(!(temp & 0x80))
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
-
- tempah = 0xc0;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- tempah = 0x80;
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- tempah = 0x40;
- }
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
+ if(SiS_IsVAorLCD(SiS_Pr, HwInfo)) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
+ if(delaylong) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
+ }
+ SiS_WaitVBRetrace(SiS_Pr,HwInfo);
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_GenericDelay(SiS_Pr, 0x500);
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01);
}
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah);
-
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
-
- } else {
-
- SiS_VBLongWait(SiS_Pr);
- SiS_DisplayOn(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7F);
- SiS_VBLongWait(SiS_Pr);
-
}
- } /* 315, 330 */
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x06,pushax);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xff);
+
+ }
+
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
+ }
#endif /* SIS315H */
@@ -4556,9 +4594,9 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
- if(SiS_BridgeInSlave(SiS_Pr)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
}
SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
@@ -4611,7 +4649,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_DisplayOn(SiS_Pr);
SiS_UnLockCRT2(SiS_Pr,HwInfo);
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF);
- if(SiS_BridgeInSlave(SiS_Pr)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F);
} else {
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40);
@@ -4643,6 +4681,12 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef SIS315H /* 315 series */
+ if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
+ if(HwInfo->jChipType < SIS_340) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,0x18);
+ }
+ }
+
if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
@@ -4897,9 +4941,11 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex
}
}
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if(SiS_Pr->SiS_LCDInfo & LCDSync) {
- tempah = SiS_Pr->SiS_LCDInfo;
- tempbl = (tempah >> 6) & 0x03;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ if(SiS_Pr->SiS_LCDInfo & LCDSync) {
+ tempah = SiS_Pr->SiS_LCDInfo;
+ tempbl = (tempah >> 6) & 0x03;
+ }
}
}
}
@@ -5004,7 +5050,7 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo,
CRT1ModeNo = 0xfe;
VCLK = SiS_Pr->CSRClock_CRT1; /* Get VCLK */
- data2 = (SiS_Pr->CModeFlag_CRT1 & ModeInfoFlag) - 2;
+ data2 = (SiS_Pr->CModeFlag_CRT1 & ModeTypeMask) - 2;
switch(data2) { /* Get color depth */
case 0 : colorth = 1; break;
case 1 : colorth = 1; break;
@@ -5224,14 +5270,22 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo,
static void
SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- USHORT temp;
-
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x01,0x3B);
- temp = 0x04;
- if(HwInfo->jChipType >= SIS_661) {
- if((SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8) == 0x80) temp = 0x44;
+ if( (HwInfo->jChipType == SIS_760) &&
+ (SiS_Pr->SiS_SysFlags & SF_760LFB) &&
+ (SiS_Pr->SiS_ModeType == Mode32Bpp) &&
+ (SiS_Pr->SiS_VGAHDE >= 1280) &&
+ (SiS_Pr->SiS_VGAVDE >= 1024) ) {
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2f,0x03);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x01,0x3b);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4d,0xc0);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2f,0x01);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4d,0xc0);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,0x6e);
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,~0x3f,0x04);
}
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,~0x3f,temp);
+
}
#endif
@@ -5240,10 +5294,10 @@ SiS_GetVGAHT2(SiS_Private *SiS_Pr)
{
ULONG tempax,tempbx;
- tempbx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) * SiS_Pr->SiS_RVBHCMAX) & 0xFFFF;
+ tempbx = (SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) * SiS_Pr->SiS_RVBHCMAX;
tempax = (SiS_Pr->SiS_VT - SiS_Pr->SiS_VDE) * SiS_Pr->SiS_RVBHCFACT;
tempax = (tempax * SiS_Pr->SiS_HT) / tempbx;
- return((USHORT) tempax);
+ return((USHORT)tempax);
}
/* Set Part 1 / SiS bridge slave mode */
@@ -5607,9 +5661,8 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif
}
- /* is lvds if really LVDS, or SiS 301B-DH with external LVDS transmitter */
- if((SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
- ((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBType & VB_NoLCD))) {
+ /* is lvds if really LVDS, or 301B-DH with external LVDS transmitter */
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBType & VB_NoLCD)) {
islvds = TRUE;
}
@@ -5686,12 +5739,6 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(tempax >= SiS_Pr->SiS_HT) tempax -= SiS_Pr->SiS_HT;
temp = tempax;
-#if 0
- /* TEST 2 */
- if((HwInfo->jChipType >= SIS_315H) && (islvds) && (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050)) {
- } else
- /* /TEST2 */
-#endif
if(temp & 0x07) temp += 8;
temp >>= 3;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x17,temp); /* BPLHDEE */
@@ -5737,13 +5784,6 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp += 2;
if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
temp += 8;
-#if 0
- /* TEST 1 */
- if((HwInfo->jChipType >= SIS_315H) && (islvds) && (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050)) {
- temp -= 16;
- } else
- /* /test1 */
-#endif
if(SiS_Pr->PanelHRE != 999) {
temp = tempcx + SiS_Pr->PanelHRE;
if(temp >= SiS_Pr->SiS_HT) temp -= SiS_Pr->SiS_HT;
@@ -6145,8 +6185,10 @@ static void
SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex)
{
+#if defined(SIS300) || defined(SIS315H)
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
- USHORT temp=0, tempax=0, tempbx=0, tempcx=0;
+#endif
+ USHORT temp=0, tempax=0, tempbx=0, tempcx=0, bridgeadd=0;
USHORT pushbx=0, CRT1Index=0, modeflag, resinfo=0;
#ifdef SIS315H
USHORT tempbl=0;
@@ -6203,40 +6245,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempbx = pushbx + tempcx;
tempcx <<= 1;
tempcx += tempbx;
-
- if(SiS_Pr->SiS_VBType & VB_SISVB) {
-
- if(SiS_Pr->UseCustomMode) {
- tempbx = SiS_Pr->CHSyncStart + 12;
- tempcx = SiS_Pr->CHSyncEnd + 12;
- }
-
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
- unsigned char cr4, cr14, cr5, cr15;
- if(SiS_Pr->UseCustomMode) {
- cr4 = SiS_Pr->CCRT1CRTC[4];
- cr14 = SiS_Pr->CCRT1CRTC[14];
- cr5 = SiS_Pr->CCRT1CRTC[5];
- cr15 = SiS_Pr->CCRT1CRTC[15];
- } else {
- cr4 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4];
- cr14 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14];
- cr5 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5];
- cr15 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15];
- }
- tempbx = ((cr4 | ((cr14 & 0xC0) << 2)) - 1) << 3;
- tempcx = (((cr5 & 0x1F) | ((cr15 & 0x04) << (6-2))) - 1) << 3;
- }
-
- if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) {
- tempbx = 1040;
- tempcx = 1044;
- }
-
- }
-
- temp = tempbx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); /* CRT2 Horizontal Retrace Start */
+
+ bridgeadd = 12;
#endif /* SIS300 */
@@ -6257,11 +6267,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
tempcx--;
-
- temp = tempcx & 0xff;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */
-
- temp = ((tempcx & 0xff00) >> 8) << 4;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,tempcx); /* CRT2 Horizontal Total */
+ temp = (tempcx >> 4) & 0xF0;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* CRT2 Horizontal Total Overflow [7:4] */
tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HDEE 0x0A,0x0C */
@@ -6273,85 +6280,83 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempcx >>= 1;
}
tempbx += 16;
-
- temp = tempbx & 0xff;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* CRT2 Horizontal Display Enable End */
+
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,tempbx); /* CRT2 Horizontal Display Enable End */
pushbx = tempbx;
tempcx >>= 1;
tempbx += tempcx;
tempcx += tempbx;
+
+ bridgeadd = 16;
if(SiS_Pr->SiS_VBType & VB_SISVB) {
-
if(HwInfo->jChipType >= SIS_661) {
if((SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) ||
(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024)) {
if(resinfo == SIS_RI_1280x1024) {
- tempcx = 0x30;
+ tempcx = (tempcx & 0xff00) | 0x30;
} else if(resinfo == SIS_RI_1600x1200) {
- tempcx = 0xff;
+ tempcx = (tempcx & 0xff00) | 0xff;
}
}
}
-
- if(SiS_Pr->UseCustomMode) {
- tempbx = SiS_Pr->CHSyncStart + 16;
- tempcx = SiS_Pr->CHSyncEnd + 16;
- tempax = SiS_Pr->SiS_VGAHT;
- if(modeflag & HalfDCLK) tempax >>= 1;
- tempax--;
- if(tempcx > tempax) tempcx = tempax;
- }
-
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
- unsigned char cr4, cr14, cr5, cr15;
- if(SiS_Pr->UseCustomMode) {
- cr4 = SiS_Pr->CCRT1CRTC[4];
- cr14 = SiS_Pr->CCRT1CRTC[14];
- cr5 = SiS_Pr->CCRT1CRTC[5];
- cr15 = SiS_Pr->CCRT1CRTC[15];
- } else {
- cr4 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4];
- cr14 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14];
- cr5 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5];
- cr15 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15];
- }
- tempbx = ((cr4 | ((cr14 & 0xC0) << 2)) - 3) << 3; /* (VGAHRS-3)*8 */
- tempcx = (((cr5 & 0x1f) | ((cr15 & 0x04) << (5-2))) - 3) << 3; /* (VGAHRE-3)*8 */
- tempcx &= 0x00FF;
- tempcx |= (tempbx & 0xFF00);
- tempbx += 16;
- tempcx += 16;
- tempax = SiS_Pr->SiS_VGAHT;
- if(modeflag & HalfDCLK) tempax >>= 1;
- tempax--;
- if(tempcx > tempax) tempcx = tempax;
- }
-
- if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) {
- tempbx = 1040;
- tempcx = 1044; /* HWCursor bug! */
- }
-
}
- temp = tempbx & 0xff;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); /* CRT2 Horizontal Retrace Start */
#endif /* SIS315H */
} /* 315/330 series */
-
- tempax = tempbx & 0xFF00;
- tempbx = pushbx;
- tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4);
- tempax |= (tempbx & 0xFF00);
- temp = (tempax & 0xFF00) >> 8;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0C,temp);
-
- temp = tempcx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0D,temp); /* CRT2 Horizontal Retrace End */
-
+
+ if(SiS_Pr->SiS_VBType & VB_SISVB) {
+
+ if(SiS_Pr->UseCustomMode) {
+ tempbx = SiS_Pr->CHSyncStart + bridgeadd;
+ tempcx = SiS_Pr->CHSyncEnd + bridgeadd;
+ tempax = SiS_Pr->SiS_VGAHT;
+ if(modeflag & HalfDCLK) tempax >>= 1;
+ tempax--;
+ if(tempcx > tempax) tempcx = tempax;
+ }
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
+ unsigned char cr4, cr14, cr5, cr15;
+ if(SiS_Pr->UseCustomMode) {
+ cr4 = SiS_Pr->CCRT1CRTC[4];
+ cr14 = SiS_Pr->CCRT1CRTC[14];
+ cr5 = SiS_Pr->CCRT1CRTC[5];
+ cr15 = SiS_Pr->CCRT1CRTC[15];
+ } else {
+ cr4 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4];
+ cr14 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14];
+ cr5 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5];
+ cr15 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15];
+ }
+ tempbx = ((cr4 | ((cr14 & 0xC0) << 2)) - 3) << 3; /* (VGAHRS-3)*8 */
+ tempcx = (((cr5 & 0x1f) | ((cr15 & 0x04) << (5-2))) - 3) << 3; /* (VGAHRE-3)*8 */
+ tempcx &= 0x00FF;
+ tempcx |= (tempbx & 0xFF00);
+ tempbx += bridgeadd;
+ tempcx += bridgeadd;
+ tempax = SiS_Pr->SiS_VGAHT;
+ if(modeflag & HalfDCLK) tempax >>= 1;
+ tempax--;
+ if(tempcx > tempax) tempcx = tempax;
+ }
+
+ if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) {
+ tempbx = 1040;
+ tempcx = 1044; /* HWCursor bug! */
+ }
+
+ }
+
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,tempbx); /* CRT2 Horizontal Retrace Start */
+
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0D,tempcx); /* CRT2 Horizontal Retrace End */
+
+ temp = ((tempbx >> 8) & 0x0F) | ((pushbx >> 4) & 0xF0);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0C,temp); /* Overflow */
+
/* 2. Vertical setup */
tempcx = SiS_Pr->SiS_VGAVT - 1;
@@ -6375,12 +6380,10 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0E,temp); /* CRT2 Vertical Total */
tempbx = SiS_Pr->SiS_VGAVDE - 1;
- temp = tempbx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,temp); /* CRT2 Vertical Display Enable End */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,tempbx); /* CRT2 Vertical Display Enable End */
- temp = ((tempbx & 0xFF00) << 3) >> 8;
- temp |= ((tempcx & 0xFF00) >> 8);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x12,temp); /* Overflow (and HWCursor Test Mode) */
+ temp = ((tempbx >> 5) & 0x38) | ((tempcx >> 8) & 0x07);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x12,temp); /* Overflow */
if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) {
tempbx++;
@@ -6399,37 +6402,33 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
if(SiS_Pr->SiS_VBType & VB_SISVB) {
-
if(SiS_Pr->UseCustomMode) {
tempbx = SiS_Pr->CVSyncStart;
- tempcx = (tempcx & 0xFF00) | (SiS_Pr->CVSyncEnd & 0x00FF);
+ tempcx = SiS_Pr->CVSyncEnd;
}
-
if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
- unsigned char cr8, cr7, cr13, cr9;
+ unsigned char cr8, cr7, cr13;
if(SiS_Pr->UseCustomMode) {
- cr8 = SiS_Pr->CCRT1CRTC[8];
- cr7 = SiS_Pr->CCRT1CRTC[7];
- cr13 = SiS_Pr->CCRT1CRTC[13];
- cr9 = SiS_Pr->CCRT1CRTC[9];
+ cr8 = SiS_Pr->CCRT1CRTC[8];
+ cr7 = SiS_Pr->CCRT1CRTC[7];
+ cr13 = SiS_Pr->CCRT1CRTC[13];
+ tempcx = SiS_Pr->CCRT1CRTC[9];
} else {
- cr8 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8];
- cr7 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7];
- cr13 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13];
- cr9 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9];
+ cr8 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8];
+ cr7 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7];
+ cr13 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13];
+ tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9];
}
tempbx = cr8;
- if(cr7 & 0x04) tempbx |= 0x0100;
- if(cr7 & 0x80) tempbx |= 0x0200;
+ if(cr7 & 0x04) tempbx |= 0x0100;
+ if(cr7 & 0x80) tempbx |= 0x0200;
if(cr13 & 0x08) tempbx |= 0x0400;
- tempcx = (tempcx & 0xFF00) | (cr9 & 0x00FF);
- }
+ }
}
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x10,tempbx); /* CRT2 Vertical Retrace Start */
- temp = ((tempbx & 0xFF00) >> 8) << 4;
- temp |= (tempcx & 0x000F);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,temp); /* CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */
+ temp = ((tempbx >> 4) & 0x70) | (tempcx & 0x0F);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,temp); /* CRT2 Vert. Retrace End; Overflow */
/* 3. Panel delay compensation */
@@ -6439,7 +6438,6 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBType & VB_SISVB) {
temp = 0x20;
-
if(HwInfo->jChipType == SIS_300) {
temp = 0x10;
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) temp = 0x2c;
@@ -6450,10 +6448,10 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
if(SiS_Pr->SiS_LCDResInfo == Panel_1280x960) temp = 0x24;
if(SiS_Pr->SiS_LCDResInfo == Panel_Custom) temp = 0x2c;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
- else temp = 0x20;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
+ else temp = 0x20;
}
if(SiS_Pr->SiS_UseROM) {
if(ROMAddr[0x220] & 0x80) {
@@ -6524,8 +6522,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} /* < 661 */
tempax = 0;
- if (modeflag & DoubleScanMode) tempax |= 0x80;
- if (modeflag & HalfDCLK) tempax |= 0x40;
+ if(modeflag & DoubleScanMode) tempax |= 0x80;
+ if(modeflag & HalfDCLK) tempax |= 0x40;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax);
#endif /* SIS315H */
@@ -6588,7 +6586,6 @@ SiS_GetGroup2CLVXPtr(SiS_Private *SiS_Pr, int tabletype, PSIS_HW_INFO HwInfo)
if(SiS_Pr->SiS_TVMode & TVSetYPbPr525i) tableptr = SiS_Part2CLVX_3;
else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) tableptr = SiS_Part2CLVX_3;
else tableptr = SiS_Part2CLVX_5;
-
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
tableptr = SiS_Part2CLVX_6;
}
@@ -6868,9 +6865,9 @@ static void
SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
PSIS_HW_INFO HwInfo)
{
- USHORT i, j, tempax, tempbx, tempcx, temp;
- USHORT push1, push2, modeflag, crt2crtc, bridgeoffset;
- ULONG longtemp, tempeax;
+ USHORT i, j, tempax, tempbx, tempcx, tempch, tempcl, temp;
+ USHORT push2, modeflag, crt2crtc, bridgeoffset;
+ ULONG longtemp;
const UCHAR *PhasePoint;
const UCHAR *TimingPoint;
#ifdef SIS315H
@@ -7005,7 +7002,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempax = 950;
else if(SiS_Pr->SiS_TVMode & TVSetPAL) tempax = 520;
- else tempax = 440;
+ else tempax = 440; /* NTSC, YPbPr 525, 750 */
if( ( (!(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision)) && (SiS_Pr->SiS_VDE <= tempax) ) ||
( (SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) &&
@@ -7021,7 +7018,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
temp = tempax + (USHORT)TimingPoint[1];
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,temp);
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) && (SiS_Pr->SiS_VGAHDE >= 1024)) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) && (SiS_Pr->SiS_VGAHDE >= 1024)) {
if(SiS_Pr->SiS_TVMode & TVSetPAL) {
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x1b); /* 19 */
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x54); /* 52 */
@@ -7037,47 +7034,38 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempcx >>= 1;
tempcx--;
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempcx--;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1B,(tempcx & 0xff));
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1B,tempcx);
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0xF0,((tempcx >> 8) & 0x0f));
-
- tempcx++;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempcx++;
- tempcx >>= 1;
-
- push1 = tempcx;
-
+
+ tempcx = SiS_Pr->SiS_HT >> 1;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempcx >>= 1;
tempcx += 7;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempcx -= 4;
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x22,0x0F,((tempcx << 4) & 0xf0));
tempbx = TimingPoint[j] | (TimingPoint[j+1] << 8);
tempbx += tempcx;
-
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x24,tempbx);
- temp = ((tempbx & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0F,((tempbx >> 4) & 0xf0));
tempbx += 8;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
tempbx -= 4;
tempcx = tempbx;
}
- temp = (tempbx & 0x00FF) << 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x29,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x29,0x0F,((tempbx << 4) & 0xf0));
j += 2;
tempcx += (TimingPoint[j] | (TimingPoint[j+1] << 8));
- temp = tempcx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x27,temp);
- temp = ((tempcx & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x28,0x0F,temp);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x27,tempcx);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x28,0x0F,((tempcx >> 4) & 0xf0));
tempcx += 8;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempcx -= 4;
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2A,0x0F,((tempcx << 4) & 0xf0));
- tempcx = push1;
-
+ tempcx = SiS_Pr->SiS_HT >> 1;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempcx >>= 1;
j += 2;
tempcx -= (TimingPoint[j] | ((TimingPoint[j+1]) << 8));
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2D,0x0F,((tempcx << 4) & 0xf0));
@@ -7089,133 +7077,114 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2E,tempcx);
tempbx = SiS_Pr->SiS_VDE;
- if(SiS_Pr->SiS_VGAVDE == 360) tempbx = 746;
- if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 746;
- if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 853;
- if(HwInfo->jChipType < SIS_315H) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) tempbx >>= 1;
- } else {
- if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) &&
- (!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p|TVSetYPbPr750p))) ) {
- tempbx >>= 1;
- if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
- if(ModeNo <= 0x13) {
- if(crt2crtc == 1) tempbx++;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VGAVDE == 360) tempbx = 746;
+ if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 746;
+ if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 853;
+ } else if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) &&
+ (!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p|TVSetYPbPr750p))) ) {
+ tempbx >>= 1;
+ if(HwInfo->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
+ if((ModeNo <= 0x13) && (crt2crtc == 1)) tempbx++;
} else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(crt2crtc == 4) {
- if(SiS_Pr->SiS_ModeType <= 3) tempbx++;
+ if(SiS_Pr->SiS_ModeType <= ModeVGA) {
+ if(crt2crtc == 4) tempbx++;
}
}
}
- }
- tempbx -= 2;
- temp = tempbx & 0x00FF;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if((ModeNo == 0x2f) || (ModeNo == 0x5d) || (ModeNo == 0x5e)) temp++;
- }
- }
-
- if(HwInfo->jChipType < SIS_661) {
- /* From 1.10.7w - doesn't make sense */
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
- if(ModeNo == 0x03) temp++;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ if((ModeNo == 0x2f) || (ModeNo == 0x5d) || (ModeNo == 0x5e)) tempbx++;
+ }
+ if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
+ if(ModeNo == 0x03) tempbx++; /* From 1.10.7w - doesn't make sense */
}
}
}
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2F,temp);
+ tempbx -= 2;
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2F,tempbx);
temp = (tempcx >> 8) & 0x0F;
- temp |= (((tempbx >> 8) << 6) & 0xC0);
+ temp |= ((tempbx >> 2) & 0xC0);
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)) {
temp |= 0x10;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToAVIDEO) temp |= 0x20;
}
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,temp);
+
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,0xdf,((tempbx & 0x0400) >> 5));
+ }
+
+#if 0
+ /* TEST qqqq */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ for(i=0x01, j=0; i<=0x2D; i++, j++) {
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]);
+ }
+ for(i=0x39; i<=0x45; i++, j++) {
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]);
+ }
+ }
+#endif
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
tempbx = SiS_Pr->SiS_VDE;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p))) {
- tempbx >>= 1;
- }
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) &&
+ (!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p))) ) {
+ tempbx >>= 1;
}
tempbx -= 3;
- if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) { /* Why not 301B/LV? */
- if(HwInfo->jChipType >= SIS_661) {
- temp = 0;
- if(tempcx & 0x0400) temp |= 0x20;
- if(tempbx & 0x0400) temp |= 0x40;
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x10,temp);
- } else {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- if((SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_1680x1050)) {
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x10,0x60);
- }
- }
- }
- }
- tempbx &= 0x03ff;
- temp = ((tempbx & 0xFF00) >> 8) << 5;
- temp |= 0x18;
+ temp = ((tempbx >> 3) & 0x60) | 0x18;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x46,temp);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x47,tempbx);
+
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,0xbf,((tempbx & 0x0400) >> 4));
+ }
}
tempbx = 0;
if(!(modeflag & HalfDCLK)) {
if(SiS_Pr->SiS_VGAHDE >= SiS_Pr->SiS_HDE) {
tempax = 0;
- tempbx |= 0x2000;
+ tempbx |= 0x20;
}
}
- tempcx = 0x0101;
+ tempch = tempcl = 0x01;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(SiS_Pr->SiS_VGAHDE >= 1024) {
if((!(modeflag & HalfDCLK)) || (HwInfo->jChipType < SIS_315H)) {
- tempcx = 0x1920;
+ tempch = 0x19;
+ tempcl = 0x20;
if(SiS_Pr->SiS_VGAHDE >= 1280) {
- tempcx = 0x1420;
- tempbx &= ~0x2000;
+ tempch = 0x14;
+ tempbx &= ~0x20;
}
}
}
}
- if(!(tempbx & 0x2000)) {
- if(modeflag & HalfDCLK) {
- tempcx = (tempcx & 0xFF00) | ((tempcx << 1) & 0x00FF);
- }
- longtemp = (SiS_Pr->SiS_VGAHDE * ((tempcx & 0xFF00) >> 8)) / (tempcx & 0x00FF);
- longtemp <<= 13;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- longtemp <<= 3;
- }
- tempeax = longtemp / SiS_Pr->SiS_HDE;
- if(longtemp % SiS_Pr->SiS_HDE) tempeax++;
- tempax = (USHORT)tempeax;
- tempbx |= (tempax & 0x1F00);
- tempcx = (tempax & 0xFF00) >> (8 + 5);
+ if(!(tempbx & 0x20)) {
+ if(modeflag & HalfDCLK) tempcl <<= 1;
+ longtemp = ((SiS_Pr->SiS_VGAHDE * tempch) / tempcl) << 13;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) longtemp <<= 3;
+ tempax = longtemp / SiS_Pr->SiS_HDE;
+ if(longtemp % SiS_Pr->SiS_HDE) tempax++;
+ tempbx |= ((tempax >> 8) & 0x1F);
+ tempcx = tempax >> 13;
}
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x44,tempax);
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x45,0xC0,(tempbx >> 8));
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x45,0xC0,tempbx);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- temp = tempcx & 0x0007;
- if(tempbx & 0x2000) temp = 0;
- if((HwInfo->jChipType < SIS_661) || (!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD))) {
- temp |= 0x18;
- }
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x46,0xE0,temp);
+ tempcx &= 0x07;
+ if(tempbx & 0x20) tempcx = 0;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x46,0xF8,tempcx);
if(SiS_Pr->SiS_TVMode & TVSetPAL) {
tempbx = 0x0382;
@@ -7226,7 +7195,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
}
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4B,tempbx);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4C,tempcx);
- temp = (tempcx & 0x0300) >> (8 - 2);
+ temp = (tempcx & 0x0300) >> 6;
temp |= ((tempbx >> 8) & 0x03);
if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
temp |= 0x10;
@@ -7236,7 +7205,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4D,temp);
temp = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x43);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,(USHORT)(temp - 3));
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,(temp - 3));
SiS_SetTVSpecial(SiS_Pr, ModeNo);
@@ -7251,7 +7220,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->SiS_TVMode & TVSetPALM) {
if(!(SiS_Pr->SiS_TVMode & TVSetNTSC1024)) {
temp = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x01);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,temp - 1);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,(temp - 1));
}
SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xEF);
}
@@ -7270,8 +7239,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1;
tempbx--; /* RHACTE = HDE - 1 */
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2C,tempbx);
- temp = (tempbx & 0xFF00) >> 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2B,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2B,0x0F,((tempbx >> 4) & 0xf0));
temp = 0x01;
if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) {
@@ -7290,21 +7258,17 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
tempbx = SiS_Pr->SiS_VDE - 1;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x03,tempbx);
- temp = ((tempbx & 0xFF00) >> 8) & 0x07;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0C,0xF8,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0C,0xF8,((tempbx >> 8) & 0x07));
tempcx = SiS_Pr->SiS_VT - 1;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x19,tempcx);
-
- temp = ((tempcx & 0xFF00) >> 8) << 5;
-
- /* Enable dithering; only do this for 32bpp mode */
+ temp = (tempcx >> 3) & 0xE0;
if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ /* Enable dithering; only do this for 32bpp mode */
if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) {
temp |= 0x10;
}
}
-
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1A,0x0f,temp);
SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x09,0xF0);
@@ -7373,7 +7337,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
tempbx -= tempax; /* lcdvdee */
}
- /* Non-expanding: lcdvdees = tempcx = VT-1; lcdvdee = tempbx = VDE-1 */
+ /* Non-expanding: lcdvdes = tempcx = VT-1; lcdvdee = tempbx = VDE-1 */
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "lcdvdes 0x%x lcdvdee 0x%x\n", tempcx, tempbx);
@@ -7382,8 +7346,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,tempcx); /* lcdvdes */
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,tempbx); /* lcdvdee */
- temp = ((tempbx & 0xFF00) >> 8) << 3;
- temp |= ((tempcx & 0xFF00) >> 8);
+ temp = (tempbx >> 5) & 0x38;
+ temp |= ((tempcx >> 8) & 0x07);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,temp);
tempax = SiS_Pr->SiS_VDE;
@@ -7405,7 +7369,10 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(tempax % 4) { tempax >>= 2; tempax++; }
else { tempax >>= 2; }
tempbx -= (tempax - 1);
- } else tempbx -= 10;
+ } else {
+ tempbx -= 10;
+ if(tempbx <= SiS_Pr->SiS_VDE) tempbx = SiS_Pr->SiS_VDE + 1;
+ }
}
}
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
@@ -7430,9 +7397,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,tempbx); /* lcdvrs */
- temp = ((tempbx & 0xFF00) >> 8) << 4;
+ temp = (tempbx >> 4) & 0xF0;
tempbx += (tempcx + 1);
- temp |= (tempbx & 0x000F);
+ temp |= (tempbx & 0x0F);
if(SiS_Pr->UseCustomMode) {
temp &= 0xf0;
@@ -7462,9 +7429,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
}
}
temp += bridgeoffset;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1F,temp); /* lcdhdes[7:0] */
- temp = (temp >> 4) & 0xf0;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x20,0x0F,temp); /* lcdhdes [11:8] */
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1F,temp); /* lcdhdes */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x20,0x0F,((temp >> 4) & 0xf0));
tempcx = SiS_Pr->SiS_HT;
tempax = tempbx = SiS_Pr->SiS_HDE;
@@ -7487,8 +7453,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
tempbx += bridgeoffset;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,tempbx); /* lcdhdee */
- temp = (tempbx >> 8) & 0x0f;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0xF0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0xF0,((tempbx >> 8) & 0x0f));
tempcx = (tempcx - tempax) >> 2;
@@ -7514,8 +7479,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
#endif
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1C,tempbx); /* lcdhrs */
- temp = (tempbx & 0x0F00) >> 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,((tempbx >> 4) & 0xf0));
tempbx = push2;
@@ -7555,24 +7519,14 @@ static void
SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo)
{
- USHORT modeflag, i;
- const UCHAR *tempdi;
+ USHORT i;
+ const UCHAR *tempdi;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) return;
- 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;
- }
-
#ifndef SIS_CP
SiS_SetReg(SiS_Pr->SiS_Part3Port,0x00,0x00);
-#endif
-
-#ifdef SIS_CP
+#else
SIS_CP_INIT301_CP
#endif
@@ -7595,11 +7549,6 @@ SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempdi = SiS_Pr->SiS_HiTVGroup3Data;
if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
tempdi = SiS_Pr->SiS_HiTVGroup3Simu;
-#if 0
- if(!(modeflag & Charx8Dot)) {
- tempdi = SiS_Pr->SiS_HiTVGroup3Text;
- }
-#endif
}
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
if(!(SiS_Pr->SiS_TVMode & TVSetYPbPr525i)) {
@@ -7654,7 +7603,8 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
{
USHORT temp, temp1, resinfo = 0;
- if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return;
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301C)) return;
+ if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToHiVision | SetCRT2ToYPbPr525750))) return;
if(ModeNo > 0x13) {
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
@@ -7665,7 +7615,7 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
if(!(temp & 0x01)) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x3a,0xdf);
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x25,0xfc);
- if(HwInfo->jChipType < SIS_661) {
+ if((HwInfo->jChipType < SIS_661) && (!(SiS_Pr->SiS_ROMNew))) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x25,0xf8);
}
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x0f,0xfb);
@@ -7673,7 +7623,7 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) temp = 0x0002;
else if(SiS_Pr->SiS_TVMode & TVSetHiVision) temp = 0x0400;
else temp = 0x0402;
- if(HwInfo->jChipType >= SIS_661) {
+ if((HwInfo->jChipType >= SIS_661) || (SiS_Pr->SiS_ROMNew)) {
temp1 = 0;
if(SiS_Pr->SiS_TVMode & TVAspect43) temp1 = 4;
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0f,0xfb,temp1);
@@ -7686,6 +7636,9 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xf8,(temp & 0xff));
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0xfb,(temp >> 8));
+ if(ModeNo > 0x13) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x3b,0xfd);
+ }
if(HwInfo->jChipType >= SIS_661) { /* ? */
if(SiS_Pr->SiS_TVMode & TVAspect43) {
@@ -7745,7 +7698,7 @@ static void
SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo)
{
- USHORT tempax,tempcx,tempbx,modeflag,temp,temp2,resinfo;
+ USHORT tempax,tempcx,tempbx,modeflag,temp,resinfo;
ULONG tempebx,tempeax,templong;
if(ModeNo <= 0x13) {
@@ -7778,180 +7731,154 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
if(SiS_IsDualLink(SiS_Pr, HwInfo)) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x27,~0x20);
}
-#ifdef SET_EMI
+
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
-#endif
}
return;
}
}
- temp = SiS_Pr->SiS_RVBHCFACT;
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x13,temp);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x13,SiS_Pr->SiS_RVBHCFACT);
tempbx = SiS_Pr->SiS_RVBHCMAX;
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x14,tempbx);
- temp2 = (tempbx >> 1) & 0x0080;
+ temp = (tempbx >> 1) & 0x80;
tempcx = SiS_Pr->SiS_VGAHT - 1;
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x16,tempcx);
- temp2 |= (((tempcx & 0xFF00) >> 8) << 3) & 0x00ff;
+ temp |= ((tempcx >> 5) & 0x78);
tempcx = SiS_Pr->SiS_VGAVT - 1;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempcx -= 5;
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x17,tempcx);
- temp = temp2 | (tempcx >> 8);
+ temp |= ((tempcx >> 8) & 0x07);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x15,temp);
tempbx = SiS_Pr->SiS_VGAHDE;
- if(modeflag & HalfDCLK) tempbx >>= 1;
- if(HwInfo->jChipType >= SIS_661) {
- if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1;
- }
-
- temp = 0xA0;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ if(modeflag & HalfDCLK) tempbx >>= 1;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1;
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
temp = 0;
- if(tempbx > 800) {
- temp = 0xA0;
- if(tempbx != 1024) {
- temp = 0xC0;
- if(tempbx != 1280) temp = 0;
- }
- }
- } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(tempbx <= 800) {
- temp = 0x80;
- }
+ if(tempbx > 800) temp = 0x60;
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ temp = 0;
+ if(tempbx == 1024) temp = 0xA0;
+ else if(tempbx > 1024) temp = 0xC0;
+ } else if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) {
+ temp = 0;
+ if(tempbx >= 1280) temp = 0x40;
+ else if(tempbx >= 1024) temp = 0x20;
} else {
temp = 0x80;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- temp = 0;
- if(tempbx > 800) temp = 0x60;
- }
- }
-
- if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) {
- temp = 0;
- if(SiS_Pr->SiS_VGAHDE == 1024) temp = 0x20;
- }
-
- if(HwInfo->jChipType < SIS_661) {
- if(SiS_IsDualLink(SiS_Pr, HwInfo)) temp = 0;
+ if(tempbx >= 1024) temp = 0xA0;
}
if(SiS_Pr->SiS_VBType & VB_SIS301) {
- if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024)
- temp |= 0x0A;
+ if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) temp |= 0x0A;
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0E,0x10,temp);
-
+
+ tempeax = SiS_Pr->SiS_VGAVDE;
tempebx = SiS_Pr->SiS_VDE;
-
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
if(!(temp & 0xE0)) tempebx >>=1;
- }
-
+ }
+
tempcx = SiS_Pr->SiS_RVBHRS;
- temp = tempcx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x18,temp);
-
- tempeax = SiS_Pr->SiS_VGAVDE;
- tempcx |= 0x4000;
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x18,tempcx);
+ tempcx >>= 8;
+ tempcx |= 0x40;
+
if(tempeax <= tempebx) {
- tempcx ^= 0x4000;
+ tempcx ^= 0x40;
} else {
tempeax -= tempebx;
}
- templong = (tempeax * 256 * 1024) % tempebx;
- tempeax = (tempeax * 256 * 1024) / tempebx;
- tempebx = tempeax;
- if(templong != 0) tempebx++;
+ tempeax *= (256 * 1024);
+ templong = tempeax % tempebx;
+ tempeax /= tempebx;
+ if(templong) tempeax++;
- temp = (USHORT)(tempebx & 0x000000FF);
+ temp = (USHORT)(tempeax & 0x000000FF);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1B,temp);
- temp = (USHORT)((tempebx & 0x0000FF00) >> 8);
+ temp = (USHORT)((tempeax & 0x0000FF00) >> 8);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1A,temp);
-
- tempbx = (USHORT)(tempebx >> 16);
- temp = tempbx & 0x00FF;
- temp <<= 4;
- temp |= ((tempcx & 0xFF00) >> 8);
+ temp = (USHORT)((tempeax >> 12) & 0x70); /* sic! */
+ temp |= (tempcx & 0x4F);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x19,temp);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1C,0x28);
+ /* Calc Linebuffer max address and set/clear decimode */
tempbx = 0;
+ if(SiS_Pr->SiS_TVMode & (TVSetHiVision | TVSetYPbPr750p)) tempbx = 0x08;
tempax = SiS_Pr->SiS_VGAHDE;
- if(modeflag & HalfDCLK) tempax >>= 1;
+ if(modeflag & HalfDCLK) tempax >>= 1;
if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempax >>= 1;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- if(tempax > 800) tempax -= 800;
- } else /* if(SiS_Pr->SiS_VBInfo & TvNoHiviNoYPbPr) */ { /* 651+301C */
- if(tempax > 800) {
- tempbx = 8;
+ if(tempax > 800) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ tempax -= 800;
+ } else { /* 651+301C: Only if TVNoHiviNoYPbPr */
+ tempbx = 0x08;
if(tempax == 1024) tempax *= 25;
else tempax *= 20;
temp = tempax % 32;
tempax /= 32;
- tempax--;
- if (temp!=0) tempax++;
- }
- }
+ if(temp) tempax++;
+ tempax++;
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) ||
+ (SiS_Pr->SiS_TVMode & TVSetYPbPr525i)) {
+ if(resinfo == SIS_RI_1024x768) {
+ /* Otherwise white line at right edge */
+ tempax = (tempax & 0xff00) | 0x20;
+ }
+ }
+ }
+ }
tempax--;
- temp = ((tempax & 0xFF00) >> 8) & 0x03;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) { /* From 1.10.7w */
- if(ModeNo > 0x13) { /* From 1.10.7w */
- if(resinfo == SIS_RI_1024x768) tempax = 0x1f; /* From 1.10.7w */
- /* ax normally 0x1e */ /* From 1.10.7w */
- } /* From 1.10.7w */
- } /* From 1.10.7w */
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1D,tempax & 0x00FF);
- temp <<= 4;
- temp |= tempbx;
+ temp = ((tempax >> 4) & 0x30) | tempbx;
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1D,tempax);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1E,temp);
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- if(IS_SIS550650740660) {
- temp = 0x0026; /* 1.10.7w; 1.10.8r; needs corresponding code in Dis/EnableBridge! */
- } else {
- temp = 0x0036;
- }
- } else {
- temp = 0x0036;
+ temp = 0x0036; tempbx = 0xD0;
+ if((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
+ temp = 0x0026; tempbx = 0xC0; /* See En/DisableBridge() */
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(!(SiS_Pr->SiS_TVMode & (TVSetNTSC1024 | TVSetHiVision | TVSetYPbPr750p | TVSetYPbPr525p))) {
temp |= 0x01;
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) {
- temp &= 0xFE;
+ temp &= ~0x01;
}
}
}
}
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,tempbx,temp);
- tempbx = SiS_Pr->SiS_HT;
+ tempbx = SiS_Pr->SiS_HT >> 1;
if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1;
- tempbx >>= 1;
tempbx -= 2;
- temp = ((tempbx & 0x0700) >> 8) << 3;
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x22,tempbx);
+ temp = (tempbx >> 5) & 0x38;
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,0xC0,temp);
- temp = tempbx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x22,temp);
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
@@ -7961,15 +7888,17 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(HwInfo->jChipType >= SIS_315H) {
if(SiS_IsDualLink(SiS_Pr, HwInfo)) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x27,~0x20);
}
}
-#ifdef SET_EMI
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
-#endif
}
} /* 301B */
@@ -8175,7 +8104,10 @@ static void
SiS_SetCHTVReg(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex)
{
- USHORT temp, tempbx, tempcl;
+#if defined(SIS300) || defined(SIS315H)
+ USHORT temp, tempbx;
+#endif
+ USHORT tempcl;
USHORT TVType, resindex;
const SiS_CHTVRegDataStruct *CHTVRegData = NULL;
@@ -9046,16 +8978,9 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
(SiS_Pr->SiS_CustomT == CUT_BARCO1024)) {
SetOEMLCDData2(SiS_Pr, HwInfo, ModeNo, ModeIdIndex,RefreshRateTableIndex);
}
- if(HwInfo->jChipType == SIS_730) {
- SiS_DisplayOn(SiS_Pr);
- }
+ SiS_DisplayOn(SiS_Pr);
}
}
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- if(HwInfo->jChipType != SIS_730) {
- SiS_DisplayOn(SiS_Pr);
- }
- }
}
#endif
@@ -9064,7 +8989,7 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_SetFlag & LowModeTests) {
if(HwInfo->jChipType < SIS_661) {
SiS_FinalizeLCD(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
- SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
+ SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex);
} else {
SiS_OEM661Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex);
}
@@ -9769,9 +9694,10 @@ USHORT
SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
{
USHORT DDCdatatype, paneltype, flag, xres=0, yres=0;
- USHORT index, myindex, lumsize, numcodes;
+ USHORT index, myindex, lumsize, numcodes, panelvendor, panelproduct;
unsigned char cr37=0, seekcode;
BOOLEAN checkexpand = FALSE;
+ BOOLEAN havesync = FALSE;
int retry, i;
unsigned char buffer[256];
@@ -9780,6 +9706,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
SiS_Pr->CP_MaxX = SiS_Pr->CP_MaxY = SiS_Pr->CP_MaxClock = 0;
SiS_Pr->CP_PreferredX = SiS_Pr->CP_PreferredY = 0;
SiS_Pr->CP_PreferredIndex = -1;
+ SiS_Pr->CP_PrefClock = 0;
+ SiS_Pr->PanelSelfDetected = FALSE;
if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0;
if(pSiS->VBFlags & VB_30xBDH) return 0;
@@ -9835,20 +9763,20 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
/* Catch a few clear cases: */
if(!(checkedid1(buffer))) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: EDID corrupt\n");
+ "LCD sense: EDID corrupt\n");
return 0;
}
if(!(buffer[0x14] & 0x80)) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Attached display expects analog input (0x%02x)\n",
+ "LCD sense: Attached display expects analog input (0x%02x)\n",
buffer[0x14]);
return 0;
}
if((buffer[0x18] & 0x18) != 0x08) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Attached display is not of RGB but of %s type (0x%02x)\n",
+ "LCD sense: Attached display is not of RGB but of %s type (0x%02x)\n",
((buffer[0x18] & 0x18) == 0x00) ? "monochrome/greyscale" :
( ((buffer[0x18] & 0x18) == 0x10) ? "non-RGB multicolor" :
"undefined"),
@@ -9864,15 +9792,19 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
paneltype = Panel_Custom;
checkexpand = FALSE;
+
+ panelvendor = buffer[9] | (buffer[8] << 8);
+ panelproduct = buffer[10] | (buffer[11] << 8);
if(buffer[0x18] & 0x02) {
+
+ USHORT pclk = (buffer[0x36] | (buffer[0x37] << 8));
+ USHORT phb = (buffer[0x39] | ((buffer[0x3a] & 0x0f) << 8));
+ USHORT pvb = (buffer[0x3c] | ((buffer[0x3d] & 0x0f) << 8));
- xres = buffer[0x38] | ((buffer[0x3a] & 0xf0) << 4);
- yres = buffer[0x3b] | ((buffer[0x3d] & 0xf0) << 4);
-
- SiS_Pr->CP_PreferredX = xres;
- SiS_Pr->CP_PreferredY = yres;
-
+ SiS_Pr->CP_PreferredX = xres = buffer[0x38] | ((buffer[0x3a] & 0xf0) << 4);
+ SiS_Pr->CP_PreferredY = yres = buffer[0x3b] | ((buffer[0x3d] & 0xf0) << 4);
+
switch(xres) {
#if 0 /* Treat as custom */
case 800:
@@ -9889,7 +9821,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
break;
case 1280:
- if(yres == 1024) {
+ if(yres == 1024) {
paneltype = Panel_1280x1024;
checkexpand = TRUE;
} else if(yres == 960) {
@@ -9899,14 +9831,20 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
paneltype = Panel310_1280x960;
}
} else if(yres == 768) {
- if( ((buffer[0x36] | (buffer[0x37] << 8)) == 8100) &&
- ((buffer[0x39] | ((buffer[0x3a] & 0x0f) << 8)) == (1688 - 1280)) &&
- ((buffer[0x3c] | ((buffer[0x3d] & 0x0f) << 8)) == (802 - 768)) ) {
+ if( (pclk == 8100) &&
+ (phb == (1688 - 1280)) &&
+ (pvb == (802 - 768)) ) {
paneltype = Panel_1280x768;
checkexpand = FALSE;
cr37 |= 0x10;
}
- }
+ } else if(yres == 800) {
+ if( (pclk == 6900) &&
+ (phb == (1408 - 1280)) &&
+ (pvb == (816 - 800)) ) {
+ paneltype = Panel_1280x800;
+ }
+ }
break;
case 1400:
if(pSiS->VGAEngine == SIS_315_VGA) {
@@ -9916,7 +9854,6 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
break;
-#if 0 /* Treat this as custom, as we have no valid timing data yet */
case 1600:
if(pSiS->VGAEngine == SIS_315_VGA) {
if(pSiS->VBFlags & VB_301C) {
@@ -9927,41 +9864,62 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
break;
-#endif
}
- if(paneltype != Panel_Custom) {
- if((buffer[0x47] & 0x18) == 0x18) {
- cr37 |= ((((buffer[0x47] & 0x06) ^ 0x06) << 5) | 0x20);
- } else {
- /* What now? There is no digital separate output timing... */
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
- "CRT2: Unable to retrieve Sync polarity information\n");
- cr37 |= 0xc0; /* Default */
- }
+ /* Save sync: This is used if "Pass 1:1" is off; in this case
+ * we always use the panel's native mode = this "preferred mode"
+ * we just have been analysing. Hence, we also need its sync.
+ */
+ if((buffer[0x47] & 0x18) == 0x18) {
+ cr37 |= ((((buffer[0x47] & 0x06) ^ 0x06) << 5) | 0x20);
+ havesync = TRUE;
+ } else {
+ /* What now? There is no digital separate output timing... */
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
+ "LCD sense: Unable to retrieve Sync polarity information\n");
+ cr37 |= 0xc0; /* Default */
}
}
+
+ /* Check against our database; Eg. Sanyo projector reports
+ * 1024x768 as preferred mode, although it supports 1280x720
+ * natively in non-HTCP mode. Treat such wrongly reporting
+ * panels as custom and fixup actual maximum resolutions.
+ */
+ if(paneltype != Panel_Custom) {
+ int maxx, maxy;
+ if((SiS_FindPanelFromDB(pSiS, panelvendor, panelproduct, &maxx, &maxy))) {
+ paneltype = Panel_Custom;
+ SiS_Pr->CP_MaxX = maxx;
+ SiS_Pr->CP_MaxY = maxy;
+ /* Leave preferred unchanged (MUST contain a valid mode!) */
+ }
+ }
/* If we still don't know what panel this is, we take it
* as a custom panel and derive the timing data from the
* detailed timing blocks
*/
if(paneltype == Panel_Custom) {
-
- BOOLEAN havesync = FALSE;
+
int i, temp, base = 0x36;
unsigned long estpack;
- unsigned short estx[] = {
+ const unsigned short estx[] = {
720, 720, 640, 640, 640, 640, 800, 800,
800, 800, 832,1024,1024,1024,1024,1280,
1152
};
- unsigned short esty[] = {
+ const unsigned short esty[] = {
400, 400, 480, 480, 480, 480, 600, 600,
600, 600, 624, 768, 768, 768, 768,1024,
870
};
+ const int estclk[] = {
+ 0, 0, 25100, 0, 31500, 31500, 36100, 40000,
+ 50100, 49500, 0, 0, 65100, 75200, 78700,135200,
+ 0
+ };
paneltype = 0;
SiS_Pr->CP_Supports64048075 = TRUE;
@@ -9974,8 +9932,14 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(estpack & (1 << i)) {
if(estx[16 - i] > SiS_Pr->CP_MaxX) SiS_Pr->CP_MaxX = estx[16 - i];
if(esty[16 - i] > SiS_Pr->CP_MaxY) SiS_Pr->CP_MaxY = esty[16 - i];
+ if(estclk[16 - i] > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = estclk[16 - i];
}
}
+
+ /* By default we drive the LCD at 75Hz in 640x480 mode; if
+ * the panel does not provide this mode, use 60hz
+ */
+ if(!(buffer[0x23] & 0x04)) SiS_Pr->CP_Supports64048075 = FALSE;
/* 2. From Standard Timings */
for(i=0x26; i < 0x36; i+=2) {
@@ -10020,29 +9984,28 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
SiS_Pr->CP_DataValid[i] = TRUE;
/* Sort out invalid timings, interlace and too high clocks */
- if((SiS_Pr->CP_HDisplay[i] & 7) ||
- (SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) ||
- (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HSyncEnd[i]) ||
- (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HTotal[i]) ||
- (SiS_Pr->CP_HSyncStart[i] >= SiS_Pr->CP_HSyncEnd[i]) ||
- (SiS_Pr->CP_HSyncStart[i] > SiS_Pr->CP_HTotal[i]) ||
- (SiS_Pr->CP_HSyncEnd[i] > SiS_Pr->CP_HTotal[i]) ||
- (SiS_Pr->CP_VDisplay[i] > SiS_Pr->CP_VSyncStart[i]) ||
- (SiS_Pr->CP_VDisplay[i] >= SiS_Pr->CP_VSyncEnd[i]) ||
- (SiS_Pr->CP_VDisplay[i] >= SiS_Pr->CP_VTotal[i]) ||
- (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VSyncEnd[i]) ||
- (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) ||
- (SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) ||
+ if((SiS_Pr->CP_HDisplay[i] & 7) ||
+ (SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) ||
+ (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HSyncEnd[i]) ||
+ (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HTotal[i]) ||
+ (SiS_Pr->CP_HSyncStart[i] >= SiS_Pr->CP_HSyncEnd[i]) ||
+ (SiS_Pr->CP_HSyncStart[i] > SiS_Pr->CP_HTotal[i]) ||
+ (SiS_Pr->CP_HSyncEnd[i] > SiS_Pr->CP_HTotal[i]) ||
+ (SiS_Pr->CP_VDisplay[i] > SiS_Pr->CP_VSyncStart[i]) ||
+ (SiS_Pr->CP_VDisplay[i] >= SiS_Pr->CP_VSyncEnd[i]) ||
+ (SiS_Pr->CP_VDisplay[i] >= SiS_Pr->CP_VTotal[i]) ||
+ (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VSyncEnd[i]) ||
+ (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) ||
+ (SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) ||
(((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162500)) ||
- ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108200))) ||
+ ((!(pSiS->VBFlags & VB_301C)) &&
+ ((SiS_Pr->CP_Clock[i] > 108200) || (SiS_Pr->CP_VDisplay[i] > 1024)))) ||
(buffer[base+17] & 0x80)) {
SiS_Pr->CP_DataValid[i] = FALSE;
} else {
- paneltype = Panel_Custom;
-
SiS_Pr->CP_HaveCustomData = TRUE;
if(xres > SiS_Pr->CP_MaxX) SiS_Pr->CP_MaxX = xres;
@@ -10051,22 +10014,10 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if((SiS_Pr->CP_PreferredX == xres) && (SiS_Pr->CP_PreferredY == yres)) {
SiS_Pr->CP_PreferredIndex = i;
+ SiS_MakeClockRegs(pSiS->pScrn, SiS_Pr->CP_Clock[i], &SiS_Pr->CP_PrefSR2B, &SiS_Pr->CP_PrefSR2C);
+ SiS_Pr->CP_PrefClock = (SiS_Pr->CP_Clock[i] / 1000) + 1;
}
- SiS_Pr->CP_Vendor = buffer[9] | (buffer[8] << 8);
- SiS_Pr->CP_Product = buffer[10] | (buffer[11] << 8);
-
- /* By default we drive the LCD at 75Hz in 640x480 mode; if
- * the panel does not provide this mode, use 60hz
- */
- if(!(buffer[0x23] & 0x04)) SiS_Pr->CP_Supports64048075 = FALSE;
-
- /* We must assume the panel can scale, since we have
- * no scaling data
- */
- checkexpand = FALSE;
- cr37 |= 0x10;
-
/* Extract the sync polarisation information. This only works
* if the Flags indicate a digital separate output.
*/
@@ -10074,20 +10025,37 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
SiS_Pr->CP_HSync_P[i] = (buffer[base+17] & 0x02) ? TRUE : FALSE;
SiS_Pr->CP_VSync_P[i] = (buffer[base+17] & 0x04) ? TRUE : FALSE;
SiS_Pr->CP_SyncValid[i] = TRUE;
- if(!havesync) {
+ if((i == SiS_Pr->CP_PreferredIndex) && (!havesync)) {
cr37 |= ((((buffer[base+17] & 0x06) ^ 0x06) << 5) | 0x20);
havesync = TRUE;
}
} else {
SiS_Pr->CP_SyncValid[i] = FALSE;
}
+
}
- }
+
+ } else if((!buffer[base]) && (!buffer[base+1]) && (!buffer[base+2]) && (!buffer[base+4])) {
+
+ /* Maximum pixclock from Monitor Range Limits */
+ if((buffer[base+3] == 0xfd) && (buffer[base+9] != 0xff)) {
+ int maxclk = buffer[base+9] * 10;
+ /* More than 170 is not supported anyway */
+ if(maxclk <= 170) SiS_Pr->CP_MaxClock = maxclk * 1000;
+ }
+
+ }
+
}
- if(!havesync) {
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
- "CRT2: Unable to retrieve Sync polarity information\n");
- }
+
+ if(SiS_Pr->CP_MaxX && SiS_Pr->CP_MaxY) {
+ paneltype = Panel_Custom;
+ checkexpand = FALSE;
+ cr37 |= 0x10;
+ SiS_Pr->CP_Vendor = panelvendor;
+ SiS_Pr->CP_Product = panelproduct;
+ }
+
}
if(paneltype && checkexpand) {
@@ -10110,28 +10078,32 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(!(checkedid2(buffer))) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: EDID corrupt\n");
+ "LCD sense: EDID corrupt\n");
return 0;
}
if((buffer[0x41] & 0x0f) == 0x03) {
index = 0x42 + 3;
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Display supports TMDS input on primary interface\n");
+ "LCD sense: Display supports TMDS input on primary interface\n");
} else if((buffer[0x41] & 0xf0) == 0x30) {
index = 0x46 + 3;
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Display supports TMDS input on secondary interface\n");
+ "LCD sense: Display supports TMDS input on secondary interface\n");
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Display does not support TMDS video interface (0x%02x)\n",
+ "LCD sense: Display does not support TMDS video interface (0x%02x)\n",
buffer[0x41]);
return 0;
}
-
+
+ SiS_Pr->CP_Vendor = panelvendor = buffer[2] | (buffer[1] << 8);
+ SiS_Pr->CP_Product = panelproduct = buffer[3] | (buffer[4] << 8);
+
paneltype = Panel_Custom;
- SiS_Pr->CP_MaxX = xres = buffer[0x76] | (buffer[0x77] << 8);
- SiS_Pr->CP_MaxY = yres = buffer[0x78] | (buffer[0x79] << 8);
+ SiS_Pr->CP_MaxX = SiS_Pr->CP_PreferredX = xres = buffer[0x76] | (buffer[0x77] << 8);
+ SiS_Pr->CP_MaxY = SiS_Pr->CP_PreferredY = yres = buffer[0x78] | (buffer[0x79] << 8);
+
switch(xres) {
#if 0
case 800:
@@ -10168,7 +10140,6 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
break;
-#if 0 /* Treat this one as custom since we have no timing data yet */
case 1600:
if(pSiS->VGAEngine == SIS_315_VGA) {
if(pSiS->VBFlags & VB_301C) {
@@ -10179,7 +10150,6 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
break;
-#endif
}
/* Determine if RGB18 or RGB24 */
@@ -10202,7 +10172,25 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
lumsize++; /* luminance header byte */
index += lumsize;
}
+#if 0 /* "pixel rate" = pixel clock? */
+ if(buffer[0x7e] & 0x1c) {
+ for(i=0; i<((buffer[0x7e] & 0x1c) >> 2); i++) {
+ if(buffer[index + (i*8) + 6] && (buffer[index + (i*8) + 7] & 0x0f)) {
+ int clk = (buffer[index + (i*8) + 6] | ((buffer[index + (i*8) + 7] & 0x0f) << 4)) * 1000;
+ if(clk > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = clk;
+ }
+ }
+ }
+#endif
index += (((buffer[0x7e] & 0x1c) >> 2) * 8); /* skip Frequency Ranges */
+ if(buffer[0x7e] & 0x03) {
+ for(i=0; i<(buffer[0x7e] & 0x03); i++) {
+ if((buffer[index + (i*27) + 9]) || (buffer[index + (i*27) + 10])) {
+ int clk = ((buffer[index + (i*27) + 9]) | ((buffer[index + (i*27) + 9]) << 8)) * 10;
+ if(clk > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = clk;
+ }
+ }
+ }
index += ((buffer[0x7e] & 0x03) * 27); /* skip Detailed Range Limits */
numcodes = (buffer[0x7f] & 0xf8) >> 3;
if(numcodes) {
@@ -10214,13 +10202,29 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
if(buffer[myindex] == seekcode) {
cr37 |= ((((buffer[myindex + 1] & 0x0c) ^ 0x0c) << 4) | 0x20);
+ havesync = TRUE;
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
- "CRT2: Unable to retrieve Sync polarity information\n");
+ "LCD sense: Unable to retrieve Sync polarity information\n");
}
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
- "CRT2: Unable to retrieve Sync polarity information\n");
+ "LCD sense: Unable to retrieve Sync polarity information\n");
+ }
+
+ /* Check against our database; Eg. Sanyo projector reports
+ * 1024x768 in non-HDPC mode, although it supports 1280x720.
+ * Treat such wrongly reporting panels as custom.
+ */
+ if(paneltype != Panel_Custom) {
+ int maxx, maxy;
+ if((SiS_FindPanelFromDB(pSiS, panelvendor, panelproduct, &maxx, &maxy))) {
+ paneltype = Panel_Custom;
+ SiS_Pr->CP_MaxX = maxx;
+ SiS_Pr->CP_MaxY = maxy;
+ cr37 |= 0x10;
+ /* Leave preferred unchanged (MUST be a valid mode!) */
+ }
}
/* Now seek the detailed timing descriptions for custom panels */
@@ -10266,7 +10270,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
(SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) ||
(SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) ||
(((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162500)) ||
- ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108200))) ||
+ ((!(pSiS->VBFlags & VB_301C)) &&
+ ((SiS_Pr->CP_Clock[i] > 108200) || (SiS_Pr->CP_VDisplay[i] > 1024)))) ||
(buffer[index + 17] & 0x80)) {
SiS_Pr->CP_DataValid[i] = FALSE;
@@ -10277,25 +10282,25 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(SiS_Pr->CP_Clock[i] > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = SiS_Pr->CP_Clock[i];
- if((SiS_Pr->CP_MaxX == xres) && (SiS_Pr->CP_MaxY == yres)) {
+ if((SiS_Pr->CP_PreferredX == xres) && (SiS_Pr->CP_PreferredY == yres)) {
SiS_Pr->CP_PreferredIndex = i;
+ SiS_MakeClockRegs(pSiS->pScrn, SiS_Pr->CP_Clock[i], &SiS_Pr->CP_PrefSR2B, &SiS_Pr->CP_PrefSR2C);
+ SiS_Pr->CP_PrefClock = (SiS_Pr->CP_Clock[i] / 1000) + 1;
+ if(!havesync) {
+ cr37 |= ((((buffer[index + 17] & 0x06) ^ 0x06) << 5) | 0x20);
+ havesync = TRUE;
+ }
}
SiS_Pr->CP_HSync_P[i] = (buffer[index + 17] & 0x02) ? TRUE : FALSE;
SiS_Pr->CP_VSync_P[i] = (buffer[index + 17] & 0x04) ? TRUE : FALSE;
SiS_Pr->CP_SyncValid[i] = TRUE;
- SiS_Pr->CP_Vendor = buffer[2] | (buffer[1] << 8);
- SiS_Pr->CP_Product = buffer[3] | (buffer[4] << 8);
-
- /* We must assume the panel can scale, since we have
- * no scaling data
- */
- cr37 |= 0x10;
-
}
}
+ cr37 |= 0x10;
+
}
break;
@@ -10314,7 +10319,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
for(i = 0; i < 7; i++) {
if(SiS_Pr->CP_DataValid[i]) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "Non-standard LCD timing data no. %d:\n", i);
+ "Non-standard LCD/DVI-D timing data no. %d:\n", i);
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
" HDisplay %d HSync %d HSyncEnd %d HTotal %d\n",
SiS_Pr->CP_HDisplay[i], SiS_Pr->CP_HSyncStart[i],
@@ -10336,14 +10341,17 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(!SiS_Pr->CP_PreferredX) SiS_Pr->CP_PreferredX = SiS_Pr->CP_MaxX;
if(!SiS_Pr->CP_PreferredY) SiS_Pr->CP_PreferredY = SiS_Pr->CP_MaxY;
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x08);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x36,0xf0,paneltype);
+ SiS_SetReg(SiS_Pr->SiS_P3d4,0x36,paneltype);
cr37 &= 0xf1;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xf3,cr37);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0x0c,cr37);
SiS_Pr->PanelSelfDetected = TRUE;
#ifdef TWDEBUG
xf86DrvMsgVerb(pSiS->pScrn->scrnIndex, X_PROBED, 3,
- "CRT2: [DDC LCD results: 0x%02x, 0x%02x]\n", paneltype, cr37);
+ "LCD sense: [DDC LCD results: 0x%02x, 0x%02x]\n", paneltype, cr37);
#endif
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x32,~0x08);
+ SiS_SetReg(SiS_Pr->SiS_P3d4,0x36,0x00);
}
return 0;
}
@@ -10375,7 +10383,7 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
DDCdatatype = 1;
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "Do DDC answer\n");
+ "VGA2 sense: Do DDC answer\n");
return 0; /* no DDC support (or no device attached) */
}
@@ -10384,7 +10392,7 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
do {
if(SiS_ReadDDC(SiS_Pr, DDCdatatype, buffer)) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: DDC read failed (attempt %d), %s\n",
+ "VGA2 sense: DDC read failed (attempt %d), %s\n",
(3-retry), (retry == 1) ? "giving up" : "retrying");
retry--;
if(retry == 0) return 0xFFFF;
@@ -10397,13 +10405,13 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
switch(DDCdatatype) {
case 1:
if(!(checkedid1(buffer))) {
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: EDID corrupt\n");
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR,
+ "VGA2 sense: EDID corrupt\n");
return 0;
}
if(buffer[0x14] & 0x80) { /* Display uses digital input */
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Attached display expects digital input\n");
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR,
+ "VGA2 sense: Attached display expects digital input\n");
return 0;
}
SiS_Pr->CP_Vendor = buffer[9] | (buffer[8] << 8);
@@ -10413,16 +10421,16 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
case 3:
case 4:
if(!(checkedid2(buffer))) {
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: EDID corrupt\n");
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR,
+ "VGA2 sense: EDID corrupt\n");
return 0;
}
if( ((buffer[0x41] & 0x0f) != 0x01) && /* Display does not support analog input */
((buffer[0x41] & 0x0f) != 0x02) &&
((buffer[0x41] & 0xf0) != 0x10) &&
((buffer[0x41] & 0xf0) != 0x20) ) {
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Attached display does not support analog input (0x%02x)\n",
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR,
+ "VGA2 sense: Attached display does not support analog input (0x%02x)\n",
buffer[0x41]);
return 0;
}
@@ -10952,6 +10960,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
delay = SiS310_LCDDelayCompensation_301[myindex];
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
if(IS_SIS740) delay = 0x01;
+ else if(HwInfo->jChipType <= SIS_315PRO) delay = SiS310_LCDDelayCompensation_3xx301LV[myindex];
else delay = SiS310_LCDDelayCompensation_650301LV[myindex];
} else if(SiS_Pr->SiS_VBType & VB_SIS301C) {
if(IS_SIS740) delay = 0x01; /* ? */
@@ -11294,35 +11303,18 @@ SetPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
}
}
-void
-SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
- USHORT ModeNo,USHORT ModeIdIndex)
-{
- SetDelayComp(SiS_Pr,HwInfo,ModeNo);
-
- if(SiS_Pr->UseCustomMode) return;
-
- if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
- SetAntiFlicker(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- SetPhaseIncr(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- SetYFilter(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- if(SiS_Pr->SiS_VBType & VB_SIS301) {
- SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- }
- }
-}
-
static void
SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
USHORT ModeIdIndex, USHORT RTI)
{
- USHORT delay = 0, romptr = 0, index;
+ USHORT delay = 0, romptr = 0, index, lcdpdcindex;
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToRAMDAC)))
return;
/* 1. New ROM: VGA2 and LCD/LCDA-Pass1:1 */
+ /* (If a custom mode is used, Pass1:1 is always set; hence we do this:) */
if(SiS_Pr->SiS_ROMNew) {
if((SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) ||
@@ -11337,8 +11329,10 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
}
if(index < 25) index = 25;
index = ((index / 25) - 1) << 1;
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD)) index++;
- romptr = SISGETROMW(0x104); /* 0x4ae */
+ if((ROMAddr[0x5b] & 0x80) || (SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD))) {
+ index++;
+ }
+ romptr = SISGETROMW(0x104);
delay = ROMAddr[romptr + index];
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD)) {
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0xf0,((delay >> 1) & 0x0f));
@@ -11364,10 +11358,12 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
index = GetOEMTVPtr661(SiS_Pr);
if(SiS_Pr->SiS_ROMNew) {
- romptr = SISGETROMW(0x106); /* 0x4ba */
+ romptr = SISGETROMW(0x106);
+ if(SiS_Pr->SiS_VBType & VB_UMC) romptr += 12;
delay = ROMAddr[romptr + index];
} else {
delay = 0x04;
+ if(index > 3) delay = 0;
}
} else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
@@ -11377,33 +11373,54 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
if( (SiS_Pr->SiS_LCDResInfo != Panel_Custom) &&
((romptr = GetLCDStructPtr661_2(SiS_Pr, HwInfo))) ) {
- /* For LV, the BIOS must know about the correct value */
- delay = ROMAddr[romptr + 0x0d]; /* LCD */
- delay |= (ROMAddr[romptr + 0x0c] << 8); /* LCDA */
+ lcdpdcindex = (SiS_Pr->SiS_VBType & VB_UMC) ? 14 : 12;
+
+ /* For LVDS (and sometimes TMDS), the BIOS must know about the correct value */
+ delay = ROMAddr[romptr + lcdpdcindex + 1]; /* LCD */
+ delay |= (ROMAddr[romptr + lcdpdcindex] << 8); /* LCDA */
} else {
- /* TMDS: Set our own, since BIOS has no idea - TODO: Find out about values */
+ /* TMDS: Set our own, since BIOS has no idea */
+ /* (This is done on >=661 only, since <661 is calling this only for LVDS) */
if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
- if((SiS_Pr->PanelXRes <= 1024) && (SiS_Pr->PanelYRes <= 768)) {
- delay = 0x0404;
- } else if((SiS_Pr->PanelXRes <= 1280) && (SiS_Pr->PanelYRes <= 1024)) {
- delay = 0x0404;
- } else if((SiS_Pr->PanelXRes <= 1400) && (SiS_Pr->PanelYRes <= 1050)) {
- delay = 0x1004;
- } else
- delay = 0x0000;
+ switch(SiS_Pr->SiS_LCDResInfo) {
+ case Panel_1024x768: delay = 0x0008; break;
+ case Panel_1280x720: delay = 0x0004; break;
+ case Panel_1280x768:
+ case Panel_1280x768_2:delay = 0x0004; break;
+ case Panel_1280x800:
+ case Panel_1280x800_2:delay = 0x0004; break; /* Verified for 1280x800 */
+ case Panel_1280x1024: delay = 0x1e04; break;
+ case Panel_1400x1050: delay = 0x0004; break;
+ case Panel_1600x1200: delay = 0x0400; break;
+ case Panel_1680x1050: delay = 0x0e04; break;
+ default:
+ if((SiS_Pr->PanelXRes <= 1024) && (SiS_Pr->PanelYRes <= 768)) {
+ delay = 0x0008;
+ } else if((SiS_Pr->PanelXRes == 1280) && (SiS_Pr->PanelYRes == 1024)) {
+ delay = 0x1e04;
+ } else if((SiS_Pr->PanelXRes <= 1400) && (SiS_Pr->PanelYRes <= 1050)) {
+ delay = 0x0004;
+ } else if((SiS_Pr->PanelXRes <= 1600) && (SiS_Pr->PanelYRes <= 1200)) {
+ delay = 0x0400;
+ } else
+ delay = 0x0e04;
+ break;
+ }
+ }
+
+ /* Override by detected or user-set values */
+ /* (but only if, for some reason, we can't read value from BIOS) */
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (SiS_Pr->PDC != -1)) {
+ delay = SiS_Pr->PDC & 0x1f;
+ }
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) && (SiS_Pr->PDCA != -1)) {
+ delay = (SiS_Pr->PDCA & 0x1f) << 8;
}
}
-
- /* Override by detected or user-set values */
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (SiS_Pr->PDC != -1)) {
- delay = SiS_Pr->PDC & 0x1f;
- }
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) && (SiS_Pr->PDCA != -1)) {
- delay = (SiS_Pr->PDCA & 0x1f) << 8;
- }
+
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
@@ -11431,31 +11448,30 @@ SetCRT2SyncDither661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, US
} else {
infoflag = SiS_Pr->SiS_RefIndex[RTI].Ext_InfoFlag;
}
- infoflag &= 0xc0;
-
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
- if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
- temp &= 0x3f;
- temp |= infoflag;
- } else {
- if(temp & 0x20) infoflag = temp;
+
+ if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ infoflag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); /* No longer check D5 */
}
- if(temp & 0x01) infoflag |= 0x01;
+
+ infoflag &= 0xc0;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- temp = 0x0c;
- if(infoflag & 0x01) temp ^= 0x14; /* BIOS: 18, wrong */
- temp |= (infoflag >> 6);
+ temp = (infoflag >> 6) | 0x0c;
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ temp ^= 0x04;
+ if(SiS_Pr->SiS_ModeType >= Mode24Bpp) temp |= 0x10;
+ }
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xe0,temp);
} else {
- temp = 0;
- if(infoflag & 0x01) temp |= 0x80;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1a,0x7f,temp);
temp = 0x30;
- if(infoflag & 0x01) temp = 0x20;
- infoflag &= 0xc0;
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) temp = 0x20;
temp |= infoflag;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0f,temp);
+ temp = 0;
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ if(SiS_Pr->SiS_ModeType >= Mode24Bpp) temp |= 0x80;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1a,0x7f,temp);
}
}
@@ -11485,14 +11501,40 @@ SetPanelParms661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,temp2,temp1);
}
- temp1 = (ROMAddr[romptr + 1] & 0x80) >> 1;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0d,0xbf,temp1);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ temp1 = (ROMAddr[romptr + 1] & 0x80) >> 1;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0d,0xbf,temp1);
+ }
}
}
}
void
+SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
+ USHORT ModeNo,USHORT ModeIdIndex,USHORT RRTI)
+{
+ if((SiS_Pr->SiS_ROMNew) && (SiS_Pr->SiS_VBType & VB_SISLVDS)) {
+ SetDelayComp661(SiS_Pr,HwInfo,ModeNo,ModeIdIndex,RRTI);
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ SetCRT2SyncDither661(SiS_Pr,HwInfo,ModeNo,RRTI);
+ SetPanelParms661(SiS_Pr,HwInfo);
+ }
+ } else {
+ SetDelayComp(SiS_Pr,HwInfo,ModeNo);
+ }
+
+ if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
+ SetAntiFlicker(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ SetPhaseIncr(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ SetYFilter(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ if(SiS_Pr->SiS_VBType & VB_SIS301) {
+ SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ }
+ }
+}
+
+void
SiS_OEM661Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI)
{
@@ -11531,6 +11573,7 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT resinfo,modeflag;
if(!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) return;
+ if(SiS_Pr->SiS_ROMNew) return;
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
if(SiS_Pr->LVDSHL != -1) {
@@ -11600,13 +11643,13 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
-#ifdef SET_EMI
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
-#endif
} else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) {
if(SiS_Pr->LVDSHL == -1) {
/* Maybe ACER only? */