aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/xgifb/vb_ext.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/xgifb/vb_ext.c')
-rw-r--r--drivers/staging/xgifb/vb_ext.c138
1 files changed, 97 insertions, 41 deletions
diff --git a/drivers/staging/xgifb/vb_ext.c b/drivers/staging/xgifb/vb_ext.c
index d7c1b2ebed17..7e1f76adf733 100644
--- a/drivers/staging/xgifb/vb_ext.c
+++ b/drivers/staging/xgifb/vb_ext.c
@@ -1,5 +1,5 @@
#include <linux/version.h>
-#include <asm/io.h>
+#include <linux/io.h>
#include <linux/types.h>
#include "XGIfb.h"
@@ -26,7 +26,9 @@ static unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo)
return 1;
}
-static unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx, struct vb_device_info *pVBInfo)
+static unsigned char XGINew_Sense(unsigned short tempbx,
+ unsigned short tempcx,
+ struct vb_device_info *pVBInfo)
{
unsigned short temp, i, tempch;
@@ -50,7 +52,9 @@ static unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx,
return 0;
}
-static unsigned char XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+static unsigned char
+XGINew_GetLCDDDCInfo(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
unsigned short temp;
@@ -154,7 +158,9 @@ static unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo)
}
}
-static unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+static unsigned char
+XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
unsigned short flag;
@@ -170,7 +176,9 @@ static unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceEx
return 0;
}
-static unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+static unsigned char
+XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
unsigned short tempbx, tempcx, temp, i, tempch;
@@ -238,21 +246,29 @@ static unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtensi
}
}
-void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
- unsigned short tempax = 0, tempbx, tempcx, temp, P2reg0 = 0, SenseModeNo = 0,
- OutputSelect = *pVBInfo->pOutputSelect, ModeIdIndex, i;
+ unsigned short tempax = 0, tempbx, tempcx, temp,
+ P2reg0 = 0, SenseModeNo = 0,
+ OutputSelect = *pVBInfo->pOutputSelect,
+ ModeIdIndex, i;
pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
if (pVBInfo->IF_DEF_LVDS == 1) {
- tempax = xgifb_reg_get(pVBInfo->P3c4, 0x1A); /* ynlai 02/27/2002 */
+ /* ynlai 02/27/2002 */
+ tempax = xgifb_reg_get(pVBInfo->P3c4, 0x1A);
tempbx = xgifb_reg_get(pVBInfo->P3c4, 0x1B);
tempax = ((tempax & 0xFE) >> 1) | (tempbx << 8);
if (tempax == 0x00) { /* Get Panel id from DDC */
temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo);
if (temp == 1) { /* LCD connect */
- xgifb_reg_and_or(pVBInfo->P3d4, 0x39, 0xFF, 0x01); /* set CR39 bit0="1" */
- xgifb_reg_and_or(pVBInfo->P3d4, 0x37, 0xEF, 0x00); /* clean CR37 bit4="0" */
+ /* set CR39 bit0="1" */
+ xgifb_reg_and_or(pVBInfo->P3d4,
+ 0x39, 0xFF, 0x01);
+ /* clean CR37 bit4="0" */
+ xgifb_reg_and_or(pVBInfo->P3d4,
+ 0x37, 0xEF, 0x00);
temp = LCDSense;
} else { /* LCD don't connect */
temp = 0;
@@ -273,25 +289,47 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xA0, temp);
} else {
if (XGI_BridgeIsOn(pVBInfo)) {
- P2reg0 = xgifb_reg_get(pVBInfo->Part2Port, 0x00);
- if (!XGINew_BridgeIsEnable(HwDeviceExtension, pVBInfo)) {
+ P2reg0 = xgifb_reg_get(pVBInfo->Part2Port,
+ 0x00);
+ if (!XGINew_BridgeIsEnable(HwDeviceExtension,
+ pVBInfo)) {
SenseModeNo = 0x2e;
- /* xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x41); */
- /* XGISetModeNew(HwDeviceExtension, 0x2e); // ynlai InitMode */
-
- temp = XGI_SearchModeID(SenseModeNo, &ModeIdIndex, pVBInfo);
- XGI_GetVGAType(HwDeviceExtension, pVBInfo);
+ /* xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x41);
+ * XGISetModeNew(HwDeviceExtension, 0x2e);
+ * // ynlai InitMode */
+
+ temp = XGI_SearchModeID(SenseModeNo,
+ &ModeIdIndex,
+ pVBInfo);
+ XGI_GetVGAType(HwDeviceExtension,
+ pVBInfo);
XGI_GetVBType(pVBInfo);
pVBInfo->SetFlag = 0x00;
pVBInfo->ModeType = ModeVGA;
- pVBInfo->VBInfo = SetCRT2ToRAMDAC | LoadDACFlag | SetInSlaveMode;
- XGI_GetLCDInfo(0x2e, ModeIdIndex, pVBInfo);
- XGI_GetTVInfo(0x2e, ModeIdIndex, pVBInfo);
- XGI_EnableBridge(HwDeviceExtension, pVBInfo);
- XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo);
- XGI_SetCRT2ModeRegs(0x2e, HwDeviceExtension, pVBInfo);
- /* XGI_DisableBridge( HwDeviceExtension, pVBInfo ) ; */
- xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x20); /* Display Off 0212 */
+ pVBInfo->VBInfo = SetCRT2ToRAMDAC |
+ LoadDACFlag |
+ SetInSlaveMode;
+ XGI_GetLCDInfo(0x2e,
+ ModeIdIndex,
+ pVBInfo);
+ XGI_GetTVInfo(0x2e,
+ ModeIdIndex,
+ pVBInfo);
+ XGI_EnableBridge(HwDeviceExtension,
+ pVBInfo);
+ XGI_SetCRT2Group301(SenseModeNo,
+ HwDeviceExtension,
+ pVBInfo);
+ XGI_SetCRT2ModeRegs(0x2e,
+ HwDeviceExtension,
+ pVBInfo);
+ /* XGI_DisableBridge(HwDeviceExtension,
+ * pVBInfo ) ; */
+ /* Display Off 0212 */
+ xgifb_reg_and_or(pVBInfo->P3c4,
+ 0x01,
+ 0xDF,
+ 0x20);
for (i = 0; i < 20; i++)
XGI_LongWait(pVBInfo);
}
@@ -304,29 +342,38 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
tempcx = 0x0E08;
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
- if (XGINew_Sense(tempbx, tempcx, pVBInfo))
+ if (XGINew_Sense(tempbx,
+ tempcx,
+ pVBInfo))
tempax |= Monitor2Sense;
}
if (pVBInfo->VBType & VB_XGI301C)
- xgifb_reg_or(pVBInfo->Part4Port, 0x0d, 0x04);
+ xgifb_reg_or(pVBInfo->Part4Port,
+ 0x0d,
+ 0x04);
- if (XGINew_SenseHiTV(HwDeviceExtension, pVBInfo)) { /* add by kuku for Multi-adapter sense HiTV */
+ /* add by kuku for Multi-adapter sense HiTV */
+ if (XGINew_SenseHiTV(HwDeviceExtension,
+ pVBInfo)) {
tempax |= HiTVSense;
if ((pVBInfo->VBType & VB_XGI301C))
- tempax ^= (HiTVSense | YPbPrSense);
+ tempax ^= (HiTVSense |
+ YPbPrSense);
}
- if (!(tempax & (HiTVSense | YPbPrSense))) { /* start */
-
+ /* start */
+ if (!(tempax & (HiTVSense | YPbPrSense))) {
tempbx = *pVBInfo->pYCSenseData;
-
if (!(XGINew_Is301B(pVBInfo)))
tempbx = *pVBInfo->pYCSenseData2;
-
tempcx = 0x0604;
- if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
- if (XGINew_Sense(tempbx, tempcx, pVBInfo))
+ if (XGINew_Sense(tempbx,
+ tempcx,
+ pVBInfo)) {
+ if (XGINew_Sense(tempbx,
+ tempcx,
+ pVBInfo))
tempax |= SVIDEOSense;
}
@@ -337,8 +384,12 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
tempbx = *pVBInfo->pVideoSenseData2;
tempcx = 0x0804;
- if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
- if (XGINew_Sense(tempbx, tempcx, pVBInfo))
+ if (XGINew_Sense(tempbx,
+ tempcx,
+ pVBInfo)) {
+ if (XGINew_Sense(tempbx,
+ tempcx,
+ pVBInfo))
tempax |= AVIDEOSense;
}
} else {
@@ -349,7 +400,9 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
tempbx = *pVBInfo->pVideoSenseData2;
tempcx = 0x0804;
- if (XGINew_Sense(tempbx, tempcx, pVBInfo)) {
+ if (XGINew_Sense(tempbx,
+ tempcx,
+ pVBInfo)) {
if (XGINew_Sense(tempbx, tempcx, pVBInfo))
tempax |= AVIDEOSense;
}
@@ -370,7 +423,9 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
if (!(P2reg0 & 0x20)) {
pVBInfo->VBInfo = DisableCRT2Display;
- /* XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo); */
+ /* XGI_SetCRT2Group301(SenseModeNo,
+ * HwDeviceExtension,
+ * pVBInfo); */
}
}
}
@@ -378,7 +433,8 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
}
-unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo)
+unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *HwDeviceExtension,
+ struct vb_device_info *pVBInfo)
{
/* unsigned short SoftSetting ; */
unsigned short temp;