52 #include <linux/pci.h>
53 #include <linux/slab.h>
167 static int NVIsConnected(
struct nvidia_par *par,
int output)
170 u32 reg52C, reg608, dac0_reg608 = 0;
174 dac0_reg608 =
NV_RD32(PRAMDAC, 0x0608);
178 reg52C =
NV_RD32(PRAMDAC, 0x052C);
179 reg608 =
NV_RD32(PRAMDAC, 0x0608);
181 NV_WR32(PRAMDAC, 0x0608, reg608 & ~0x00010000);
183 NV_WR32(PRAMDAC, 0x052C, reg52C & 0x0000FEEE);
193 present = (
NV_RD32(PRAMDAC, 0x0608) & (1 << 28)) ? 1 : 0;
196 printk(
"nvidiafb: CRTC%i analog found\n", output);
198 printk(
"nvidiafb: CRTC%i analog not found\n", output);
203 NV_WR32(PRAMDAC, 0x052C, reg52C);
204 NV_WR32(PRAMDAC, 0x0608, reg608);
209 static void NVSelectHeadRegisters(
struct nvidia_par *par,
int head)
224 static void nv4GetConfig(
struct nvidia_par *par)
228 ((
NV_RD32(par->
PFB, 0x0000) >> 12) & 0x0F) * 1024 * 2 +
231 switch (
NV_RD32(par->
PFB, 0x0000) & 0x00000003) {
254 static void nv10GetConfig(
struct nvidia_par *par)
261 if (!(
NV_RD32(par->
PMC, 0x0004) & 0x01000001)) {
268 if ((par->
Chipset & 0xffff) == 0x01a0) {
271 pci_read_config_dword(dev, 0x7c, &amt);
273 }
else if ((par->
Chipset & 0xffff) == 0x01f0) {
276 pci_read_config_dword(dev, 0x84, &amt);
280 (
NV_RD32(par->
PFB, 0x020C) & 0xFFF00000) >> 10;
287 if (par->
twoHeads && (implementation != 0x0110)) {
316 if (!var || !monitorA || !monitorB) {
324 par->
PFB = par->
REGS + (0x00100000 / 4);
325 par->
PFIFO = par->
REGS + (0x00002000 / 4);
329 par->
PMC = par->
REGS + (0x00000000 / 4);
330 par->
FIFO = par->
REGS + (0x00800000 / 4);
338 (implementation != 0x0100) &&
339 (implementation != 0x0150) &&
340 (implementation != 0x01A0) && (implementation != 0x0200);
343 (implementation != 0x0110));
349 (implementation != 0x0100);
354 switch (par->
Chipset & 0xffff) {
414 NVSelectHeadRegisters(par, 0);
428 printk(
"nvidiafb: EDID found from BUS1\n");
434 if ((par->
Chipset & 0x0fff) <= 0x0020)
446 printk(
"nvidiafb: HW is currently programmed for %s\n",
447 FlatPanel ? (Television ?
"TV" :
"DFP") :
455 printk(
"nvidiafb: Forcing display type to %s as "
456 "specified\n", par->
FlatPanel ?
"DFP" :
"CRT");
459 u8 outputAfromCRTC, outputBfromCRTC;
461 u8 slaved_on_A, slaved_on_B;
462 int analog_on_A, analog_on_B;
466 if (implementation != 0x0110) {
475 analog_on_A = NVIsConnected(par, 0);
476 analog_on_B = NVIsConnected(par, 1);
488 NVSelectHeadRegisters(par, 1);
500 NVSelectHeadRegisters(par, 0);
516 printk(
"nvidiafb: EDID found from BUS1\n");
524 printk(
"nvidiafb: EDID found from BUS2\n");
529 if (slaved_on_A && !tvA) {
532 printk(
"nvidiafb: CRTC 0 is currently programmed for "
534 }
else if (slaved_on_B && !tvB) {
537 printk(
"nvidiafb: CRTC 1 is currently programmed "
539 }
else if (analog_on_A) {
540 CRTCnumber = outputAfromCRTC;
542 printk(
"nvidiafb: CRTC %i appears to have a "
543 "CRT attached\n", CRTCnumber);
544 }
else if (analog_on_B) {
545 CRTCnumber = outputBfromCRTC;
547 printk(
"nvidiafb: CRTC %i appears to have a "
548 "CRT attached\n", CRTCnumber);
549 }
else if (slaved_on_A) {
553 printk(
"nvidiafb: CRTC 0 is currently programmed "
555 }
else if (slaved_on_B) {
559 printk(
"nvidiafb: CRTC 1 is currently programmed for "
568 if (FlatPanel != -1) {
572 printk(
"nvidiafb: Unable to detect display "
575 printk(
"...On a laptop, assuming "
579 printk(
"...Using default of CRT\n");
584 printk(
"nvidiafb: Forcing display type to %s as "
585 "specified\n", par->
FlatPanel ?
"DFP" :
"CRT");
589 if (CRTCnumber != -1)
592 printk(
"nvidiafb: Unable to detect which "
598 printk(
"...Defaulting to CRTCNumber %i\n",
602 printk(
"nvidiafb: Forcing CRTCNumber %i as "
632 if (implementation == 0x0110)
642 printk(
"nvidiafb: Using %s on CRTC %i\n",
665 printk(
"nvidiafb: Panel is %s\n", par->
LVDS ?
"LVDS" :
"TMDS");