Commit f9317351 authored by Miguel Gómez's avatar Miguel Gómez Committed by Greg Kroah-Hartman

Staging: xgifb: Rework conditions in XGI_GetVBInfo().

Rework some conditions to reduce indentation and fix style warnings.
Signed-off-by: default avatarMiguel Gómez <magomez@igalia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7eec23a7
...@@ -2611,186 +2611,183 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -2611,186 +2611,183 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
pVBInfo->ModeType = modeflag & ModeTypeMask; pVBInfo->ModeType = modeflag & ModeTypeMask;
tempbx = 0; tempbx = 0;
if (pVBInfo->VBType & 0xFFFF) { if (!(pVBInfo->VBType & 0xFFFF))
/* Check Display Device */ return;
temp = xgifb_reg_get(pVBInfo->P3d4, 0x30);
tempbx = tempbx | temp;
temp = xgifb_reg_get(pVBInfo->P3d4, 0x31);
push = temp;
push = push << 8;
tempax = temp << 8;
tempbx = tempbx | tempax;
temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA
| SetInSlaveMode | DisableCRT2Display);
temp = 0xFFFF ^ temp;
tempbx &= temp;
temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
if (pVBInfo->IF_DEF_LCDA == 1) { /* Check Display Device */
temp = xgifb_reg_get(pVBInfo->P3d4, 0x30);
if ((HwDeviceExtension->jChipType >= XG20) || tempbx = tempbx | temp;
(HwDeviceExtension->jChipType >= XG40)) { temp = xgifb_reg_get(pVBInfo->P3d4, 0x31);
if (pVBInfo->IF_DEF_LVDS == 0) { push = temp;
if (pVBInfo->VBType & push = push << 8;
(VB_SIS302B | tempax = temp << 8;
VB_SIS301LV | tempbx = tempbx | tempax;
VB_SIS302LV | temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA
VB_XGI301C)) { | SetInSlaveMode | DisableCRT2Display);
if (temp & EnableDualEdge) { temp = 0xFFFF ^ temp;
tempbx |= tempbx &= temp;
SetCRT2ToDualEdge;
temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
if (temp & SetToLCDA)
tempbx |= if (pVBInfo->IF_DEF_LCDA == 1) {
XGI_SetCRT2ToLCDA;
} 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_YPbPr == 1) { if (pVBInfo->IF_DEF_YPbPr == 1) {
if (((pVBInfo->IF_DEF_LVDS == 0) && if (((pVBInfo->IF_DEF_LVDS == 0) &&
((pVBInfo->VBType & VB_SIS301LV) || ((pVBInfo->VBType & VB_SIS301LV) ||
(pVBInfo->VBType & VB_SIS302LV) || (pVBInfo->VBType & VB_SIS302LV) ||
(pVBInfo->VBType & VB_XGI301C)))) { (pVBInfo->VBType & VB_XGI301C)))) {
if (temp & SetYPbPr) { if (temp & SetYPbPr) {
if (pVBInfo->IF_DEF_HiVision == 1) { if (pVBInfo->IF_DEF_HiVision == 1) {
/* shampoo add for new /* shampoo add for new
* scratch */ * scratch */
temp = xgifb_reg_get( temp = xgifb_reg_get(
pVBInfo->P3d4, pVBInfo->P3d4,
0x35); 0x35);
temp &= YPbPrMode; temp &= YPbPrMode;
tempbx |= SetCRT2ToHiVision; tempbx |= SetCRT2ToHiVision;
if (temp != YPbPrMode1080i) { if (temp != YPbPrMode1080i) {
tempbx &= tempbx &=
(~SetCRT2ToHiVision); (~SetCRT2ToHiVision);
tempbx |= tempbx |=
SetCRT2ToYPbPr525750; SetCRT2ToYPbPr525750;
}
} }
} }
} }
} }
}
tempax = push; /* restore CR31 */ tempax = push; /* restore CR31 */
if (pVBInfo->IF_DEF_LVDS == 0) { if (pVBInfo->IF_DEF_LVDS == 0) {
if (pVBInfo->IF_DEF_YPbPr == 1) { if (pVBInfo->IF_DEF_YPbPr == 1) {
if (pVBInfo->IF_DEF_HiVision == 1) if (pVBInfo->IF_DEF_HiVision == 1)
temp = 0x09FC; temp = 0x09FC;
else else
temp = 0x097C; temp = 0x097C;
} else { } else {
if (pVBInfo->IF_DEF_HiVision == 1) if (pVBInfo->IF_DEF_HiVision == 1)
temp = 0x01FC; temp = 0x01FC;
else else
temp = 0x017C; temp = 0x017C;
}
} else { /* 3nd party chip */
temp = SetCRT2ToLCD;
}
if (!(tempbx & temp)) {
tempax |= DisableCRT2Display;
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));
}
}
} }
} else { /* 3nd party chip */
temp = SetCRT2ToLCD;
}
/* shampoo add */ if (!(tempbx & temp)) {
/* for driver abnormal */ tempax |= DisableCRT2Display;
if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) { tempbx = 0;
if (pVBInfo->IF_DEF_CRT2Monitor == 1) { }
if (tempbx & SetCRT2ToRAMDAC) {
tempbx &= (0xFF00 | if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */
SetCRT2ToRAMDAC | if (!(pVBInfo->VBType & VB_NoLCD)) {
SwitchCRT2 | if (tempbx & XGI_SetCRT2ToLCDA) {
SetSimuScanMode); if (tempbx & SetSimuScanMode)
tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750)); tempbx &= (~(SetCRT2ToLCD |
} SetCRT2ToRAMDAC |
} else { SwitchCRT2));
tempbx &= (~(SetCRT2ToRAMDAC | else
SetCRT2ToLCD | tempbx &= (~(SetCRT2ToLCD |
SetCRT2ToTV)); SetCRT2ToRAMDAC |
SetCRT2ToTV |
SwitchCRT2));
} }
} }
}
if (!(pVBInfo->VBType & VB_NoLCD)) { /* shampoo add */
if (tempbx & SetCRT2ToLCD) { /* for driver abnormal */
if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {
if (pVBInfo->IF_DEF_CRT2Monitor == 1) {
if (tempbx & SetCRT2ToRAMDAC) {
tempbx &= (0xFF00 | tempbx &= (0xFF00 |
SetCRT2ToLCD | SetCRT2ToRAMDAC |
SwitchCRT2 | SwitchCRT2 |
SetSimuScanMode); SetSimuScanMode);
tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750)); tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
} }
} else {
tempbx &= (~(SetCRT2ToRAMDAC |
SetCRT2ToLCD |
SetCRT2ToTV));
} }
}
if (tempbx & SetCRT2ToSCART) { if (!(pVBInfo->VBType & VB_NoLCD)) {
if (tempbx & SetCRT2ToLCD) {
tempbx &= (0xFF00 | tempbx &= (0xFF00 |
SetCRT2ToSCART | SetCRT2ToLCD |
SwitchCRT2 | SwitchCRT2 |
SetSimuScanMode); SetSimuScanMode);
tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750)); tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
} }
}
if (pVBInfo->IF_DEF_YPbPr == 1) { if (tempbx & SetCRT2ToSCART) {
if (tempbx & SetCRT2ToYPbPr525750) tempbx &= (0xFF00 |
tempbx &= (0xFF00 | SetCRT2ToSCART |
SwitchCRT2 | SwitchCRT2 |
SetSimuScanMode); SetSimuScanMode);
} tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
}
if (pVBInfo->IF_DEF_HiVision == 1) { if (pVBInfo->IF_DEF_YPbPr == 1) {
if (tempbx & SetCRT2ToHiVision) if (tempbx & SetCRT2ToYPbPr525750)
tempbx &= (0xFF00 | tempbx &= (0xFF00 |
SetCRT2ToHiVision | SwitchCRT2 |
SwitchCRT2 | SetSimuScanMode);
SetSimuScanMode); }
}
if (tempax & DisableCRT2Display) { /* Set Display Device Info */ if (pVBInfo->IF_DEF_HiVision == 1) {
if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) if (tempbx & SetCRT2ToHiVision)
tempbx = DisableCRT2Display; tempbx &= (0xFF00 |
} SetCRT2ToHiVision |
SwitchCRT2 |
SetSimuScanMode);
}
if (!(tempbx & DisableCRT2Display)) { if (tempax & DisableCRT2Display) { /* Set Display Device Info */
if ((!(tempbx & DriverMode)) || if (!(tempbx & (SwitchCRT2 | SetSimuScanMode)))
(!(modeflag & CRT2Mode))) { tempbx = DisableCRT2Display;
if (pVBInfo->IF_DEF_LCDA == 1) { }
if (!(tempbx & XGI_SetCRT2ToLCDA))
tempbx |= (SetInSlaveMode |
SetSimuScanMode);
}
}
/* LCD+TV can't support in slave mode if (!(tempbx & DisableCRT2Display)) {
* (Force LCDA+TV->LCDB) */ if ((!(tempbx & DriverMode)) ||
if ((tempbx & SetInSlaveMode) && (!(modeflag & CRT2Mode))) {
(tempbx & XGI_SetCRT2ToLCDA)) { if (pVBInfo->IF_DEF_LCDA == 1) {
tempbx ^= (SetCRT2ToLCD | if (!(tempbx & XGI_SetCRT2ToLCDA))
XGI_SetCRT2ToLCDA | tempbx |= (SetInSlaveMode |
SetCRT2ToDualEdge); SetSimuScanMode);
pVBInfo->SetFlag |= ReserveTVOption;
} }
} }
/* LCD+TV can't support in slave mode
* (Force LCDA+TV->LCDB) */
if ((tempbx & SetInSlaveMode) &&
(tempbx & XGI_SetCRT2ToLCDA)) {
tempbx ^= (SetCRT2ToLCD |
XGI_SetCRT2ToLCDA |
SetCRT2ToDualEdge);
pVBInfo->SetFlag |= ReserveTVOption;
}
} }
pVBInfo->VBInfo = tempbx; pVBInfo->VBInfo = tempbx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment