[PATCH xf86-video-trident 3/4] Fix indentation of tridenthelper.c
Kevin Brace
kevinbrace at gmx.com
Sat May 11 03:22:23 UTC 2019
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
src/tridenthelper.c | 156 ++++++++++++++++++++++----------------------
1 file changed, 77 insertions(+), 79 deletions(-)
diff --git a/src/tridenthelper.c b/src/tridenthelper.c
index c0ca069..f94268e 100644
--- a/src/tridenthelper.c
+++ b/src/tridenthelper.c
@@ -1,23 +1,25 @@
/*
* Copyright 1992-2003 by Alan Hourihane, North Wales, UK.
*
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of Alan
+ * Hourihane not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Alan Hourihane makes no representations about the
+ * suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
+ * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
*
* Author: Alan Hourihane, alanh at fairlite.demon.co.uk
*/
@@ -41,7 +43,7 @@ void
TGUISetClock(ScrnInfoPtr pScrn, int clock, CARD8 *a, CARD8 *b)
{
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
- int powerup[4] = { 1,2,4,8 };
+ int powerup[4] = { 1, 2, 4, 8 };
int clock_diff = 750;
int freq, ffreq;
int m, n, k;
@@ -52,17 +54,14 @@ TGUISetClock(ScrnInfoPtr pScrn, int clock, CARD8 *a, CARD8 *b)
IsClearTV(pScrn);
- if (pTrident->NewClockCode)
- {
+ if (pTrident->NewClockCode) {
endn = 255;
endm = 63;
endk = 2;
if (clock >= 100000) startk = 0; else
if (clock >= 50000) startk = 1; else
startk = 2;
- }
- else
- {
+ } else {
endn = 121;
endm = 31;
endk = 1;
@@ -72,22 +71,26 @@ TGUISetClock(ScrnInfoPtr pScrn, int clock, CARD8 *a, CARD8 *b)
freq = clock;
- for (k=startk;k<=endk;k++)
- for (n=0;n<=endn;n++)
- for (m=1;m<=endm;m++)
- {
- ffreq = ( ( ((n + 8) * pTrident->frequency) / ((m + 2) * powerup[k]) ) * 1000);
- if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff))
- {
+ for (k = startk; k <= endk; k++)
+ for (n = 0; n <= endn; n++)
+ for (m = 1; m <= endm; m++) {
+ ffreq = ((((n + 8) * pTrident->frequency) /
+ ((m + 2) * powerup[k])) * 1000);
+ if ((ffreq > freq - clock_diff) &&
+ (ffreq < freq + clock_diff)) {
/*
- * It seems that the 9440 docs have this STRICT limitation, although
- * most 9440 boards seem to cope. 96xx/Cyber chips don't need this limit
- * so, I'm gonna remove it and it allows lower clocks < 25.175 too !
+ * It seems that the 9440 docs have this STRICT
+ * limitation, although most 9440 boards seem to
+ * cope. 96xx/Cyber chips don't need this limit
+ * so, I'm gonna remove it and it allows lower
+ * clocks < 25.175 too!
*/
#ifdef STRICT
- if ( (n+8)*100/(m+2) < 978 && (n+8)*100/(m+2) > 349 ) {
+ if ((n + 8) * 100 / (m + 2) < 978 &&
+ (n + 8) * 100 / (m + 2) > 349) {
#endif
- clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq;
+ clock_diff = (freq > ffreq) ?
+ freq - ffreq : ffreq - freq;
p = n; q = m; r = k; s = ffreq;
#ifdef STRICT
}
@@ -95,30 +98,27 @@ TGUISetClock(ScrnInfoPtr pScrn, int clock, CARD8 *a, CARD8 *b)
}
}
- if (s == 0)
- {
+ if (s == 0) {
FatalError("Unable to set programmable clock.\n"
"Frequency %d is not a valid clock.\n"
"Please modify XF86Config for a new clock.\n",
freq);
}
- if (pTrident->NewClockCode)
- {
+ if (pTrident->NewClockCode) {
/* N is all 8bits */
*a = p;
/* M is first 6bits, with K last 2bits */
*b = (q & 0x3F) | (r << 6);
- }
- else
- {
+ } else {
/* N is first 7bits, first M bit is 8th bit */
*a = ((1 & q) << 7) | p;
/* first 4bits are rest of M, 1bit for K value */
*b = (((q & 0xFE) >> 1) | (r << 4));
}
- xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,"Found Clock %6.2f n=%i m=%i"
- " k=%i\n",clock/1000.,p,q,r);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "Found Clock %6.2f n=%i m=%i k=%i\n",
+ clock/1000., p, q, r);
}
static void
@@ -159,9 +159,9 @@ TridentFindClock(ScrnInfoPtr pScrn, int clock)
OUTB(0x3CE, FPConfig);
LCDActive = (INB(0x3CF) & 0x10);
#ifdef READOUT
- OUTB(0x3CE,HorStretch);
+ OUTB(0x3CE, HorStretch);
HStretch = (INB(0x3CF) & 0x01);
- OUTB(0x3CE,VertStretch);
+ OUTB(0x3CE, VertStretch);
VStretch = (INB(0x3CF) & 0x01);
if (!(VStretch || HStretch) && LCDActive) {
@@ -174,21 +174,24 @@ TridentFindClock(ScrnInfoPtr pScrn, int clock)
pTrident->MUX = ((INB(0x3C6) & 0x20) == 0x20);
temp = INB(0x3C8);
pTrident->DontSetClock = TRUE;
- xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Keeping Clock for LCD Mode\n");
- xf86DrvMsg(pScrn->scrnIndex,X_INFO,"MUX is %s\n",pTrident->MUX?
- "on":"off");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Keeping Clock for LCD Mode\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "MUX is %s\n",
+ pTrident->MUX ? "on" : "off");
return;
} else
#endif
{
if (pTrident->lcdMode != 0xff && LCDActive)
- pTrident->currentClock = clock = LCD[pTrident->lcdMode].clock;
+ pTrident->currentClock = clock =
+ LCD[pTrident->lcdMode].clock;
}
}
#ifndef READOUT
- if (pTrident->Chipset != BLADEXP
- && clock > pTrident->MUXThreshold)
+ if (pTrident->Chipset != BLADEXP &&
+ clock > pTrident->MUXThreshold)
pTrident->MUX = TRUE;
else
pTrident->MUX = FALSE;
@@ -200,10 +203,10 @@ CalculateMCLK(ScrnInfoPtr pScrn)
{
int vgaIOBase = VGAHWPTR(pScrn)->IOBase;
TRIDENTPtr pTrident = TRIDENTPTR(pScrn);
- int a,b;
- int m,n,k;
+ int a, b;
+ int m, n, k;
float freq = 0.0;
- int powerup[4] = { 1,2,4,8 };
+ int powerup[4] = { 1, 2, 4, 8 };
CARD8 temp;
if (pTrident->HasSGRAM) {
@@ -261,11 +264,13 @@ CalculateMCLK(ScrnInfoPtr pScrn)
} else {
m = (a & 0x07);
k = (b & 0x02) >> 1;
- n = ((a & 0xF8)>>3)|((b&0x01)<<5);
+ n = ((a & 0xF8) >> 3) | ((b&0x01) << 5);
}
- freq = ((n+8)*pTrident->frequency)/((m+2)*powerup[k]);
+ freq = ((n + 8) * pTrident->frequency) /
+ ((m + 2) * powerup[k]);
}
+
return (freq);
}
@@ -285,15 +290,12 @@ TGUISetMCLK(ScrnInfoPtr pScrn, int clock, CARD8 *a, CARD8 *b)
IsClearTV(pScrn);
- if (pTrident->NewClockCode)
- {
+ if (pTrident->NewClockCode) {
startn = 64;
endn = 255;
endm = 63;
endk = 3;
- }
- else
- {
+ } else {
startn = 0;
endn = 121;
endm = 31;
@@ -303,35 +305,35 @@ TGUISetMCLK(ScrnInfoPtr pScrn, int clock, CARD8 *a, CARD8 *b)
freq = clock;
if (!pTrident->HasSGRAM) {
- for (k=0;k<=endk;k++) {
- for (n=startn;n<=endn;n++) {
- for (m=1;m<=endm;m++) {
- ffreq = ((((n+8)*pTrident->frequency)/((m+2)*powerup[k]))*1000);
- if ((ffreq > freq - clock_diff) && (ffreq < freq + clock_diff)) {
- clock_diff = (freq > ffreq) ? freq - ffreq : ffreq - freq;
+ for (k = 0; k <= endk; k++) {
+ for (n = startn; n <= endn; n++) {
+ for (m = 1;m <= endm; m++) {
+ ffreq = ((((n + 8) * pTrident->frequency) /
+ ((m + 2) * powerup[k])) * 1000);
+ if ((ffreq > freq - clock_diff) &&
+ (ffreq < freq + clock_diff)) {
+ clock_diff = (freq > ffreq) ?
+ freq - ffreq : ffreq - freq;
p = n; q = m; r = k; s = ffreq;
}
}
}
}
- if (s == 0)
- {
+ if (s == 0) {
FatalError("Unable to set memory clock.\n"
- "Frequency %d is not a valid clock.\n"
- "Please modify XF86Config for a new clock.\n",
- freq);
+ "Frequency %d is not a valid clock.\n"
+ "Please modify XF86Config for a new clock.\n",
+ freq);
}
- if (pTrident->NewClockCode)
- {
+ if (pTrident->NewClockCode) {
/* N is all 8bits */
*a = p;
/* M is first 6bits, with K last 2bits */
*b = (q & 0x3F) | (r << 6);
}
- else
- {
+ else {
/* N is first 7bits, first M bit is 8th bit */
*a = ((1 & q) << 7) | p;
/* first 4bits are rest of M, 1bit for K value */
@@ -339,7 +341,3 @@ TGUISetMCLK(ScrnInfoPtr pScrn, int clock, CARD8 *a, CARD8 *b)
}
}
}
-
-
-
-
--
2.17.1
More information about the xorg-devel
mailing list