aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/xgifb/vb_setmode.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/xgifb/vb_setmode.c')
-rw-r--r--drivers/staging/xgifb/vb_setmode.c601
1 files changed, 170 insertions, 431 deletions
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index e81149fc66e..e95a1655a6c 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -23,20 +23,18 @@ static const unsigned short XGINew_VGA_DAC[] = {
void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
{
- pVBInfo->StandTable = (struct SiS_StandTable_S *) &XGI330_StandTable;
- pVBInfo->EModeIDTable = (struct XGI_ExtStruct *) XGI330_EModeIDTable;
- pVBInfo->RefIndex = (struct XGI_Ext2Struct *) XGI330_RefIndex;
- pVBInfo->XGINEWUB_CRT1Table
- = (struct XGI_CRT1TableStruct *) XGI_CRT1Table;
-
- pVBInfo->MCLKData = (struct SiS_MCLKData *) XGI340New_MCLKData;
- pVBInfo->ECLKData = (struct XGI_ECLKDataStruct *) XGI340_ECLKData;
- pVBInfo->VCLKData = (struct SiS_VCLKData *) XGI_VCLKData;
- pVBInfo->VBVCLKData = (struct SiS_VBVCLKData *) XGI_VBVCLKData;
+ pVBInfo->StandTable = &XGI330_StandTable;
+ pVBInfo->EModeIDTable = XGI330_EModeIDTable;
+ pVBInfo->RefIndex = XGI330_RefIndex;
+ pVBInfo->XGINEWUB_CRT1Table = XGI_CRT1Table;
+
+ pVBInfo->MCLKData = XGI340New_MCLKData;
+ pVBInfo->ECLKData = XGI340_ECLKData;
+ pVBInfo->VCLKData = XGI_VCLKData;
+ pVBInfo->VBVCLKData = XGI_VBVCLKData;
pVBInfo->ScreenOffset = XGI330_ScreenOffset;
- pVBInfo->StResInfo = (struct SiS_StResInfo_S *) XGI330_StResInfo;
- pVBInfo->ModeResInfo
- = (struct SiS_ModeResInfo_S *) XGI330_ModeResInfo;
+ pVBInfo->StResInfo = XGI330_StResInfo;
+ pVBInfo->ModeResInfo = XGI330_ModeResInfo;
pVBInfo->LCDResInfo = 0;
pVBInfo->LCDTypeInfo = 0;
@@ -56,24 +54,9 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
pVBInfo->SR21 = 0xa3;
pVBInfo->SR22 = 0xfb;
- pVBInfo->NTSCTiming = XGI330_NTSCTiming;
- pVBInfo->PALTiming = XGI330_PALTiming;
- pVBInfo->HiTVExtTiming = XGI330_HiTVExtTiming;
- pVBInfo->HiTVSt1Timing = XGI330_HiTVSt1Timing;
- pVBInfo->HiTVSt2Timing = XGI330_HiTVSt2Timing;
- pVBInfo->HiTVTextTiming = XGI330_HiTVTextTiming;
- pVBInfo->YPbPr750pTiming = XGI330_YPbPr750pTiming;
- pVBInfo->YPbPr525pTiming = XGI330_YPbPr525pTiming;
- pVBInfo->YPbPr525iTiming = XGI330_YPbPr525iTiming;
- pVBInfo->HiTVGroup3Data = XGI330_HiTVGroup3Data;
- pVBInfo->HiTVGroup3Simu = XGI330_HiTVGroup3Simu;
- pVBInfo->HiTVGroup3Text = XGI330_HiTVGroup3Text;
- pVBInfo->Ren525pGroup3 = XGI330_Ren525pGroup3;
- pVBInfo->Ren750pGroup3 = XGI330_Ren750pGroup3;
-
- pVBInfo->TimingH = (struct XGI_TimingHStruct *) XGI_TimingH;
- pVBInfo->TimingV = (struct XGI_TimingVStruct *) XGI_TimingV;
- pVBInfo->UpdateCRT1 = (struct XGI_XG21CRT1Struct *) XGI_UpdateCRT1Table;
+ pVBInfo->TimingH = XGI_TimingH;
+ pVBInfo->TimingV = XGI_TimingV;
+ pVBInfo->UpdateCRT1 = XGI_UpdateCRT1Table;
/* 310 customization related */
if ((pVBInfo->VBType & VB_SIS301LV) || (pVBInfo->VBType & VB_SIS302LV))
@@ -86,8 +69,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo)
if (ChipType == XG27) {
unsigned char temp;
- pVBInfo->MCLKData
- = (struct SiS_MCLKData *) XGI27New_MCLKData;
+ pVBInfo->MCLKData = XGI27New_MCLKData;
pVBInfo->CR40 = XGI27_cr41;
pVBInfo->XGINew_CR97 = 0xc1;
pVBInfo->SR15 = XG27_SR13;
@@ -116,11 +98,9 @@ static void XGI_SetSeqRegs(unsigned short ModeNo,
i = XGI_SetCRT2ToLCDA;
if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
tempah |= 0x01;
- } else {
- if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) {
- if (pVBInfo->VBInfo & SetInSlaveMode)
- tempah |= 0x01;
- }
+ } else if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) {
+ if (pVBInfo->VBInfo & SetInSlaveMode)
+ tempah |= 0x01;
}
tempah |= 0x20; /* screen off */
@@ -165,10 +145,9 @@ static void XGI_SetATTRegs(unsigned short ModeNo,
if ((modeflag & Charx8Dot) && i == 0x13) { /* ifndef Dot9 */
if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
ARdata = 0;
- } else {
- if ((pVBInfo->VBInfo &
+ } else if ((pVBInfo->VBInfo &
(SetCRT2ToTV | SetCRT2ToLCD)) &&
- (pVBInfo->VBInfo & SetInSlaveMode))
+ (pVBInfo->VBInfo & SetInSlaveMode)) {
ARdata = 0;
}
}
@@ -258,59 +237,45 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
}
if (pVBInfo->VBInfo & SetCRT2ToHiVision) { /* for HiTV */
- if ((pVBInfo->VBType & VB_SIS301LV) &&
- (pVBInfo->VBExtInfo == VB_YPbPr1080i)) {
- tempax |= SupportYPbPr750p;
- if ((pVBInfo->VBInfo & SetInSlaveMode) &&
- ((resinfo == 3) ||
- (resinfo == 4) ||
- (resinfo > 7)))
+ tempax |= SupportHiVision;
+ if ((pVBInfo->VBInfo & SetInSlaveMode) &&
+ ((resinfo == 4) ||
+ (resinfo == 3 &&
+ (pVBInfo->SetFlag & TVSimuMode)) ||
+ (resinfo > 7)))
return 0;
- } else {
- tempax |= SupportHiVision;
- if ((pVBInfo->VBInfo & SetInSlaveMode) &&
- ((resinfo == 4) ||
- (resinfo == 3 &&
- (pVBInfo->SetFlag & TVSimuMode)) ||
- (resinfo > 7)))
- return 0;
- }
- } else {
- if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
+ } else if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
SetCRT2ToSVIDEO |
SetCRT2ToSCART |
SetCRT2ToYPbPr525750 |
SetCRT2ToHiVision)) {
- tempax |= SupportTV;
-
- if (pVBInfo->VBType & (VB_SIS301B |
- VB_SIS302B |
- VB_SIS301LV |
- VB_SIS302LV |
- VB_XGI301C))
- tempax |= SupportTV1024;
-
- if (!(pVBInfo->VBInfo & TVSetPAL) &&
- (modeflag & NoSupportSimuTV) &&
- (pVBInfo->VBInfo & SetInSlaveMode) &&
- (!(pVBInfo->VBInfo & SetNotSimuMode)))
- return 0;
- }
+ tempax |= SupportTV;
+
+ if (pVBInfo->VBType & (VB_SIS301B |
+ VB_SIS302B |
+ VB_SIS301LV |
+ VB_SIS302LV |
+ VB_XGI301C))
+ tempax |= SupportTV1024;
+
+ if (!(pVBInfo->VBInfo & TVSetPAL) &&
+ (modeflag & NoSupportSimuTV) &&
+ (pVBInfo->VBInfo & SetInSlaveMode) &&
+ (!(pVBInfo->VBInfo & SetNotSimuMode)))
+ return 0;
}
- } else { /* for LVDS */
- if (pVBInfo->VBInfo & SetCRT2ToLCD) {
- tempax |= SupportLCD;
+ } else if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* for LVDS */
+ tempax |= SupportLCD;
- if (resinfo > 0x08)
- return 0; /* 1024x768 */
+ if (resinfo > 0x08)
+ return 0; /* 1024x768 */
- if (pVBInfo->LCDResInfo < Panel_1024x768) {
- if (resinfo > 0x07)
- return 0; /* 800x600 */
+ if (pVBInfo->LCDResInfo < Panel_1024x768) {
+ if (resinfo > 0x07)
+ return 0; /* 800x600 */
- if (resinfo == 0x04)
- return 0; /* 512x384 */
- }
+ if (resinfo == 0x04)
+ return 0; /* 512x384 */
}
}
@@ -969,13 +934,8 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
}
/* 301lv */
- if ((pVBInfo->VBType & VB_SIS301LV) &&
- !(pVBInfo->VBExtInfo == VB_YPbPr1080i)) {
- if (pVBInfo->VBExtInfo == YPbPr750p)
- VCLKIndex = XGI_YPbPr750pVCLK;
- else if (pVBInfo->VBExtInfo == YPbPr525p)
- VCLKIndex = YPbPr525pVCLK;
- else if (pVBInfo->SetFlag & RPLLDIV2XO)
+ if (pVBInfo->VBType & VB_SIS301LV) {
+ if (pVBInfo->SetFlag & RPLLDIV2XO)
VCLKIndex = YPbPr525iVCLK_2;
else
VCLKIndex = YPbPr525iVCLK;
@@ -991,13 +951,11 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
Ext_CRTVCLK;
VCLKIndex &= IndexMask;
}
- } else { /* LVDS */
- if ((pVBInfo->LCDResInfo == Panel_800x600) ||
- (pVBInfo->LCDResInfo == Panel_320x480))
- VCLKIndex = VCLK40; /* LVDSXlat1VCLK */
- else
- VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK,
- LVDSXlat3VCLK */
+ } else if ((pVBInfo->LCDResInfo == Panel_800x600) ||
+ (pVBInfo->LCDResInfo == Panel_320x480)) { /* LVDS */
+ VCLKIndex = VCLK40; /* LVDSXlat1VCLK */
+ } else {
+ VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK, LVDSXlat3VCLK */
}
return VCLKIndex;
@@ -1352,7 +1310,7 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
- unsigned short i, tempdx, tempcx, tempbx, tempal, modeflag, table;
+ unsigned short i, tempdx, tempbx, tempal, modeflag, table;
struct XGI330_LCDDataTablStruct *tempdi = NULL;
@@ -1377,15 +1335,6 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
tempal = (tempal & 0x0f);
}
- tempcx = LCDLenList[tempbx];
-
- if (pVBInfo->LCDInfo & EnableScalingLCD) { /* ScaleLCD */
- if ((tempbx == 5) || (tempbx) == 7)
- tempcx = LCDDesDataLen2;
- else if ((tempbx == 3) || (tempbx == 8))
- tempcx = LVDSDesDataLen2;
- }
-
switch (tempbx) {
case 0:
case 1:
@@ -1403,14 +1352,6 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
case 5:
tempdi = XGI_LCDDesDataTable;
break;
- case 6:
- tempdi = XGI_EPLCHLCDRegPtr;
- break;
- case 7:
- case 8:
- case 9:
- tempdi = NULL;
- break;
default:
break;
}
@@ -1764,62 +1705,20 @@ static void *XGI_GetLcdPtr(unsigned short BX, unsigned short ModeNo,
default:
break;
}
- } else if (table == 6) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_CH7017LV1024x768[tempal];
- break;
- case 1:
- return &XGI_CH7017LV1400x1050[tempal];
- break;
- default:
- break;
- }
}
return NULL;
}
-static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
+static struct SiS_TVData const *XGI_GetTVPtr(unsigned short ModeNo,
unsigned short ModeIdIndex,
unsigned short RefreshRateTableIndex,
struct vb_device_info *pVBInfo)
{
- unsigned short i, tempdx, tempbx, tempal, modeflag, table;
- struct XGI330_TVDataTablStruct *tempdi = NULL;
+ unsigned short i, tempdx, tempal, modeflag;
- tempbx = BX;
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempal = pVBInfo->RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
tempal = tempal & 0x3f;
- table = tempbx;
-
- switch (tempbx) {
- case 0:
- tempdi = NULL;
- break;
- case 1:
- tempdi = NULL;
- break;
- case 2:
- case 6:
- tempdi = xgifb_chrontel_tv;
- break;
- case 3:
- tempdi = NULL;
- break;
- case 4:
- tempdi = XGI_TVDataTable;
- break;
- case 5:
- tempdi = NULL;
- break;
- default:
- break;
- }
-
- if (tempdi == NULL) /* OEMUtil */
- return NULL;
-
tempdx = pVBInfo->TVInfo;
if (pVBInfo->VBInfo & SetInSlaveMode)
@@ -1830,78 +1729,14 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
i = 0;
- while (tempdi[i].MASK != 0xffff) {
- if ((tempdx & tempdi[i].MASK) == tempdi[i].CAP)
+ while (XGI_TVDataTable[i].MASK != 0xffff) {
+ if ((tempdx & XGI_TVDataTable[i].MASK) ==
+ XGI_TVDataTable[i].CAP)
break;
i++;
}
- if (table == 0x04) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_ExtPALData[tempal];
- break;
- case 1:
- return &XGI_ExtNTSCData[tempal];
- break;
- case 2:
- return &XGI_StPALData[tempal];
- break;
- case 3:
- return &XGI_StNTSCData[tempal];
- break;
- case 4:
- return &XGI_ExtHiTVData[tempal];
- break;
- case 5:
- return &XGI_St2HiTVData[tempal];
- break;
- case 6:
- return &XGI_ExtYPbPr525iData[tempal];
- break;
- case 7:
- return &XGI_ExtYPbPr525pData[tempal];
- break;
- case 8:
- return &XGI_ExtYPbPr750pData[tempal];
- break;
- case 9:
- return &XGI_StYPbPr525iData[tempal];
- break;
- case 10:
- return &XGI_StYPbPr525pData[tempal];
- break;
- case 11:
- return &XGI_StYPbPr750pData[tempal];
- break;
- case 12: /* avoid system hang */
- return &XGI_ExtNTSCData[tempal];
- break;
- case 13:
- return &XGI_St1HiTVData[tempal];
- break;
- default:
- break;
- }
- } else if (table == 0x02) {
- switch (tempdi[i].DATAPTR) {
- case 0:
- return &XGI_CHTVUNTSCData[tempal];
- break;
- case 1:
- return &XGI_CHTVONTSCData[tempal];
- break;
- case 2:
- return &XGI_CHTVUPALData[tempal];
- break;
- case 3:
- return &XGI_CHTVOPALData[tempal];
- break;
- default:
- break;
- }
- }
- return NULL;
+ return &XGI_TVDataTable[i].DATAPTR[tempal];
}
static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
@@ -1914,9 +1749,8 @@ static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 2;
if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
- LCDPtr = (struct SiS_LVDSData *)XGI_GetLcdPtr(tempbx,
- ModeNo, ModeIdIndex, RefreshRateTableIndex,
- pVBInfo);
+ LCDPtr = XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
pVBInfo->VGAHT = LCDPtr->VGAHT;
pVBInfo->VGAVT = LCDPtr->VGAVT;
pVBInfo->HT = LCDPtr->LCDHT;
@@ -1962,11 +1796,8 @@ static void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 0;
if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
- LCDPtr = (struct XGI_LVDSCRT1HDataStruct *)
- XGI_GetLcdPtr(tempbx, ModeNo,
- ModeIdIndex,
- RefreshRateTableIndex,
- pVBInfo);
+ LCDPtr = XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
for (i = 0; i < 8; i++)
pVBInfo->TimingH[0].data[i] = LCDPtr[0].Reg[i];
@@ -1977,13 +1808,8 @@ static void XGI_ModCRT1Regs(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 1;
if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
- LCDPtr1 = (struct XGI_LVDSCRT1VDataStruct *)
- XGI_GetLcdPtr(
- tempbx,
- ModeNo,
- ModeIdIndex,
- RefreshRateTableIndex,
- pVBInfo);
+ LCDPtr1 = XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
for (i = 0; i < 7; i++)
pVBInfo->TimingV[0].data[i] = LCDPtr1[0].Reg[i];
}
@@ -2075,23 +1901,11 @@ static void XGI_SetLVDSRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempbx = 3;
if (pVBInfo->LCDInfo & EnableScalingLCD)
- LCDPtr1 =
- (struct XGI330_LCDDataDesStruct2 *)
- XGI_GetLcdPtr(
- tempbx,
- ModeNo,
- ModeIdIndex,
- RefreshRateTableIndex,
- pVBInfo);
+ LCDPtr1 = XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
else
- LCDPtr =
- (struct XGI_LCDDesStruct *)
- XGI_GetLcdPtr(
- tempbx,
- ModeNo,
- ModeIdIndex,
- RefreshRateTableIndex,
- pVBInfo);
+ LCDPtr = XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
XGI_GetLCDSync(&tempax, &tempbx, pVBInfo);
push1 = tempbx;
@@ -2438,8 +2252,8 @@ static void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
| VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) {
if ((!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) &&
(pVBInfo->SetFlag & ProgrammingCRT2)) {
- *di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B;
- *di_1 = XGI_VBVCLKData[tempal].SR2C;
+ *di_0 = XGI_VBVCLKData[tempal].Part4_A;
+ *di_1 = XGI_VBVCLKData[tempal].Part4_B;
}
} else {
*di_0 = XGI_VCLKData[tempal].SR2B;
@@ -2634,21 +2448,16 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
- if (pVBInfo->IF_DEF_LCDA == 1) {
-
- if (((HwDeviceExtension->jChipType >= XG20) ||
- (HwDeviceExtension->jChipType >= XG40)) &&
- (pVBInfo->IF_DEF_LVDS == 0)) {
- if (pVBInfo->VBType &
- (VB_SIS302B |
- VB_SIS301LV |
- VB_SIS302LV |
- VB_XGI301C)) {
- if (temp & EnableDualEdge) {
- tempbx |= SetCRT2ToDualEdge;
- if (temp & SetToLCDA)
- tempbx |= XGI_SetCRT2ToLCDA;
- }
+ if (pVBInfo->IF_DEF_LVDS == 0) {
+ if (pVBInfo->VBType &
+ (VB_SIS302B |
+ VB_SIS301LV |
+ VB_SIS302LV |
+ VB_XGI301C)) {
+ if (temp & EnableDualEdge) {
+ tempbx |= SetCRT2ToDualEdge;
+ if (temp & SetToLCDA)
+ tempbx |= XGI_SetCRT2ToLCDA;
}
}
}
@@ -2687,11 +2496,10 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = 0x09FC;
else
temp = 0x097C;
+ } else if (pVBInfo->IF_DEF_HiVision == 1) {
+ temp = 0x01FC;
} else {
- if (pVBInfo->IF_DEF_HiVision == 1)
- temp = 0x01FC;
- else
- temp = 0x017C;
+ temp = 0x017C;
}
} else { /* 3nd party chip */
temp = SetCRT2ToLCD;
@@ -2702,19 +2510,17 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 0;
}
- if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */
- if (!(pVBInfo->VBType & VB_NoLCD)) {
- if (tempbx & XGI_SetCRT2ToLCDA) {
- if (tempbx & SetSimuScanMode)
- tempbx &= (~(SetCRT2ToLCD |
- SetCRT2ToRAMDAC |
- SwitchCRT2));
- else
- tempbx &= (~(SetCRT2ToLCD |
- SetCRT2ToRAMDAC |
- SetCRT2ToTV |
- SwitchCRT2));
- }
+ if (!(pVBInfo->VBType & VB_NoLCD)) {
+ if (tempbx & XGI_SetCRT2ToLCDA) {
+ if (tempbx & SetSimuScanMode)
+ tempbx &= (~(SetCRT2ToLCD |
+ SetCRT2ToRAMDAC |
+ SwitchCRT2));
+ else
+ tempbx &= (~(SetCRT2ToLCD |
+ SetCRT2ToRAMDAC |
+ SetCRT2ToTV |
+ SwitchCRT2));
}
}
@@ -2777,11 +2583,9 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
if (!(tempbx & DisableCRT2Display)) {
if ((!(tempbx & DriverMode)) ||
(!(modeflag & CRT2Mode))) {
- if (pVBInfo->IF_DEF_LCDA == 1) {
- if (!(tempbx & XGI_SetCRT2ToLCDA))
- tempbx |= (SetInSlaveMode |
- SetSimuScanMode);
- }
+ if (!(tempbx & XGI_SetCRT2ToLCDA))
+ tempbx |= (SetInSlaveMode |
+ SetSimuScanMode);
}
/* LCD+TV can't support in slave mode
@@ -2867,19 +2671,17 @@ static void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
if (pVBInfo->VBInfo & SetInSlaveMode)
tempbx &= (~RPLLDIV2XO);
- } else {
- if (tempbx &
- (TVSetYPbPr525p | TVSetYPbPr750p))
+ } else if (tempbx &
+ (TVSetYPbPr525p | TVSetYPbPr750p)) {
tempbx &= (~RPLLDIV2XO);
- else if (!(pVBInfo->VBType &
+ } else if (!(pVBInfo->VBType &
(VB_SIS301B |
VB_SIS302B |
VB_SIS301LV |
VB_SIS302LV |
VB_XGI301C))) {
- if (tempbx & TVSimuMode)
- tempbx &= (~RPLLDIV2XO);
- }
+ if (tempbx & TVSimuMode)
+ tempbx &= (~RPLLDIV2XO);
}
}
}
@@ -2960,20 +2762,6 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
tempbx |= SetLCDtoNonExpanding;
}
- if (pVBInfo->IF_DEF_ExpLink == 1) {
- if (modeflag & HalfDCLK) {
- if (!(tempbx & SetLCDtoNonExpanding)) {
- tempbx |= XGI_EnableLVDSDDA;
- } else {
- if (pVBInfo->LCDResInfo == Panel_1024x768) {
- if (resinfo == 4) {/* 512x384 */
- tempbx |= XGI_EnableLVDSDDA;
- }
- }
- }
- }
- }
-
if (pVBInfo->VBInfo & SetInSlaveMode) {
if (pVBInfo->VBInfo & SetNotSimuMode)
tempbx |= XGI_LCDVESATiming;
@@ -3122,33 +2910,6 @@ static void XGI_XG27BLSignalVDD(unsigned short tempbh, unsigned short tempbl,
xgifb_reg_and_or(pVBInfo->P3d4, 0x48, ~tempbh, tempbl);
}
-/* --------------------------------------------------------------------- */
-/* Function : XGI_XG21SetPanelDelay */
-/* Input : */
-/* Output : */
-/* Description : */
-/* I/P : bl : 1 ; T1 : the duration between CPL on and signal on */
-/* : bl : 2 ; T2 : the duration signal on and Vdd on */
-/* : bl : 3 ; T3 : the duration between CPL off and signal off */
-/* : bl : 4 ; T4 : the duration signal off and Vdd off */
-/* --------------------------------------------------------------------- */
-static void XGI_XG21SetPanelDelay(struct xgifb_video_info *xgifb_info,
- unsigned short tempbl,
- struct vb_device_info *pVBInfo)
-{
- if (tempbl == 1)
- mdelay(xgifb_info->lvds_data.PSC_S1);
-
- if (tempbl == 2)
- mdelay(xgifb_info->lvds_data.PSC_S2);
-
- if (tempbl == 3)
- mdelay(xgifb_info->lvds_data.PSC_S3);
-
- if (tempbl == 4)
- mdelay(xgifb_info->lvds_data.PSC_S4);
-}
-
static void XGI_DisplayOn(struct xgifb_video_info *xgifb_info,
struct xgi_hw_device_info *pXGIHWDE,
struct vb_device_info *pVBInfo)
@@ -3160,12 +2921,12 @@ static void XGI_DisplayOn(struct xgifb_video_info *xgifb_info,
if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x1)) {
/* LVDS VDD on */
XGI_XG21BLSignalVDD(0x01, 0x01, pVBInfo);
- XGI_XG21SetPanelDelay(xgifb_info, 2, pVBInfo);
+ mdelay(xgifb_info->lvds_data.PSC_S2);
}
if (!(XGI_XG21GetPSCValue(pVBInfo) & 0x20))
/* LVDS signal on */
XGI_XG21BLSignalVDD(0x20, 0x20, pVBInfo);
- XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo);
+ mdelay(xgifb_info->lvds_data.PSC_S3);
/* LVDS backlight on */
XGI_XG21BLSignalVDD(0x02, 0x02, pVBInfo);
} else {
@@ -3180,12 +2941,12 @@ static void XGI_DisplayOn(struct xgifb_video_info *xgifb_info,
if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x1)) {
/* LVDS VDD on */
XGI_XG27BLSignalVDD(0x01, 0x01, pVBInfo);
- XGI_XG21SetPanelDelay(xgifb_info, 2, pVBInfo);
+ mdelay(xgifb_info->lvds_data.PSC_S2);
}
if (!(XGI_XG27GetPSCValue(pVBInfo) & 0x20))
/* LVDS signal on */
XGI_XG27BLSignalVDD(0x20, 0x20, pVBInfo);
- XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo);
+ mdelay(xgifb_info->lvds_data.PSC_S3);
/* LVDS backlight on */
XGI_XG27BLSignalVDD(0x02, 0x02, pVBInfo);
} else {
@@ -3205,7 +2966,7 @@ void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
if (pVBInfo->IF_DEF_LVDS == 1) {
/* LVDS backlight off */
XGI_XG21BLSignalVDD(0x02, 0x00, pVBInfo);
- XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo);
+ mdelay(xgifb_info->lvds_data.PSC_S3);
} else {
/* DVO/DVI signal off */
XGI_XG21BLSignalVDD(0x20, 0x00, pVBInfo);
@@ -3216,7 +2977,7 @@ void XGI_DisplayOff(struct xgifb_video_info *xgifb_info,
if ((XGI_XG27GetPSCValue(pVBInfo) & 0x2)) {
/* LVDS backlight off */
XGI_XG27BLSignalVDD(0x02, 0x00, pVBInfo);
- XGI_XG21SetPanelDelay(xgifb_info, 3, pVBInfo);
+ mdelay(xgifb_info->lvds_data.PSC_S3);
}
if (pVBInfo->IF_DEF_LVDS == 0)
@@ -3378,7 +3139,6 @@ static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
unsigned short tempax = 0, tempbx, modeflag, resinfo;
struct SiS_LCDData *LCDPtr = NULL;
- struct SiS_TVData *TVPtr = NULL;
/* si+Ext_ResInfo */
modeflag = pVBInfo->EModeIDTable[ModeIdIndex].Ext_ModeFlag;
@@ -3395,9 +3155,8 @@ static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
tempbx = 4;
if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
- LCDPtr = (struct SiS_LCDData *) XGI_GetLcdPtr(tempbx,
- ModeNo, ModeIdIndex, RefreshRateTableIndex,
- pVBInfo);
+ LCDPtr = XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
pVBInfo->RVBHCMAX = LCDPtr->RVBHCMAX;
pVBInfo->RVBHCFACT = LCDPtr->RVBHCFACT;
@@ -3479,10 +3238,10 @@ static void XGI_GetCRT2Data(unsigned short ModeNo, unsigned short ModeIdIndex,
}
if (pVBInfo->VBInfo & (SetCRT2ToTV)) {
- tempbx = 4;
- TVPtr = (struct SiS_TVData *) XGI_GetTVPtr(tempbx,
- ModeNo, ModeIdIndex, RefreshRateTableIndex,
- pVBInfo);
+ struct SiS_TVData const *TVPtr;
+
+ TVPtr = XGI_GetTVPtr(ModeNo, ModeIdIndex, RefreshRateTableIndex,
+ pVBInfo);
pVBInfo->RVBHCMAX = TVPtr->RVBHCMAX;
pVBInfo->RVBHCFACT = TVPtr->RVBHCFACT;
@@ -3882,16 +3641,9 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
| VB_SIS302LV | VB_XGI301C)))
temp += 2;
- if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
- if (pVBInfo->VBType & VB_SIS301LV) {
- if (pVBInfo->VBExtInfo == VB_YPbPr1080i) {
- if (resinfo == 7)
- temp -= 2;
- }
- } else if (resinfo == 7) {
+ if ((pVBInfo->VBInfo & SetCRT2ToHiVision) &&
+ !(pVBInfo->VBType & VB_SIS301LV) && (resinfo == 7))
temp -= 2;
- }
- }
}
/* 0x05 Horizontal Display Start */
@@ -4061,18 +3813,16 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
} else {
tempbx -= 10;
}
- } else {
- if (pVBInfo->TVInfo & TVSimuMode) {
- if (pVBInfo->TVInfo & TVSetPAL) {
- if (pVBInfo->VBType & VB_SIS301LV) {
- if (!(pVBInfo->TVInfo &
- (TVSetYPbPr525p |
- TVSetYPbPr750p |
- TVSetHiVision)))
- tempbx += 40;
- } else {
+ } else if (pVBInfo->TVInfo & TVSimuMode) {
+ if (pVBInfo->TVInfo & TVSetPAL) {
+ if (pVBInfo->VBType & VB_SIS301LV) {
+ if (!(pVBInfo->TVInfo &
+ (TVSetYPbPr525p |
+ TVSetYPbPr750p |
+ TVSetHiVision)))
tempbx += 40;
- }
+ } else {
+ tempbx += 40;
}
}
}
@@ -4154,7 +3904,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
{
unsigned short i, j, tempax, tempbx, tempcx, temp, push1, push2,
modeflag, resinfo, crt2crtc;
- unsigned char *TimingPoint;
+ unsigned char const *TimingPoint;
unsigned long longtemp, tempeax, tempebx, temp2, tempecx;
@@ -4186,33 +3936,33 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
tempax = (tempax & 0xff00) >> 8;
xgifb_reg_set(pVBInfo->Part2Port, 0x0, tempax);
- TimingPoint = pVBInfo->NTSCTiming;
+ TimingPoint = XGI330_NTSCTiming;
if (pVBInfo->TVInfo & TVSetPAL)
- TimingPoint = pVBInfo->PALTiming;
+ TimingPoint = XGI330_PALTiming;
if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
- TimingPoint = pVBInfo->HiTVExtTiming;
+ TimingPoint = XGI330_HiTVExtTiming;
if (pVBInfo->VBInfo & SetInSlaveMode)
- TimingPoint = pVBInfo->HiTVSt2Timing;
+ TimingPoint = XGI330_HiTVSt2Timing;
if (pVBInfo->SetFlag & TVSimuMode)
- TimingPoint = pVBInfo->HiTVSt1Timing;
+ TimingPoint = XGI330_HiTVSt1Timing;
if (!(modeflag & Charx8Dot))
- TimingPoint = pVBInfo->HiTVTextTiming;
+ TimingPoint = XGI330_HiTVTextTiming;
}
if (pVBInfo->VBInfo & SetCRT2ToYPbPr525750) {
if (pVBInfo->TVInfo & TVSetYPbPr525i)
- TimingPoint = pVBInfo->YPbPr525iTiming;
+ TimingPoint = XGI330_YPbPr525iTiming;
if (pVBInfo->TVInfo & TVSetYPbPr525p)
- TimingPoint = pVBInfo->YPbPr525pTiming;
+ TimingPoint = XGI330_YPbPr525pTiming;
if (pVBInfo->TVInfo & TVSetYPbPr750p)
- TimingPoint = pVBInfo->YPbPr750pTiming;
+ TimingPoint = XGI330_YPbPr750pTiming;
}
for (i = 0x01, j = 0; i <= 0x2D; i++, j++)
@@ -4385,11 +4135,9 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp += 1;
}
}
- } else {
- if (pVBInfo->VBInfo & SetInSlaveMode) {
- if (ModeNo == 0x2f)
- temp += 1;
- }
+ } else if (pVBInfo->VBInfo & SetInSlaveMode) {
+ if (ModeNo == 0x2f)
+ temp += 1;
}
}
@@ -4644,8 +4392,8 @@ static void XGI_SetLCDRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
/* Customized LCDB Des no add */
tempbx = 5;
- LCDBDesPtr = (struct XGI_LCDDesStruct *) XGI_GetLcdPtr(tempbx, ModeNo,
- ModeIdIndex, RefreshRateTableIndex, pVBInfo);
+ LCDBDesPtr = XGI_GetLcdPtr(tempbx, ModeNo, ModeIdIndex,
+ RefreshRateTableIndex, pVBInfo);
tempah = pVBInfo->LCDResInfo;
tempah &= PanelResInfo;
@@ -4876,7 +4624,7 @@ static void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
struct vb_device_info *pVBInfo)
{
unsigned short i;
- unsigned char *tempdi;
+ unsigned char const *tempdi;
unsigned short modeflag;
/* si+Ext_ResInfo */
@@ -4905,18 +4653,18 @@ static void XGI_SetGroup3(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->TVInfo & TVSetYPbPr525i)
return;
- tempdi = pVBInfo->HiTVGroup3Data;
+ tempdi = XGI330_HiTVGroup3Data;
if (pVBInfo->SetFlag & TVSimuMode) {
- tempdi = pVBInfo->HiTVGroup3Simu;
+ tempdi = XGI330_HiTVGroup3Simu;
if (!(modeflag & Charx8Dot))
- tempdi = pVBInfo->HiTVGroup3Text;
+ tempdi = XGI330_HiTVGroup3Text;
}
if (pVBInfo->TVInfo & TVSetYPbPr525p)
- tempdi = pVBInfo->Ren525pGroup3;
+ tempdi = XGI330_Ren525pGroup3;
if (pVBInfo->TVInfo & TVSetYPbPr750p)
- tempdi = pVBInfo->Ren750pGroup3;
+ tempdi = XGI330_Ren750pGroup3;
for (i = 0; i <= 0x3E; i++)
xgifb_reg_set(pVBInfo->Part3Port, i, tempdi[i]);
@@ -5054,13 +4802,11 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBInfo & SetCRT2ToLCD) {
if (tempax > 800)
tempax -= 800;
- } else {
- if (pVBInfo->VGAHDE > 800) {
- if (pVBInfo->VGAHDE == 1024)
- tempax = (tempax * 25 / 32) - 1;
- else
- tempax = (tempax * 20 / 32) - 1;
- }
+ } else if (pVBInfo->VGAHDE > 800) {
+ if (pVBInfo->VGAHDE == 1024)
+ tempax = (tempax * 25 / 32) - 1;
+ else
+ tempax = (tempax * 20 / 32) - 1;
}
tempax -= 1;
@@ -5101,9 +4847,7 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
}
/* end 301b */
- if (pVBInfo->ISXPDOS == 0)
- XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex,
- pVBInfo);
+ XGI_SetCRT2VCLK(ModeNo, ModeIdIndex, RefreshRateTableIndex, pVBInfo);
}
static void XGINew_EnableCRT2(struct vb_device_info *pVBInfo)
@@ -6414,12 +6158,10 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
if (pVBInfo->SetFlag & EnableChA) {
/* Power on */
xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20);
- } else {
- if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
- /* Power on */
- xgifb_reg_set(pVBInfo->Part1Port,
- 0x1E, 0x20);
- }
+ } else if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
+ /* Power on */
+ xgifb_reg_set(pVBInfo->Part1Port,
+ 0x1E, 0x20);
}
}
@@ -6607,7 +6349,6 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
struct vb_device_info *pVBInfo = &VBINF;
pVBInfo->BaseAddr = xgifb_info->vga_base;
pVBInfo->IF_DEF_LVDS = 0;
- pVBInfo->IF_DEF_LCDA = 1;
if (HwDeviceExtension->jChipType >= XG20) {
pVBInfo->IF_DEF_YPbPr = 0;
@@ -6678,16 +6419,14 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
HwDeviceExtension, pVBInfo);
}
- } else {
- if (!(pVBInfo->VBInfo & SwitchCRT2)) {
- XGI_SetCRT1Group(xgifb_info,
- HwDeviceExtension, ModeNo,
- ModeIdIndex, pVBInfo);
- if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
- XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
- HwDeviceExtension,
- pVBInfo);
- }
+ } else if (!(pVBInfo->VBInfo & SwitchCRT2)) {
+ XGI_SetCRT1Group(xgifb_info,
+ HwDeviceExtension, ModeNo,
+ ModeIdIndex, pVBInfo);
+ if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+ XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
+ HwDeviceExtension,
+ pVBInfo);
}
}