Skip to contentSkip to conversation

: Fix rivafb's OF parsing

PATCH In review Guido Guenther 6 participants 17 messages Jun 1, 2004 – Jul 9, 2004 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Fix rivafb's OF parsing

Hi,
the attached patch fixes the EDID parsing for PPC on rivafb. It actually finds the EDID info in the OF Tree now. I grabbed this from BenHs Tree as of 2.6.5-rc3. The current code has no chance to work since it doesn't walk the device tree.
This helps rivafb on PPC at least a bit further...
Cheers,
-- Guido

video/riva/fbdev.c renamed from linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c +17 -4
@@ -1620,14 +1632,27 @@
 	struct riva_par *par = (struct riva_par *) info->par;
 	struct device_node *dp;
 	unsigned char *pedid = NULL;
+        unsigned char *disptype = NULL;
+        static char *propnames[] = {
+        	"DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL };
+        int i;  
 
 	dp = pci_device_to_OF_node(pd);
-	pedid = (unsigned char *)get_property(dp, "EDID,B", 0);
-
-	if (pedid) {
+        for (; dp != NULL; dp = dp->child) {
+               	disptype = (unsigned char *)get_property(dp, "display-type", NULL);
+                if (disptype == NULL)
+                	continue;
+                if (strncmp(disptype, "LCD", 3) != 0)
+                	continue;
+                for (i = 0; propnames[i] != NULL; ++i) {
+                        pedid = (unsigned char *)
+                                get_property(dp, propnames[i], NULL);
+                        if (pedid != NULL) {
 		par->EDID = pedid;
 		return 1;
-	} else
+                        }
+                }
+        }
 		return 0;
 }
 #endif /* CONFIG_PPC_OF */
#1 lore raw
Quoted 7 lines · Guido Guenther

Hi,
the attached patch fixes the EDID parsing for PPC on rivafb. It actually finds the EDID info in the OF Tree now. I grabbed this from BenHs Tree as of 2.6.5-rc3. The current code has no chance to work since it doesn't walk the device tree.
This helps rivafb on PPC at least a bit further...
Cheers,

You'll have more chances getting the patch picked up quickly if you send it in the body of the mail, not as an attachment. Attachement are an order of magnitude more painful to process for us.

(Make sure your mailer won't screw up space/tabs & line lenght though)

Ben.

#2 lore raw
Quoted 3 lines · Benjamin Herrenschmidt

You'll have more chances getting the patch picked up quickly if you send it in the body of the mail, not as an attachment. Attachement are an order of magnitude more painful to process for us.

Next try:

the attached patch fixes the EDID parsing for PPC on rivafb. It actually finds the EDID info in the OF Tree now. I grabbed this from BenHs Tree as of 2.6.5-rc3. The current code has no chance to work since it doesn't walk the device tree.
This helps rivafb on PPC at least a bit further...
Cheers,
-- Guido

video/riva/fbdev.c renamed from linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c +17 -4
@@ -1620,14 +1632,27 @@
 	struct riva_par *par = (struct riva_par *) info->par;
 	struct device_node *dp;
 	unsigned char *pedid = NULL;
+        unsigned char *disptype = NULL;
+        static char *propnames[] = {
+        	"DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL };
+        int i;  
 
 	dp = pci_device_to_OF_node(pd);
-	pedid = (unsigned char *)get_property(dp, "EDID,B", 0);
-
-	if (pedid) {
+        for (; dp != NULL; dp = dp->child) {
+               	disptype = (unsigned char *)get_property(dp, "display-type", NULL);
+                if (disptype == NULL)
+                	continue;
+                if (strncmp(disptype, "LCD", 3) != 0)
+                	continue;
+                for (i = 0; propnames[i] != NULL; ++i) {
+                        pedid = (unsigned char *)
+                                get_property(dp, propnames[i], NULL);
+                        if (pedid != NULL) {
 		par->EDID = pedid;
 		return 1;
-	} else
+                        }
+                }
+        }
 		return 0;
 }
 #endif /* CONFIG_PPC_OF */
#3 lore raw

video/riva/fbdev.c 2004-06-01 00:57:37.060599712 -0300 line 1635

Quoted 8 lines · Guido Guenther
video/riva/fbdev.c 2004-06-01 00:57:37.060599712 -0300 renamed from linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c 2004-05-30 11:40:32.000000000 -0300 +1 -0
@@ -1620,14 +1632,27 @@
       struct riva_par *par = (struct riva_par *) info->par;
       struct device_node *dp;
       unsigned char *pedid = NULL;
+        unsigned char *disptype = NULL;

Please use tabs instead of spaces.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#4 lore raw
In reply to Guido Guenther
Quoted 4 lines · Guido Guenther
Quoted 3 lines · Benjamin Herrenschmidt

You'll have more chances getting the patch picked up quickly if you send it in the body of the mail, not as an attachment. Attachement are an order of magnitude more painful to process for us.

Quoted 8 lines

Next try:

the attached patch fixes the EDID parsing for PPC on rivafb. It actually finds the EDID info in the OF Tree now. I grabbed this from BenHs Tree as of 2.6.5-rc3. The current code has no chance to work since it doesn't walk the device tree.
This helps rivafb on PPC at least a bit further...
Cheers,

Your tab/spacing seem to be broken.. Fix the tabs or check that your mailer isn't screwing them up.

Ben.

#5 lore raw
Quoted 9 lines · Benjamin Herrenschmidt
Quoted 6 lines

the attached patch fixes the EDID parsing for PPC on rivafb. It actually finds the EDID info in the OF Tree now. I grabbed this from BenHs Tree as of 2.6.5-rc3. The current code has no chance to work since it doesn't walk the device tree.
This helps rivafb on PPC at least a bit further...
Cheers,

Your tab/spacing seem to be broken.. Fix the tabs or check that your mailer isn't screwing them up.

Next try:

drivers/video/riva/fbdev.c renamed from linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c +17 -4
@@ -1620,14 +1655,27 @@
 	struct riva_par *par = (struct riva_par *) info->par;
 	struct device_node *dp;
 	unsigned char *pedid = NULL;
+	unsigned char *disptype = NULL;
+	static char *propnames[] = {
+		"DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL };
+	int i;
 
 	dp = pci_device_to_OF_node(pd);
-	pedid = (unsigned char *)get_property(dp, "EDID,B", 0);
-
-	if (pedid) {
+	for (; dp != NULL; dp = dp->child) {
+		disptype = (unsigned char *)get_property(dp, "display-type", NULL);
+		if (disptype == NULL)
+			continue;
+		if (strncmp(disptype, "LCD", 3) != 0)
+			continue;
+		for (i = 0; propnames[i] != NULL; ++i) {
+			pedid = (unsigned char *)
+				get_property(dp, propnames[i], NULL);
+			if (pedid != NULL) {
 		par->EDID = pedid;
 		return 1;
-	} else
+			}
+		}
+	}
 		return 0;
 }
 #endif /* CONFIG_PPC_OF */
#6 lore raw

PATCH 1/1 : Fix rivafb's NV_ARCH_

In reply to Guido Guenther

Hi,
here's another piece of rivafb fixing that helps the driver on ppc pbooks again a bit further. It corrects several wrong NV_ARCH_20 settings which are actually NV_ARCH_10 as determined by the PCIId. Patch is against 2.6.7-rc3.
Cheers,
-- Guido

video/riva/fbdev.c renamed from linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c +12 -12
@@ -173,18 +174,18 @@
 	{ "GeForce2-GTS", NV_ARCH_10 },
 	{ "GeForce2-ULTRA", NV_ARCH_10 },
 	{ "Quadro2-PRO", NV_ARCH_10 },
-	{ "GeForce4-MX-460", NV_ARCH_20 },
-	{ "GeForce4-MX-440", NV_ARCH_20 },
-	{ "GeForce4-MX-420", NV_ARCH_20 },
-	{ "GeForce4-440-GO", NV_ARCH_20 },
-	{ "GeForce4-420-GO", NV_ARCH_20 },
-	{ "GeForce4-420-GO-M32", NV_ARCH_20 },
-	{ "Quadro4-500-XGL", NV_ARCH_20 },
-	{ "GeForce4-440-GO-M64", NV_ARCH_20 },
-	{ "Quadro4-200", NV_ARCH_20 },
-	{ "Quadro4-550-XGL", NV_ARCH_20 },
-	{ "Quadro4-500-GOGL", NV_ARCH_20 },
-	{ "GeForce2", NV_ARCH_20 },
+	{ "GeForce4-MX-460", NV_ARCH_10 },
+	{ "GeForce4-MX-440", NV_ARCH_10 },
+	{ "GeForce4-MX-420", NV_ARCH_10 },
+	{ "GeForce4-440-GO", NV_ARCH_10 },
+	{ "GeForce4-420-GO", NV_ARCH_10 },
+	{ "GeForce4-420-GO-M32", NV_ARCH_10 },
+	{ "Quadro4-500-XGL", NV_ARCH_10 },
+	{ "GeForce4-440-GO-M64", NV_ARCH_10 },
+	{ "Quadro4-200", NV_ARCH_10 },
+	{ "Quadro4-550-XGL", NV_ARCH_10 },
+	{ "Quadro4-500-GOGL", NV_ARCH_10 },
+	{ "GeForce2", NV_ARCH_10 },
 	{ "GeForce3", NV_ARCH_20 }, 
 	{ "GeForce3 Ti 200", NV_ARCH_20 },
 	{ "GeForce3 Ti 500", NV_ARCH_20 },
#7 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_

Hi,

Quoted 3 lines · Guido Guenther

here's another piece of rivafb fixing that helps the driver on ppc pbooks again a bit further. It corrects several wrong NV_ARCH_20 settings which are actually NV_ARCH_10 as determined by the PCIId.

Any comments on this patch?
-- Guido

#8 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_

Quoted 6 lines · Guido Guenther

Hi,

Quoted 3 lines · Guido Guenther

here's another piece of rivafb fixing that helps the driver on ppc pbooks again a bit further. It corrects several wrong NV_ARCH_20 settings which are actually NV_ARCH_10 as determined by the PCIId.

Any comments on this patch?

I applied it to 2.6.7; rivafb didn't work before, didn't work after :) (details are/were in the "Framebuffer with nVidia etc" thread)

Signature · 7 lines
Giuseppe "Oblomov" Bilotta

Can't you see
It all makes perfect sense
Expressed in dollar and cents
Pounds shillings and pence
                  (Roger Waters)
#9 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_

In reply to Guido Guenther
Quoted 6 lines · Guido Guenther

Hi,

Quoted 3 lines · Guido Guenther

here's another piece of rivafb fixing that helps the driver on ppc pbooks again a bit further. It corrects several wrong NV_ARCH_20 settings which are actually NV_ARCH_10 as determined by the PCIId.

Any comments on this patch?

I don't, but did you ask on the linux-fbdev list ?

Ben.

#10 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_

Quoted 9 lines · Benjamin Herrenschmidt
Quoted 6 lines · Guido Guenther

Hi,

Quoted 3 lines · Guido Guenther

here's another piece of rivafb fixing that helps the driver on ppc pbooks again a bit further. It corrects several wrong NV_ARCH_20 settings which are actually NV_ARCH_10 as determined by the PCIId.

Any comments on this patch?

I don't, but did you ask on the linux-fbdev list ?

I've sent a patch to James several weeks ago that removes the complete table with NV_ARCH_ mappings and uses PCI-IDs instead. He applied it to the fbdev tree, but it didn't end up in Linus tree yet.
This patch just fixes what's obviously wrong. More cleanup to come once rivafb is in a usable shape for me again.
Cheers,
-- Guido

#11 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_

Quoted 7 lines · Guido Guenther
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 5 lines · Guido Guenther

Hi,

Quoted 3 lines · Guido Guenther

here's another piece of rivafb fixing that helps the driver on ppc pbooks again a bit further. It corrects several wrong NV_ARCH_20 settings which are actually NV_ARCH_10 as determined by the PCIId.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Any comments on this patch?

I don't, but did you ask on the linux-fbdev list ?

I've sent a patch to James several weeks ago that removes the complete table with NV_ARCH_ mappings and uses PCI-IDs instead. He applied it to the fbdev tree, but it didn't end up in Linus tree yet.
This patch just fixes what's obviously wrong. More cleanup to come once rivafb is in a usable shape for me again.

Ok, well, it looks good to me. There is no active maintainer for rivafb so, I suppose if nobody complains of breakage, it should be fine.

Ben.

#12 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_

Quoted 2 lines · Benjamin Herrenschmidt

Ok, well, it looks good to me. There is no active maintainer for rivafb so, I suppose if nobody complains of breakage, it should be fine.

It really shouldn't. PCIID's with 0x01X0 are NV10. There are others which are NV40 but they aren't even recognized by rivafb yet. Cheers,
-- Guido

#13 lore raw

PATCH 1/1 : Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc

In reply to Benjamin Herrenschmidt
Quoted 2 lines · Benjamin Herrenschmidt

Ok, well, it looks good to me. There is no active maintainer for rivafb so, I suppose if nobody complains of breakage, it should be fine.

Since this isn't in yet. Here's another version that:
- fixes the PCI-IDs (needed to get it to work on at least the NV17)
- cleans up the DEBUG option (similar to the new radeonfb). This also makes it easy to replace printk by btext_printf() (on ppc) or similar to ease debugging of the fb code when all else fails.
- adds backlight control for Apple powerbooks
Patch is against 2.6.7-bk20. Please apply,
-- Guido

video/riva/fbdev.c renamed from linux-2.6.7-bk20.orig/drivers/video/riva/fbdev.c +135 -22
@@ -48,6 +48,9 @@
 #include <asm/prom.h>
 #include <asm/pci-bridge.h>
 #endif
+#ifdef CONFIG_PMAC_BACKLIGHT
+#include <asm/backlight.h>
+#endif
 
 #include "rivafb.h"
 #include "nvreg.h"
@@ -64,15 +67,16 @@
  * various helpful macros and constants
  *
  * ------------------------------------------------------------------------- */
-
-#undef RIVAFBDEBUG
-#ifdef RIVAFBDEBUG
-#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
+#ifdef CONFIG_FB_RIVA_DEBUG
+#define NVTRACE          printk
 #else
-#define DPRINTK(fmt, args...)
+#define NVTRACE          if(0) printk
 #endif
 
-#ifndef RIVA_NDEBUG
+#define NVTRACE_ENTER(...)  NVTRACE("%s START\n", __FUNCTION__)
+#define NVTRACE_LEAVE(...)  NVTRACE("%s END\n", __FUNCTION__)
+
+#ifdef CONFIG_FB_RIVA_DEBUG
 #define assert(expr) \
 	if(!(expr)) { \
 	printk( "Assertion failed! %s,%s,%s,line=%d\n",\
@@ -173,18 +177,18 @@
 	{ "GeForce2-GTS", NV_ARCH_10 },
 	{ "GeForce2-ULTRA", NV_ARCH_10 },
 	{ "Quadro2-PRO", NV_ARCH_10 },
-	{ "GeForce4-MX-460", NV_ARCH_20 },
-	{ "GeForce4-MX-440", NV_ARCH_20 },
-	{ "GeForce4-MX-420", NV_ARCH_20 },
-	{ "GeForce4-440-GO", NV_ARCH_20 },
-	{ "GeForce4-420-GO", NV_ARCH_20 },
-	{ "GeForce4-420-GO-M32", NV_ARCH_20 },
-	{ "Quadro4-500-XGL", NV_ARCH_20 },
-	{ "GeForce4-440-GO-M64", NV_ARCH_20 },
-	{ "Quadro4-200", NV_ARCH_20 },
-	{ "Quadro4-550-XGL", NV_ARCH_20 },
-	{ "Quadro4-500-GOGL", NV_ARCH_20 },
-	{ "GeForce2", NV_ARCH_20 },
+	{ "GeForce4-MX-460", NV_ARCH_10 },
+	{ "GeForce4-MX-440", NV_ARCH_10 },
+	{ "GeForce4-MX-420", NV_ARCH_10 },
+	{ "GeForce4-440-GO", NV_ARCH_10 },
+	{ "GeForce4-420-GO", NV_ARCH_10 },
+	{ "GeForce4-420-GO-M32", NV_ARCH_10 },
+	{ "Quadro4-500-XGL", NV_ARCH_10 },
+	{ "GeForce4-440-GO-M64", NV_ARCH_10 },
+	{ "Quadro4-200", NV_ARCH_10 },
+	{ "Quadro4-550-XGL", NV_ARCH_10 },
+	{ "Quadro4-500-GOGL", NV_ARCH_10 },
+	{ "GeForce2", NV_ARCH_10 },
 	{ "GeForce3", NV_ARCH_20 }, 
 	{ "GeForce3 Ti 200", NV_ARCH_20 },
 	{ "GeForce3 Ti 500", NV_ARCH_20 },
@@ -351,6 +355,38 @@
 	0xEB							/* MISC */
 };
 
+/*
+ * Backlight control
+ */
+#ifdef CONFIG_PMAC_BACKLIGHT
+
+static int riva_backlight_levels[] = {
+    0x158,
+    0x192,
+    0x1c6,
+    0x200,
+    0x234,
+    0x268,
+    0x2a2,
+    0x2d6,
+    0x310,
+    0x344,
+    0x378,
+    0x3b2,
+    0x3e6,
+    0x41a,
+    0x454,
+    0x534,
+};
+
+static int riva_set_backlight_enable(int on, int level, void *data);
+static int riva_set_backlight_level(int level, void *data);
+static struct backlight_controller riva_backlight_controller = {
+	riva_set_backlight_enable,
+	riva_set_backlight_level
+};
+#endif /* CONFIG_PMAC_BACKLIGHT */
+
 /* ------------------------------------------------------------------------- *
  *
  * MMIO access macros
@@ -592,6 +628,7 @@
 {
 	int i;
 
+	NVTRACE_ENTER();
 	par->riva.LockUnlock(&par->riva, 0);
 
 	par->riva.UnloadStateExt(&par->riva, &regs->ext);
@@ -609,6 +646,7 @@
 
 	for (i = 0; i < NUM_SEQ_REGS; i++)
 		regs->seq[i] = SEQin(par, i);
+	NVTRACE_LEAVE();
 }
 
 /**
@@ -630,6 +668,7 @@
 	RIVA_HW_STATE *state = &regs->ext;
 	int i;
 
+	NVTRACE_ENTER();
 	CRTCout(par, 0x11, 0x00);
 
 	par->riva.LockUnlock(&par->riva, 0);
@@ -656,6 +695,7 @@
 
 	for (i = 0; i < NUM_SEQ_REGS; i++)
 		SEQout(par, i, regs->seq[i]);
+	NVTRACE_LEAVE();
 }
 
 /**
@@ -676,6 +716,7 @@
 	struct riva_par *par = (struct riva_par *) info->par;
 	struct riva_regs newmode;
 	
+	NVTRACE_ENTER();
 	/* time to calculate */
 	rivafb_blank(1, info);
 
@@ -806,10 +847,12 @@
 	riva_load_state(par, &par->current_state);
 	par->riva.LockUnlock(&par->riva, 0); /* important for HW cursor */
 	rivafb_blank(0, info);
+	NVTRACE_LEAVE();
 }
 
 static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb)
 {
+	NVTRACE_ENTER();
 	var->xres = var->xres_virtual = modedb->xres;
 	var->yres = modedb->yres;
         if (var->yres_virtual < var->yres)
@@ -824,6 +867,7 @@
         var->vsync_len = modedb->vsync_len;
         var->sync = modedb->sync;
         var->vmode = modedb->vmode;
+	NVTRACE_LEAVE();
 }
 
 /**
@@ -859,6 +903,7 @@
 	};
 	int i;
 
+	NVTRACE_ENTER();
 	/* use highest possible virtual resolution */
 	if (var->xres_virtual == -1 && var->yres_virtual == -1) {
 		printk(KERN_WARNING PFX
@@ -871,7 +916,7 @@
 		if (modes[i].xres == -1) {
 			printk(KERN_ERR PFX
 			       "could not find a virtual resolution that fits into video memory!!\n");
-			DPRINTK("EXIT - EINVAL error\n");
+			NVTRACE("EXIT - EINVAL error\n");
 			return -EINVAL;
 		}
 		var->xres_virtual = modes[i].xres;
@@ -897,7 +942,7 @@
 			printk(KERN_ERR PFX
 			       "mode %dx%dx%d rejected...resolution too high to fit into video memory!\n",
 			       var->xres, var->yres, var->bits_per_pixel);
-			DPRINTK("EXIT - EINVAL error\n");
+			NVTRACE("EXIT - EINVAL error\n");
 			return -EINVAL;
 		}
 	}
@@ -924,7 +969,7 @@
 		var->yres_virtual = 0x7fff/nom;
 	if (var->xres_virtual > 0x7fff/nom)
 		var->xres_virtual = 0x7fff/nom;
-
+	NVTRACE_LEAVE();
 	return 0;
 }
 
@@ -1004,6 +1049,36 @@
 
 /* ------------------------------------------------------------------------- *
  *
+ * Backlight operations
+ *
+ * ------------------------------------------------------------------------- */
+
+#ifdef CONFIG_PMAC_BACKLIGHT
+static int riva_set_backlight_enable(int on, int level, void *data)
+{
+	struct riva_par *par = (struct riva_par *)data;
+	U032 tmp_pcrt, tmp_pmc;
+
+	tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF;
+	tmp_pcrt = par->riva.PCRTC0[0x081C/4] & 0xFFFFFFFC;
+	if(on && (level > BACKLIGHT_OFF)) {
+		tmp_pcrt |= 0x1;
+		tmp_pmc |= (1 << 31); // backlight bit
+		tmp_pmc |= riva_backlight_levels[level-1] << 16; // level
+	}
+	par->riva.PCRTC0[0x081C/4] = tmp_pcrt;
+	par->riva.PMC[0x10F0/4] = tmp_pmc;
+	return 0;
+}
+
+static int riva_set_backlight_level(int level, void *data)
+{
+	return riva_set_backlight_enable(1, level, data);
+}
+#endif /* CONFIG_PMAC_BACKLIGHT */
+
+/* ------------------------------------------------------------------------- *
+ *
  * framebuffer operations
  *
  * ------------------------------------------------------------------------- */
@@ -1013,6 +1088,7 @@
 	struct riva_par *par = (struct riva_par *) info->par;
 	int cnt = atomic_read(&par->ref_count);
 
+	NVTRACE_ENTER();
 	if (!cnt) {
 		memset(&par->state, 0, sizeof(struct vgastate));
 		par->state.flags = VGA_SAVE_MODE  | VGA_SAVE_FONTS;
@@ -1029,6 +1105,7 @@
 		riva_save_state(par, &par->initial_state);
 	}
 	atomic_inc(&par->ref_count);
+	NVTRACE_LEAVE();
 	return 0;
 }
 
@@ -1037,6 +1114,7 @@
 	struct riva_par *par = (struct riva_par *) info->par;
 	int cnt = atomic_read(&par->ref_count);
 
+	NVTRACE_ENTER();
 	if (!cnt)
 		return -EINVAL;
 	if (cnt == 1) {
@@ -1047,6 +1125,7 @@
 		par->riva.LockUnlock(&par->riva, 1);
 	}
 	atomic_dec(&par->ref_count);
+	NVTRACE_LEAVE();
 	return 0;
 }
 
@@ -1056,6 +1135,7 @@
 	int nom, den;		/* translating from pixels->bytes */
 	int mode_valid = 0;
 	
+	NVTRACE_ENTER();
 	switch (var->bits_per_pixel) {
 	case 1 ... 8:
 		var->red.offset = var->green.offset = var->blue.offset = 0;
@@ -1101,7 +1181,7 @@
 		printk(KERN_ERR PFX
 		       "mode %dx%dx%d rejected...color depth not supported.\n",
 		       var->xres, var->yres, var->bits_per_pixel);
-		DPRINTK("EXIT, returning -EINVAL\n");
+		NVTRACE("EXIT, returning -EINVAL\n");
 		return -EINVAL;
 	}
 
@@ -1191,6 +1271,7 @@
 	    var->green.msb_right =
 	    var->blue.msb_right =
 	    var->transp.offset = var->transp.length = var->transp.msb_right = 0;
+	NVTRACE_LEAVE();
 	return 0;
 }
 
@@ -1198,6 +1279,7 @@
 {
 	struct riva_par *par = (struct riva_par *) info->par;
 
+	NVTRACE_ENTER();
 	riva_common_setup(par);
 	RivaGetConfig(&par->riva, par->Chipset);
 	/* vgaHWunlock() + riva unlock (0x7F) */
@@ -1211,6 +1293,7 @@
 	info->fix.line_length = (info->var.xres_virtual * (info->var.bits_per_pixel >> 3));
 	info->fix.visual = (info->var.bits_per_pixel == 8) ?
 				FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
+	NVTRACE_LEAVE();
 	return 0;
 }
 
@@ -1233,6 +1316,7 @@
 	struct riva_par *par = (struct riva_par *)info->par;
 	unsigned int base;
 
+	NVTRACE_ENTER();
 	if (var->xoffset > (var->xres_virtual - var->xres))
 		return -EINVAL;
 	if (var->yoffset > (var->yres_virtual - var->yres))
@@ -1259,6 +1343,7 @@
 		info->var.vmode |= FB_VMODE_YWRAP;
 	else
 		info->var.vmode &= ~FB_VMODE_YWRAP;
+	NVTRACE_LEAVE();
 	return 0;
 }
 
@@ -1270,6 +1355,7 @@
 	tmp = SEQin(par, 0x01) & ~0x20;	/* screen on/off */
 	vesa = CRTCin(par, 0x1a) & ~0xc0;	/* sync on/off */
 
+	NVTRACE_ENTER();
 	if (blank) {
 		tmp |= 0x20;
 		switch (blank - 1) {
@@ -1288,6 +1374,14 @@
 	}
 	SEQout(par, 0x01, tmp);
 	CRTCout(par, 0x1a, vesa);
+
+#ifdef CONFIG_PMAC_BACKLIGHT
+	if ( par->FlatPanel && _machine == _MACH_Pmac) {
+		set_backlight_enable(!blank);
+	}
+#endif
+
+	NVTRACE_LEAVE();
 	return 0;
 }
 
@@ -1676,6 +1770,7 @@
 {
 	unsigned int cmap_len;
 
+	NVTRACE_ENTER();
 	info->flags = FBINFO_DEFAULT
 		    | FBINFO_HWACCEL_XPAN
 		    | FBINFO_HWACCEL_YPAN
@@ -1696,6 +1791,7 @@
 	info->pixmap.scan_align = 4;
 	info->pixmap.flags = FB_PIXMAP_SYSTEM;
 	info->var.yres_virtual = -1;
+	NVTRACE_LEAVE();
 	return (rivafb_check_var(&info->var, info));
 }
 
@@ -1710,6 +1806,7 @@
 		"DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL };
 	int i;
 
+	NVTRACE_ENTER();
 	dp = pci_device_to_OF_node(pd);
 	for (; dp != NULL; dp = dp->child) {
 		disptype = (unsigned char *)get_property(dp, "display-type", NULL);
@@ -1726,6 +1823,7 @@
 			}
 		}
 	}
+	NVTRACE_LEAVE();
 		return 0;
 }
 #endif /* CONFIG_PPC_OF */
@@ -1735,6 +1833,7 @@
 	struct fb_monspecs *specs = &info->monspecs;
 	struct fb_videomode modedb;
 
+	NVTRACE_ENTER();
 	/* respect mode options */
 	if (mode_option) {
 		fb_find_mode(var, info, mode_option,
@@ -1759,11 +1858,13 @@
 		riva_update_var(var, &modedb);
 	}
 	var->accel_flags |= FB_ACCELF_TEXT;
+	NVTRACE_LEAVE();
 }
 
 
 static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
 {
+	NVTRACE_ENTER();
 #ifdef CONFIG_PPC_OF
 	if (!riva_get_EDID_OF(info, pdev))
 		printk("rivafb: could not retrieve EDID from OF\n");
@@ -1784,6 +1885,7 @@
 	riva_delete_i2c_busses(par);
 #endif
 #endif
+	NVTRACE_LEAVE();
 }
 
 
@@ -1813,6 +1915,7 @@
 	struct riva_par *default_par;
 	struct fb_info *info;
 
+	NVTRACE_ENTER();
 	assert(pd != NULL);
 	assert(rci != NULL);
 
@@ -1958,6 +2061,12 @@
 		info->fix.id,
 		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,
+						default_par, "mnca");
+#endif
+	NVTRACE_LEAVE();
 	return 0;
 
 err_out_iounmap_fb:
@@ -1986,6 +2095,7 @@
 	struct fb_info *info = pci_get_drvdata(pd);
 	struct riva_par *par = (struct riva_par *) info->par;
 	
+	NVTRACE_ENTER();
 	if (!info)
 		return;
 
@@ -2007,6 +2117,7 @@
 	kfree(par);
 	kfree(info);
 	pci_set_drvdata(pd, NULL);
+	NVTRACE_LEAVE();
 }
 
 /* ------------------------------------------------------------------------- *
@@ -2020,6 +2131,7 @@
 {
 	char *this_opt;
 
+	NVTRACE_ENTER();
 	if (!options || !*options)
 		return 0;
 
@@ -2043,6 +2155,7 @@
 		} else
 			mode_option = this_opt;
 	}
+	NVTRACE_LEAVE();
 	return 0;
 }
 #endif /* !MODULE */
video/Kconfig renamed from linux-2.6.7-bk20.orig/drivers/video/Kconfig +9 -0
@@ -446,6 +446,15 @@
 	  independently validate video mode parameters, you should say Y
 	  here.
 
+config FB_RIVA_DEBUG
+	bool "Lots of debug output from Riva(nVidia) driver"
+	depends on FB_RIVA
+	default n
+	help
+	  Say Y here if you want the Riva driver to output all sorts
+	  of debugging informations to provide to the maintainer when
+	  something goes wrong.
+
 config FB_I810
 	tristate "Intel 810/815 support (EXPERIMENTAL)"
 	depends on FB && AGP && AGP_INTEL && EXPERIMENTAL && PCI	
#14 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc

Quoted 4 lines · Guido Guenther
Quoted 2 lines · Benjamin Herrenschmidt

Ok, well, it looks good to me. There is no active maintainer for rivafb so, I suppose if nobody complains of breakage, it should be fine.

Quoted 8 lines

Since this isn't in yet. Here's another version that:
- fixes the PCI-IDs (needed to get it to work on at least the NV17)
- cleans up the DEBUG option (similar to the new radeonfb). This also makes it easy to replace printk by btext_printf() (on ppc) or similar to ease debugging of the fb code when all else fails.
- adds backlight control for Apple powerbooks
Patch is against 2.6.7-bk20. Please apply,
-- Guido

Tried the patch, and works okay for me (NV10 x86). I'm not really too keen on making debug printing as a kernel config option, but it's a minor point. This patch should be applied.

Tony

#15 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_

In reply to Guido Guenther

Could you compare it to my latest Nvidia driver?

Quoted 13 lines · Guido Guenther

Hi,

Quoted 3 lines · Guido Guenther

here's another piece of rivafb fixing that helps the driver on ppc pbooks again a bit further. It corrects several wrong NV_ARCH_20 settings which are actually NV_ARCH_10 as determined by the PCIId.

Any comments on this patch?
-- Guido
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#16 lore raw

Re: [Patch]: Fix rivafb's NV_ARCH_

Quoted 2 lines · On Wed, Jun 23, 2004 at 08:35:56PM +0100, [email protected]…

Could you compare it to my latest Nvidia driver?

You applied a patch I sent to you that removes this array and determines the NV_TYPE by PCI ID about 5 months ago, so there's no need for this fix in you tree.
Cheers,
-- Guido