summaryrefslogtreecommitdiff
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
parent06b168ced3cc4aa47cdad21a2351cca674fa26e0 (diff)
Use DAC load detection to decide which OR to use instead of trusting the EDID.
-rw-r--r--src/g80_ddc.c25
-rw-r--r--src/g80_display.c36
-rw-r--r--src/g80_display.h1
3 files changed, 35 insertions, 27 deletions
diff --git a/src/g80_ddc.c b/src/g80_ddc.c
index 3713028..bcc4bff 100644
--- a/src/g80_ddc.c
+++ b/src/g80_ddc.c
@@ -197,22 +197,19 @@ Bool G80ProbeDDC(ScrnInfoPtr pScrn)
flatPanel = (monInfo->features.input_type == 1);
- if(flatPanel) {
- if(pNv->i2cMap[port].sor == -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Saw a flat panel EDID "
- "on I2C port %i but no SOR outputs were registered for "
- "that port.\n", port);
- continue;
- }
+ if(pNv->i2cMap[port].dac != -1 &&
+ G80DispDetectLoad(pScrn, pNv->i2cMap[port].dac)) {
+ pNv->orType = DAC;
+ pNv->or = pNv->i2cMap[port].dac;
+ } else if(pNv->i2cMap[port].sor != -1) {
pNv->orType = SOR;
pNv->or = pNv->i2cMap[port].sor;
} else {
- if(pNv->i2cMap[port].dac == -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Saw a flat panel EDID "
- "on I2C port %i but no DAC outputs were registered for "
- "that port.\n", port);
- continue;
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Saw an EDID on I2C port %i but no DAC load was "
+ "detected and no SOR is connected to this port. Using "
+ "DAC%i.\n", port,
+ pNv->or);
pNv->orType = DAC;
pNv->or = pNv->i2cMap[port].dac;
}
@@ -220,7 +217,7 @@ Bool G80ProbeDDC(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Found a %s on I2C port %i, assigning %s%i\n",
flatPanel ? "flat panel" : "CRT",
- port, flatPanel ? "SOR" : "DAC", pNv->or);
+ port, pNv->orType == SOR ? "SOR" : "DAC", pNv->or);
pScrn->monitor->DDC = monInfo;
xf86SetDDCproperties(pScrn, monInfo);
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;
diff --git a/src/g80_display.h b/src/g80_display.h
index aec6314..cbe312f 100644
--- a/src/g80_display.h
+++ b/src/g80_display.h
@@ -1,4 +1,5 @@
Bool G80LoadDetect(ScrnInfoPtr);
+Bool G80DispLoadDetect(ScrnInfoPtr, ORNum or);
Bool G80DispInit(ScrnInfoPtr);
Bool G80DispSetMode(ScrnInfoPtr, DisplayModePtr);
void G80DispShutdown(ScrnInfoPtr);