summaryrefslogtreecommitdiff
path: root/src/g80_display.c
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2007-03-09 12:43:12 -0800
committerAaron Plattner <aplattner@nvidia.com>2007-03-09 12:43:12 -0800
commit8b2c7bc457d34b7ed59cd08719bec8754ebf6fb8 (patch)
treee4358464752acd35be48e86e00f8c073f41a07a4 /src/g80_display.c
parent06b168ced3cc4aa47cdad21a2351cca674fa26e0 (diff)
Use DAC load detection to decide which OR to use instead of trusting the EDID.
Diffstat (limited to 'src/g80_display.c')
-rw-r--r--src/g80_display.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/g80_display.c b/src/g80_display.c
index 5ff3514..068e902 100644
--- a/src/g80_display.c
+++ b/src/g80_display.c
@@ -187,6 +187,28 @@ G80DispCommand(G80Ptr pNv, CARD32 addr, CARD32 data)
#define C(mthd, data) G80DispCommand(pNv, (mthd), (data))
/*
+ * Performs load detection on a single DAC.
+ */
+Bool G80DispDetectLoad(ScrnInfoPtr pScrn, ORNum or)
+{
+ G80Ptr pNv = G80PTR(pScrn);
+ const int dacOff = 2048 * or;
+ CARD32 load, tmp;
+
+ pNv->reg[(0x0061A010+dacOff)/4] = 0x00000001;
+ pNv->reg[(0x0061A004+dacOff)/4] = 0x80150000;
+ while(pNv->reg[(0x0061A004+dacOff)/4] & 0x80000000);
+ tmp = pNv->architecture == 0x50 ? 420 : 340;
+ pNv->reg[(0x0061A00C+dacOff)/4] = tmp | 0x100000;
+ usleep(4500);
+ load = pNv->reg[(0x0061A00C+dacOff)/4];
+ pNv->reg[(0x0061A00C+dacOff)/4] = 0;
+ pNv->reg[(0x0061A004+dacOff)/4] = 0x80550000;
+
+ return (load & 0x38000000) == 0x38000000;
+}
+
+/*
* Performs load detection on the DACs. Sets pNv->orType and pNv->or
* accordingly.
*/
@@ -199,21 +221,9 @@ Bool G80LoadDetect(ScrnInfoPtr pScrn)
pNv->orType = DAC;
for(or = DAC0; or <= DAC2; or++) {
- const int dacOff = 2048 * or;
- CARD32 load, tmp;
-
xf86DrvMsg(scrnIndex, X_PROBED, "Trying load detection on DAC%i ... ", or);
- pNv->reg[(0x0061A010+dacOff)/4] = 0x00000001;
- pNv->reg[(0x0061A004+dacOff)/4] = 0x80150000;
- while(pNv->reg[(0x0061A004+dacOff)/4] & 0x80000000);
- tmp = pNv->architecture == 0x50 ? 420 : 340;
- pNv->reg[(0x0061A00C+dacOff)/4] = tmp | 0x100000;
- usleep(4500);
- load = pNv->reg[(0x0061A00C+dacOff)/4];
- pNv->reg[(0x0061A00C+dacOff)/4] = 0;
- pNv->reg[(0x0061A004+dacOff)/4] = 0x80550000;
- if((load & 0x38000000) == 0x38000000) {
+ if(G80DispDetectLoad(pScrn, or)) {
xf86ErrorF("found one!\n");
pNv->or = or;
return TRUE;