Commit 6622995b authored by Kenji Toyama's avatar Kenji Toyama Committed by Greg Kroah-Hartman

Staging: xgifb: Fixed coding style issues.

Not all warnings were silenced. One of them is a typedef in vb_ext.h
which I think seems alright.
The other warnings in vb_ext.c I left there because that would involve
changing a bit of the logic in the code. IMHO though I think the
functions are too complicated (i.e. the if/else are too deep within a
big function.) and can probably be split.
Signed-off-by: default avatarDaniel Kenji Toyama <kenji.toyama@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 661f659e
#include <linux/version.h> #include <linux/version.h>
#include <asm/io.h> #include <linux/io.h>
#include <linux/types.h> #include <linux/types.h>
#include "XGIfb.h" #include "XGIfb.h"
...@@ -26,7 +26,9 @@ static unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo) ...@@ -26,7 +26,9 @@ static unsigned char XGINew_Is301B(struct vb_device_info *pVBInfo)
return 1; 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; unsigned short temp, i, tempch;
...@@ -50,7 +52,9 @@ static unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx, ...@@ -50,7 +52,9 @@ static unsigned char XGINew_Sense(unsigned short tempbx, unsigned short tempcx,
return 0; 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; unsigned short temp;
...@@ -154,7 +158,9 @@ static unsigned char XGINew_GetPanelID(struct vb_device_info *pVBInfo) ...@@ -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; unsigned short flag;
...@@ -170,7 +176,9 @@ static unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceEx ...@@ -170,7 +176,9 @@ static unsigned char XGINew_BridgeIsEnable(struct xgi_hw_device_info *HwDeviceEx
return 0; 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; unsigned short tempbx, tempcx, temp, i, tempch;
...@@ -238,21 +246,29 @@ static unsigned char XGINew_SenseHiTV(struct xgi_hw_device_info *HwDeviceExtensi ...@@ -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, unsigned short tempax = 0, tempbx, tempcx, temp,
OutputSelect = *pVBInfo->pOutputSelect, ModeIdIndex, i; P2reg0 = 0, SenseModeNo = 0,
OutputSelect = *pVBInfo->pOutputSelect,
ModeIdIndex, i;
pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress; pVBInfo->BaseAddr = (unsigned long) HwDeviceExtension->pjIOAddress;
if (pVBInfo->IF_DEF_LVDS == 1) { 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); tempbx = xgifb_reg_get(pVBInfo->P3c4, 0x1B);
tempax = ((tempax & 0xFE) >> 1) | (tempbx << 8); tempax = ((tempax & 0xFE) >> 1) | (tempbx << 8);
if (tempax == 0x00) { /* Get Panel id from DDC */ if (tempax == 0x00) { /* Get Panel id from DDC */
temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo); temp = XGINew_GetLCDDDCInfo(HwDeviceExtension, pVBInfo);
if (temp == 1) { /* LCD connect */ if (temp == 1) { /* LCD connect */
xgifb_reg_and_or(pVBInfo->P3d4, 0x39, 0xFF, 0x01); /* set CR39 bit0="1" */ /* set CR39 bit0="1" */
xgifb_reg_and_or(pVBInfo->P3d4, 0x37, 0xEF, 0x00); /* clean CR37 bit4="0" */ xgifb_reg_and_or(pVBInfo->P3d4,
0x39, 0xFF, 0x01);
/* clean CR37 bit4="0" */
xgifb_reg_and_or(pVBInfo->P3d4,
0x37, 0xEF, 0x00);
temp = LCDSense; temp = LCDSense;
} else { /* LCD don't connect */ } else { /* LCD don't connect */
temp = 0; temp = 0;
...@@ -273,25 +289,47 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_ ...@@ -273,25 +289,47 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xA0, temp); xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xA0, temp);
} else { } else {
if (XGI_BridgeIsOn(pVBInfo)) { if (XGI_BridgeIsOn(pVBInfo)) {
P2reg0 = xgifb_reg_get(pVBInfo->Part2Port, 0x00); P2reg0 = xgifb_reg_get(pVBInfo->Part2Port,
if (!XGINew_BridgeIsEnable(HwDeviceExtension, pVBInfo)) { 0x00);
if (!XGINew_BridgeIsEnable(HwDeviceExtension,
pVBInfo)) {
SenseModeNo = 0x2e; SenseModeNo = 0x2e;
/* xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x41); */ /* xgifb_reg_set(pVBInfo->P3d4, 0x30, 0x41);
/* XGISetModeNew(HwDeviceExtension, 0x2e); // ynlai InitMode */ * XGISetModeNew(HwDeviceExtension, 0x2e);
* // ynlai InitMode */
temp = XGI_SearchModeID(SenseModeNo, &ModeIdIndex, pVBInfo);
XGI_GetVGAType(HwDeviceExtension, pVBInfo); temp = XGI_SearchModeID(SenseModeNo,
&ModeIdIndex,
pVBInfo);
XGI_GetVGAType(HwDeviceExtension,
pVBInfo);
XGI_GetVBType(pVBInfo); XGI_GetVBType(pVBInfo);
pVBInfo->SetFlag = 0x00; pVBInfo->SetFlag = 0x00;
pVBInfo->ModeType = ModeVGA; pVBInfo->ModeType = ModeVGA;
pVBInfo->VBInfo = SetCRT2ToRAMDAC | LoadDACFlag | SetInSlaveMode; pVBInfo->VBInfo = SetCRT2ToRAMDAC |
XGI_GetLCDInfo(0x2e, ModeIdIndex, pVBInfo); LoadDACFlag |
XGI_GetTVInfo(0x2e, ModeIdIndex, pVBInfo); SetInSlaveMode;
XGI_EnableBridge(HwDeviceExtension, pVBInfo); XGI_GetLCDInfo(0x2e,
XGI_SetCRT2Group301(SenseModeNo, HwDeviceExtension, pVBInfo); ModeIdIndex,
XGI_SetCRT2ModeRegs(0x2e, HwDeviceExtension, pVBInfo); pVBInfo);
/* XGI_DisableBridge( HwDeviceExtension, pVBInfo ) ; */ XGI_GetTVInfo(0x2e,
xgifb_reg_and_or(pVBInfo->P3c4, 0x01, 0xDF, 0x20); /* Display Off 0212 */ 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++) for (i = 0; i < 20; i++)
XGI_LongWait(pVBInfo); XGI_LongWait(pVBInfo);
} }
...@@ -304,29 +342,38 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_ ...@@ -304,29 +342,38 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
tempcx = 0x0E08; tempcx = 0x0E08;
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 |= Monitor2Sense; tempax |= Monitor2Sense;
} }
if (pVBInfo->VBType & VB_XGI301C) 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; tempax |= HiTVSense;
if ((pVBInfo->VBType & VB_XGI301C)) if ((pVBInfo->VBType & VB_XGI301C))
tempax ^= (HiTVSense | YPbPrSense); tempax ^= (HiTVSense |
YPbPrSense);
} }
if (!(tempax & (HiTVSense | YPbPrSense))) { /* start */ /* start */
if (!(tempax & (HiTVSense | YPbPrSense))) {
tempbx = *pVBInfo->pYCSenseData; tempbx = *pVBInfo->pYCSenseData;
if (!(XGINew_Is301B(pVBInfo))) if (!(XGINew_Is301B(pVBInfo)))
tempbx = *pVBInfo->pYCSenseData2; tempbx = *pVBInfo->pYCSenseData2;
tempcx = 0x0604; tempcx = 0x0604;
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) { if (XGINew_Sense(tempbx,
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) tempcx,
pVBInfo)) {
if (XGINew_Sense(tempbx,
tempcx,
pVBInfo))
tempax |= SVIDEOSense; tempax |= SVIDEOSense;
} }
...@@ -337,8 +384,12 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_ ...@@ -337,8 +384,12 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
tempbx = *pVBInfo->pVideoSenseData2; tempbx = *pVBInfo->pVideoSenseData2;
tempcx = 0x0804; tempcx = 0x0804;
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) { if (XGINew_Sense(tempbx,
if (XGINew_Sense(tempbx, tempcx, pVBInfo)) tempcx,
pVBInfo)) {
if (XGINew_Sense(tempbx,
tempcx,
pVBInfo))
tempax |= AVIDEOSense; tempax |= AVIDEOSense;
} }
} else { } else {
...@@ -349,7 +400,9 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_ ...@@ -349,7 +400,9 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
tempbx = *pVBInfo->pVideoSenseData2; tempbx = *pVBInfo->pVideoSenseData2;
tempcx = 0x0804; 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; tempax |= AVIDEOSense;
} }
...@@ -370,7 +423,9 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_ ...@@ -370,7 +423,9 @@ void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_
if (!(P2reg0 & 0x20)) { if (!(P2reg0 & 0x20)) {
pVBInfo->VBInfo = DisableCRT2Display; 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_ ...@@ -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 SoftSetting ; */
unsigned short temp; unsigned short temp;
......
#ifndef _VBEXT_ #ifndef _VBEXT_
#define _VBEXT_ #define _VBEXT_
struct DWORDREGS { struct DWORDREGS {
unsigned long Eax, Ebx, Ecx, Edx, Esi, Edi, Ebp; unsigned long Eax, Ebx, Ecx, Edx, Esi, Edi, Ebp;
}; };
struct WORDREGS { struct WORDREGS {
unsigned short ax, hi_ax, bx, hi_bx, cx, hi_cx, dx, hi_dx, si, unsigned short ax, hi_ax, bx, hi_bx, cx, hi_cx, dx, hi_dx, si,
hi_si, di, hi_di, bp, hi_bp; hi_si, di, hi_di, bp, hi_bp;
}; };
struct BYTEREGS { struct BYTEREGS {
unsigned char al, ah, hi_al, hi_ah, bl, bh, hi_bl, hi_bh, cl, ch, unsigned char al, ah, hi_al, hi_ah, bl, bh, hi_bl, hi_bh, cl, ch,
hi_cl, hi_ch, dl, dh, hi_dl, hi_dh; hi_cl, hi_ch, dl, dh, hi_dl, hi_dh;
}; };
typedef union _X86_REGS { typedef union _X86_REGS {
struct DWORDREGS e; struct DWORDREGS e;
struct WORDREGS x; struct WORDREGS x;
struct BYTEREGS h; struct BYTEREGS h;
} X86_REGS, *PX86_REGS; } X86_REGS, *PX86_REGS;
extern void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, struct vb_device_info *pVBInfo); extern void XGI_GetSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
struct vb_device_info *pVBInfo);
extern unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *, extern unsigned short XGINew_SenseLCD(struct xgi_hw_device_info *,
struct vb_device_info *pVBInfo); struct vb_device_info *pVBInfo);
......
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