[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Brightness control on PowerBook G4 1.33GHz, 12", GeForce FX Go5200



On Mon, Sep 27, 2004 at 04:51:51PM +0200, Guido Guenther wrote:
> On Mon, Sep 27, 2004 at 02:08:51PM +0200, Djoumé SALVETTI wrote:
> > Le lundi 09/27/04 Jens Schmalzing <j.s@lmu.de> a écrit :
> > > Once offb has been started, you cannot get rid of it anymore.  In
> > > order to use rivafb, you must build your own kernel and build rivafb
> > > into it.  But beware, last time I tried the rivafb driver it crashed
> > > my machine.
> > 
> > I use a patch to control backlight with offb (attached). 
> > AFAIK, backlight control with rivafb is not yet included in vanilla
> > or debian kernels.
> It included in mainline and works. Problem is that the machine freezes
> when using rivafb when switching from X to the console. I'm looking into
> that now.
...and here's the fix. Sorry it took so long, i've been busy with other
things...rivafb is still flacky, but console switching and backlight
control works on NV17, NV30 untested, reports welcome.
Cheers,
 -- Guido
Only in linux-2.6.9/drivers/video/riva/: built-in.o
Only in linux-2.6.9/drivers/video/riva/: .built-in.o.cmd
diff -ubw linux-2.6.9.orig/drivers/video/riva/fbdev.c linux-2.6.9/drivers/video/riva/fbdev.c
--- linux-2.6.9.orig/drivers/video/riva/fbdev.c	2004-10-18 23:54:39.000000000 +0200
+++ linux-2.6.9/drivers/video/riva/fbdev.c	2004-10-24 17:57:53.092317888 +0200
@@ -192,6 +192,8 @@
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL,
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
+	{ PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ 0, } /* terminate list */
 };
 MODULE_DEVICE_TABLE(pci, rivafb_pci_tbl);
@@ -1008,7 +1010,6 @@
 			par->state.flags |= VGA_SAVE_CMAP;
 		save_vga(&par->state);
 #endif
-		riva_common_setup(par);
 		RivaGetConfig(&par->riva, par->Chipset);
 		/* vgaHWunlock() + riva unlock (0x7F) */
 		CRTCout(par, 0x11, 0xFF);
@@ -1157,8 +1158,6 @@
 	struct riva_par *par = (struct riva_par *) info->par;
 
 	NVTRACE_ENTER();
-	riva_common_setup(par);
-	RivaGetConfig(&par->riva, par->Chipset);
 	/* vgaHWunlock() + riva unlock (0x7F) */
 	CRTCout(par, 0x11, 0xFF);
 	par->riva.LockUnlock(&par->riva, 0);
@@ -2016,6 +2020,7 @@
 		RIVAFB_VERSION,
 		info->fix.smem_len / (1024 * 1024),
 		info->fix.smem_start);
+
 #ifdef CONFIG_PMAC_BACKLIGHT
 	if (default_par->FlatPanel && _machine == _MACH_Pmac)
 	register_backlight_controller(&riva_backlight_controller,
diff -ubw linux-2.6.9.orig/drivers/video/riva/nv_driver.c linux-2.6.9/drivers/video/riva/nv_driver.c
--- linux-2.6.9.orig/drivers/video/riva/nv_driver.c	2004-10-18 23:54:55.000000000 +0200
+++ linux-2.6.9/drivers/video/riva/nv_driver.c	2004-10-24 16:51:01.000000000 +0200
@@ -105,11 +105,32 @@
 {
 	if (par->FlatPanel == 1) {
 		switch(par->Chipset) {
-		case NV_CHIP_GEFORCE4_440_GO:
-		case NV_CHIP_GEFORCE4_440_GO_M64:
-		case NV_CHIP_GEFORCE4_420_GO:
-		case NV_CHIP_GEFORCE4_420_GO_M32:
-		case NV_CHIP_QUADRO4_500_GOGL:
+		case 0x0174:
+		case 0x0175:
+		case 0x0176:
+		case 0x0177:
+		case 0x0179:
+		case 0x017C:
+		case 0x017D:
+		case 0x0186:
+		case 0x0187:
+		/* this might not be a good default for the chips below */
+		case 0x0286:
+		case 0x028C:
+		case 0x0316:
+		case 0x0317:
+		case 0x031A:
+		case 0x031B:
+		case 0x031C:
+		case 0x031D:
+		case 0x031E:
+		case 0x031F:
+		case 0x0324:
+		case 0x0325:
+		case 0x0328:
+		case 0x0329:
+		case 0x032C:
+		case 0x032D:
 			par->SecondCRTC = TRUE;
 			break;
 		default:
@@ -309,12 +330,32 @@
 	
 	if (par->FlatPanel == -1) {
 		switch (par->Chipset) {
-		case NV_CHIP_GEFORCE4_440_GO:
-		case NV_CHIP_GEFORCE4_440_GO_M64:
-		case NV_CHIP_GEFORCE4_420_GO:
-		case NV_CHIP_GEFORCE4_420_GO_M32:
-		case NV_CHIP_QUADRO4_500_GOGL:
-		case NV_CHIP_GEFORCE2_GO:
+		case 0x0112:   /* known laptop chips */
+		case 0x0174:
+		case 0x0175:
+		case 0x0176:
+		case 0x0177:
+		case 0x0179:
+		case 0x017C:
+		case 0x017D:
+		case 0x0186:
+		case 0x0187:
+		case 0x0286:
+		case 0x028C:
+		case 0x0316:
+		case 0x0317:
+		case 0x031A:
+		case 0x031B:
+		case 0x031C:
+		case 0x031D:
+		case 0x031E:
+		case 0x031F:
+		case 0x0324:
+		case 0x0325:
+		case 0x0328:
+		case 0x0329:
+		case 0x032C:
+		case 0x032D:
 			printk(KERN_INFO PFX 
 				"On a laptop.  Assuming Digital Flat Panel\n");
 			par->FlatPanel = 1;
@@ -339,6 +380,11 @@
 	case 0x01F0:
 	case 0x0250:
 	case 0x0280:
+	case 0x0300:
+	case 0x0310:
+	case 0x0320:
+	case 0x0330:
+	case 0x0340:
 		riva_is_second(par);
 		break;
 	default:
diff -ubw linux-2.6.9.orig/drivers/video/riva/riva_hw.c linux-2.6.9/drivers/video/riva/riva_hw.c
--- linux-2.6.9.orig/drivers/video/riva/riva_hw.c	2004-10-18 23:55:36.000000000 +0200
+++ linux-2.6.9/drivers/video/riva/riva_hw.c	2004-10-24 17:13:18.000000000 +0200
@@ -1302,8 +1302,10 @@
 
      /* Paul Richards: below if block borks things in kernel for some reason */
      /* Tony: Below is needed to set hardware in DirectColor */
+#if 0
     if((bpp != 8) && (chip->Architecture != NV_ARCH_03))
 	    state->general |= 0x00000030;
+#endif
 
     state->vpll     = (p << 16) | (n << 8) | m;
     state->repaint0 = (((width/8)*pixelDepth) & 0x700) >> 3;
@@ -2067,6 +2069,7 @@
 
 #ifdef __BIG_ENDIAN
     /* turn on big endian register access */
+    if(!(chip->PMC[0x00000004/4] & 0x01000001))
     chip->PMC[0x00000004/4] = 0x01000001;
 #endif
 
@@ -2128,6 +2131,11 @@
     case 0x01F0:
     case 0x0250:
     case 0x0280:
+    case 0x0300:
+    case 0x0310:
+    case 0x0320:
+    case 0x0330:
+    case 0x0340:
        if(chip->PEXTDEV[0x0000/4] & (1 << 22))
            chip->CrystalFreqKHz = 27000;
        break;
@@ -2159,6 +2167,11 @@
     case 0x01F0:
     case 0x0250:
     case 0x0280:
+    case 0x0300:
+    case 0x0310:
+    case 0x0320:
+    case 0x0330:
+    case 0x0340:
         chip->twoHeads = TRUE;
         break;
     default:
--- linux-2.6.9.orig/include/linux/pci_ids.h	2004-10-18 23:55:36.000000000 +0200
+++ linux-2.6.9/include/linux/pci_ids.h	2004-10-24 18:00:16.149569880 +0200
@@ -1138,6 +1138,7 @@
 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL	0x0258
 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL	0x0259
 #define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL	0x025B
+#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200	0x0329
 
 #define PCI_VENDOR_ID_IMS		0x10e0
 #define PCI_DEVICE_ID_IMS_8849		0x8849

Reply to: