USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_init.c

Better indentation

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Felipe Balbi 2007-08-10 09:34:31 -04:00 committed by Greg Kroah-Hartman
parent 1c1772a260
commit 22b2c526e7

View File

@ -55,8 +55,7 @@
/* POINTER INITIALIZATION */ /* POINTER INITIALIZATION */
/*********************************************/ /*********************************************/
static void static void SiSUSB_InitPtr(struct SiS_Private *SiS_Pr)
SiSUSB_InitPtr(struct SiS_Private *SiS_Pr)
{ {
SiS_Pr->SiS_ModeResInfo = SiSUSB_ModeResInfo; SiS_Pr->SiS_ModeResInfo = SiSUSB_ModeResInfo;
SiS_Pr->SiS_StandTable = SiSUSB_StandTable; SiS_Pr->SiS_StandTable = SiSUSB_StandTable;
@ -88,8 +87,7 @@ SiS_SetRegByte(struct SiS_Private *SiS_Pr, unsigned long port,
} }
static unsigned char static unsigned char
SiS_GetReg(struct SiS_Private *SiS_Pr, unsigned long port, SiS_GetReg(struct SiS_Private *SiS_Pr, unsigned long port, unsigned short index)
unsigned short index)
{ {
u8 data; u8 data;
@ -134,8 +132,7 @@ SiS_SetRegOR(struct SiS_Private *SiS_Pr,unsigned long port,
/* HELPER: DisplayOn, DisplayOff */ /* HELPER: DisplayOn, DisplayOff */
/*********************************************/ /*********************************************/
static void static void SiS_DisplayOn(struct SiS_Private *SiS_Pr)
SiS_DisplayOn(struct SiS_Private *SiS_Pr)
{ {
SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x01, 0xDF); SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3c4, 0x01, 0xDF);
} }
@ -144,8 +141,7 @@ SiS_DisplayOn(struct SiS_Private *SiS_Pr)
/* HELPER: Init Port Addresses */ /* HELPER: Init Port Addresses */
/*********************************************/ /*********************************************/
static void static void SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr)
SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr)
{ {
SiS_Pr->SiS_P3c4 = BaseAddr + 0x14; SiS_Pr->SiS_P3c4 = BaseAddr + 0x14;
SiS_Pr->SiS_P3d4 = BaseAddr + 0x24; SiS_Pr->SiS_P3d4 = BaseAddr + 0x24;
@ -168,8 +164,7 @@ SiSUSBRegInit(struct SiS_Private *SiS_Pr, unsigned long BaseAddr)
/* HELPER: GetSysFlags */ /* HELPER: GetSysFlags */
/*********************************************/ /*********************************************/
static void static void SiS_GetSysFlags(struct SiS_Private *SiS_Pr)
SiS_GetSysFlags(struct SiS_Private *SiS_Pr)
{ {
SiS_Pr->SiS_MyCR63 = 0x63; SiS_Pr->SiS_MyCR63 = 0x63;
} }
@ -178,8 +173,7 @@ SiS_GetSysFlags(struct SiS_Private *SiS_Pr)
/* HELPER: Init PCI & Engines */ /* HELPER: Init PCI & Engines */
/*********************************************/ /*********************************************/
static void static void SiSInitPCIetc(struct SiS_Private *SiS_Pr)
SiSInitPCIetc(struct SiS_Private *SiS_Pr)
{ {
SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x20, 0xa1); SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x20, 0xa1);
/* - Enable 2D (0x40) /* - Enable 2D (0x40)
@ -195,8 +189,7 @@ SiSInitPCIetc(struct SiS_Private *SiS_Pr)
/* HELPER: SET SEGMENT REGISTERS */ /* HELPER: SET SEGMENT REGISTERS */
/*********************************************/ /*********************************************/
static void static void SiS_SetSegRegLower(struct SiS_Private *SiS_Pr, unsigned short value)
SiS_SetSegRegLower(struct SiS_Private *SiS_Pr, unsigned short value)
{ {
unsigned short temp; unsigned short temp;
@ -209,8 +202,7 @@ SiS_SetSegRegLower(struct SiS_Private *SiS_Pr, unsigned short value)
SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3cd, temp); SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3cd, temp);
} }
static void static void SiS_SetSegRegUpper(struct SiS_Private *SiS_Pr, unsigned short value)
SiS_SetSegRegUpper(struct SiS_Private *SiS_Pr, unsigned short value)
{ {
unsigned short temp; unsigned short temp;
@ -223,15 +215,13 @@ SiS_SetSegRegUpper(struct SiS_Private *SiS_Pr, unsigned short value)
SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3cd, temp); SiS_SetRegByte(SiS_Pr, SiS_Pr->SiS_P3cd, temp);
} }
static void static void SiS_SetSegmentReg(struct SiS_Private *SiS_Pr, unsigned short value)
SiS_SetSegmentReg(struct SiS_Private *SiS_Pr, unsigned short value)
{ {
SiS_SetSegRegLower(SiS_Pr, value); SiS_SetSegRegLower(SiS_Pr, value);
SiS_SetSegRegUpper(SiS_Pr, value); SiS_SetSegRegUpper(SiS_Pr, value);
} }
static void static void SiS_ResetSegmentReg(struct SiS_Private *SiS_Pr)
SiS_ResetSegmentReg(struct SiS_Private *SiS_Pr)
{ {
SiS_SetSegmentReg(SiS_Pr, 0); SiS_SetSegmentReg(SiS_Pr, 0);
} }
@ -247,14 +237,12 @@ SiS_SetSegmentRegOver(struct SiS_Private *SiS_Pr, unsigned short value)
SiS_SetSegmentReg(SiS_Pr, value); SiS_SetSegmentReg(SiS_Pr, value);
} }
static void static void SiS_ResetSegmentRegOver(struct SiS_Private *SiS_Pr)
SiS_ResetSegmentRegOver(struct SiS_Private *SiS_Pr)
{ {
SiS_SetSegmentRegOver(SiS_Pr, 0); SiS_SetSegmentRegOver(SiS_Pr, 0);
} }
static void static void SiS_ResetSegmentRegisters(struct SiS_Private *SiS_Pr)
SiS_ResetSegmentRegisters(struct SiS_Private *SiS_Pr)
{ {
SiS_ResetSegmentReg(SiS_Pr); SiS_ResetSegmentReg(SiS_Pr);
SiS_ResetSegmentRegOver(SiS_Pr); SiS_ResetSegmentRegOver(SiS_Pr);
@ -279,10 +267,12 @@ SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo,
for (*ModeIdIndex = 0;; (*ModeIdIndex)++) { for (*ModeIdIndex = 0;; (*ModeIdIndex)++) {
if (SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == (*ModeNo)) if (SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID ==
(*ModeNo))
break; break;
if (SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF) if (SiS_Pr->SiS_EModeIDTable[*ModeIdIndex].Ext_ModeID ==
0xFF)
return 0; return 0;
} }
@ -295,8 +285,7 @@ SiS_SearchModeID(struct SiS_Private *SiS_Pr, unsigned short *ModeNo,
/* HELPER: ENABLE CRT1 */ /* HELPER: ENABLE CRT1 */
/*********************************************/ /*********************************************/
static void static void SiS_HandleCRT1(struct SiS_Private *SiS_Pr)
SiS_HandleCRT1(struct SiS_Private *SiS_Pr)
{ {
/* Enable CRT1 gating */ /* Enable CRT1 gating */
SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3d4, SiS_Pr->SiS_MyCR63, 0xbf); SiS_SetRegAND(SiS_Pr, SiS_Pr->SiS_P3d4, SiS_Pr->SiS_MyCR63, 0xbf);
@ -321,7 +310,8 @@ SiS_GetColorDepth(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
} }
index = (modeflag & ModeTypeMask) - ModeEGA; index = (modeflag & ModeTypeMask) - ModeEGA;
if (index < 0) index = 0; if (index < 0)
index = 0;
return ColorDepth[index]; return ColorDepth[index];
} }
@ -454,8 +444,7 @@ SiS_SetGRCRegs(struct SiS_Private *SiS_Pr, unsigned short StandTableIndex)
/* CLEAR EXTENDED REGISTERS */ /* CLEAR EXTENDED REGISTERS */
/*********************************************/ /*********************************************/
static void static void SiS_ClearExt1Regs(struct SiS_Private *SiS_Pr, unsigned short ModeNo)
SiS_ClearExt1Regs(struct SiS_Private *SiS_Pr, unsigned short ModeNo)
{ {
int i; int i;
@ -480,7 +469,8 @@ SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
return 0xFFFF; return 0xFFFF;
index = SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x33) & 0x0F; index = SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x33) & 0x0F;
if (index > 0) index--; if (index > 0)
index--;
rrti = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex; rrti = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
ModeNo = SiS_Pr->SiS_RefIndex[rrti].ModeID; ModeNo = SiS_Pr->SiS_RefIndex[rrti].ModeID;
@ -490,7 +480,8 @@ SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
if (SiS_Pr->SiS_RefIndex[rrti + i].ModeID != ModeNo) if (SiS_Pr->SiS_RefIndex[rrti + i].ModeID != ModeNo)
break; break;
temp = SiS_Pr->SiS_RefIndex[rrti + i].Ext_InfoFlag & ModeTypeMask; temp =
SiS_Pr->SiS_RefIndex[rrti + i].Ext_InfoFlag & ModeTypeMask;
if (temp < SiS_Pr->SiS_ModeType) if (temp < SiS_Pr->SiS_ModeType)
break; break;
@ -507,8 +498,7 @@ SiS_GetRatePtr(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
/* SYNC */ /* SYNC */
/*********************************************/ /*********************************************/
static void static void SiS_SetCRT1Sync(struct SiS_Private *SiS_Pr, unsigned short rrti)
SiS_SetCRT1Sync(struct SiS_Private *SiS_Pr, unsigned short rrti)
{ {
unsigned short sync = SiS_Pr->SiS_RefIndex[rrti].Ext_InfoFlag >> 8; unsigned short sync = SiS_Pr->SiS_RefIndex[rrti].Ext_InfoFlag >> 8;
sync &= 0xC0; sync &= 0xC0;
@ -554,7 +544,8 @@ SiS_SetCRT1CRTC(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0E, temp); SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0E, temp);
temp = ((SiS_Pr->SiS_CRT1Table[index].CR[16]) & 0x01) << 5; temp = ((SiS_Pr->SiS_CRT1Table[index].CR[16]) & 0x01) << 5;
if (modeflag & DoubleScanMode) temp |= 0x80; if (modeflag & DoubleScanMode)
temp |= 0x80;
SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3d4, 0x09, 0x5F, temp); SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3d4, 0x09, 0x5F, temp);
if (SiS_Pr->SiS_ModeType > ModeVGA) if (SiS_Pr->SiS_ModeType > ModeVGA)
@ -580,11 +571,13 @@ SiS_SetCRT1Offset(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x13, (du & 0xFF)); SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x13, (du & 0xFF));
if (infoflag & InterlaceMode) du >>= 1; if (infoflag & InterlaceMode)
du >>= 1;
du <<= 5; du <<= 5;
temp = (du >> 8) & 0xff; temp = (du >> 8) & 0xff;
if (du & 0xff) temp++; if (du & 0xff)
temp++;
temp++; temp++;
SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x10, temp); SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x10, temp);
} }
@ -648,7 +641,8 @@ SiS_SetVCLKState(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK;
} }
if (VCLK >= 166) data |= 0x0c; if (VCLK >= 166)
data |= 0x0c;
SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x32, 0xf3, data); SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x32, 0xf3, data);
if (VCLK >= 166) if (VCLK >= 166)
@ -688,17 +682,22 @@ SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
data |= 0x02; data |= 0x02;
data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2); data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2);
} }
if (infoflag & InterlaceMode) data |= 0x20; if (infoflag & InterlaceMode)
data |= 0x20;
} }
SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x06, 0xC0, data); SiS_SetRegANDOR(SiS_Pr, SiS_Pr->SiS_P3c4, 0x06, 0xC0, data);
data = 0; data = 0;
if (infoflag & InterlaceMode) { if (infoflag & InterlaceMode) {
/* data = (Hsync / 8) - ((Htotal / 8) / 2) + 3 */ /* data = (Hsync / 8) - ((Htotal / 8) / 2) + 3 */
unsigned short hrs = (SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x04) | unsigned short hrs =
((SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0b) & 0xc0) << 2)) - 3; (SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x04) |
unsigned short hto = (SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x00) | ((SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0b) & 0xc0) << 2))
((SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0b) & 0x03) << 8)) + 5; - 3;
unsigned short hto =
(SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x00) |
((SiS_GetReg(SiS_Pr, SiS_Pr->SiS_P3c4, 0x0b) & 0x03) << 8))
+ 5;
data = hrs - (hto >> 1) + 3; data = hrs - (hto >> 1) + 3;
} }
SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x19, (data & 0xFF)); SiS_SetReg(SiS_Pr, SiS_Pr->SiS_P3d4, 0x19, (data & 0xFF));
@ -746,13 +745,19 @@ SiS_WriteDAC(struct SiS_Private *SiS_Pr, unsigned long DACData,
switch (dl) { switch (dl) {
case 0: case 0:
d1 = dh; d2 = ah; d3 = al; d1 = dh;
d2 = ah;
d3 = al;
break; break;
case 1: case 1:
d1 = ah; d2 = al; d3 = dh; d1 = ah;
d2 = al;
d3 = dh;
break; break;
default: default:
d1 = al; d2 = dh; d3 = ah; d1 = al;
d2 = dh;
d3 = ah;
} }
SiS_SetRegByte(SiS_Pr, DACData, (d1 << shiftflag)); SiS_SetRegByte(SiS_Pr, DACData, (d1 << shiftflag));
SiS_SetRegByte(SiS_Pr, DACData, (d2 << shiftflag)); SiS_SetRegByte(SiS_Pr, DACData, (d2 << shiftflag));
@ -760,7 +765,8 @@ SiS_WriteDAC(struct SiS_Private *SiS_Pr, unsigned long DACData,
} }
static void static void
SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short mi) SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
unsigned short mi)
{ {
unsigned short data, data2, time, i, j, k, m, n, o; unsigned short data, data2, time, i, j, k, m, n, o;
unsigned short si, di, bx, sf; unsigned short si, di, bx, sf;
@ -798,8 +804,10 @@ SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short mi
data = table[i]; data = table[i];
for (k = 0; k < 3; k++) { for (k = 0; k < 3; k++) {
data2 = 0; data2 = 0;
if (data & 0x01) data2 += 0x2A; if (data & 0x01)
if (data & 0x02) data2 += 0x15; data2 += 0x2A;
if (data & 0x02)
data2 += 0x15;
SiS_SetRegByte(SiS_Pr, DACData, (data2 << sf)); SiS_SetRegByte(SiS_Pr, DACData, (data2 << sf));
data >>= 2; data >>= 2;
} }
@ -818,13 +826,15 @@ SiS_LoadDAC(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned short mi
for (n = 0; n < 3; n++) { for (n = 0; n < 3; n++) {
for (o = 0; o < 5; o++) { for (o = 0; o < 5; o++) {
SiS_WriteDAC(SiS_Pr, DACData, sf, n, SiS_WriteDAC(SiS_Pr, DACData, sf, n,
table[di], table[bx], table[si]); table[di], table[bx],
table[si]);
si++; si++;
} }
si -= 2; si -= 2;
for (o = 0; o < 3; o++) { for (o = 0; o < 3; o++) {
SiS_WriteDAC(SiS_Pr, DACData, sf, n, SiS_WriteDAC(SiS_Pr, DACData, sf, n,
table[di], table[si], table[bx]); table[di], table[si],
table[bx]);
si--; si--;
} }
} }
@ -880,8 +890,7 @@ SiS_SetCRT1Group(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
/* SiSSetMode() */ /* SiSSetMode() */
/*********************************************/ /*********************************************/
int int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo)
SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo)
{ {
unsigned short ModeIdIndex; unsigned short ModeIdIndex;
unsigned long BaseAddr = SiS_Pr->IOAddress; unsigned long BaseAddr = SiS_Pr->IOAddress;
@ -918,8 +927,7 @@ SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo)
return 1; return 1;
} }
int int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo)
SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo)
{ {
unsigned short ModeNo = 0; unsigned short ModeNo = 0;
int i; int i;
@ -951,7 +959,3 @@ SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo)
} }
#endif /* INCL_SISUSB_CON */ #endif /* INCL_SISUSB_CON */