* [Patch]: Fix rivafb's OF parsing
@ 2004-06-01 4:16 Guido Guenther
2004-06-01 4:28 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 17+ messages in thread
From: Guido Guenther @ 2004-06-01 4:16 UTC (permalink / raw)
To: linux-kernel; +Cc: Benjamin Herrenschmidt
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
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
signed-off-by: Guido Günther <agx@sigxpu.org>
[-- Attachment #2: revert-rivafb-edid-changes.diff --]
[-- Type: text/plain, Size: 1234 bytes --]
--- ../linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c 2004-05-30 11:40:32.000000000 -0300
+++ drivers/video/riva/fbdev.c 2004-06-01 00:57:37.060599712 -0300
@@ -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 */
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's OF parsing
2004-06-01 4:16 [Patch]: Fix rivafb's OF parsing Guido Guenther
@ 2004-06-01 4:28 ` Benjamin Herrenschmidt
2004-06-01 13:53 ` Guido Guenther
0 siblings, 1 reply; 17+ messages in thread
From: Benjamin Herrenschmidt @ 2004-06-01 4:28 UTC (permalink / raw)
To: Guido Guenther; +Cc: Linux Kernel list
On Tue, 2004-06-01 at 14:16, Guido Guenther wrote:
> 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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's OF parsing
2004-06-01 4:28 ` Benjamin Herrenschmidt
@ 2004-06-01 13:53 ` Guido Guenther
2004-06-02 9:57 ` Herbert Xu
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Guido Guenther @ 2004-06-01 13:53 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Kernel list
On Tue, Jun 01, 2004 at 02:28:06PM +1000, Benjamin Herrenschmidt wrote:
> 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
signed-off-by: Guido Günther <agx@sigxpu.org>
--- ../linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c 2004-05-30 11:40:32.000000000 -0300
+++ drivers/video/riva/fbdev.c 2004-06-01 00:57:37.060599712 -0300
@@ -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 */
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's OF parsing
2004-06-01 13:53 ` Guido Guenther
@ 2004-06-02 9:57 ` Herbert Xu
2004-06-03 22:40 ` Benjamin Herrenschmidt
2004-06-16 7:03 ` [Patch]: Fix rivafb's NV_ARCH_ Guido Guenther
2 siblings, 0 replies; 17+ messages in thread
From: Herbert Xu @ 2004-06-02 9:57 UTC (permalink / raw)
To: Guido Guenther; +Cc: benh, linux-kernel
Guido Guenther <agx@sigxcpu.org> wrote:
>
> --- ../linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c 2004-05-30 11:40:32.000000000 -0300
> +++ drivers/video/riva/fbdev.c 2004-06-01 00:57:37.060599712 -0300
> @@ -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.
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's OF parsing
2004-06-01 13:53 ` Guido Guenther
2004-06-02 9:57 ` Herbert Xu
@ 2004-06-03 22:40 ` Benjamin Herrenschmidt
2004-06-04 15:49 ` Guido Guenther
2004-06-16 7:03 ` [Patch]: Fix rivafb's NV_ARCH_ Guido Guenther
2 siblings, 1 reply; 17+ messages in thread
From: Benjamin Herrenschmidt @ 2004-06-03 22:40 UTC (permalink / raw)
To: Guido Guenther; +Cc: Linux Kernel list
On Tue, 2004-06-01 at 23:53, Guido Guenther wrote:
> On Tue, Jun 01, 2004 at 02:28:06PM +1000, Benjamin Herrenschmidt wrote:
> > 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,
Your tab/spacing seem to be broken.. Fix the tabs or check that your
mailer isn't screwing them up.
Ben.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's OF parsing
2004-06-03 22:40 ` Benjamin Herrenschmidt
@ 2004-06-04 15:49 ` Guido Guenther
0 siblings, 0 replies; 17+ messages in thread
From: Guido Guenther @ 2004-06-04 15:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Kernel list
On Fri, Jun 04, 2004 at 08:40:21AM +1000, Benjamin Herrenschmidt wrote:
> > 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:
signed-off-by: Guido Guenther <agx@sigxcpu.org>
--- 2.6/linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c 2004-06-04 17:40:30.842899312 +0200
+++ current/drivers/video/riva/fbdev.c 2004-06-04 15:38:00.136376560 +0200
@@ -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 */
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Patch]: Fix rivafb's NV_ARCH_
2004-06-01 13:53 ` Guido Guenther
2004-06-02 9:57 ` Herbert Xu
2004-06-03 22:40 ` Benjamin Herrenschmidt
@ 2004-06-16 7:03 ` Guido Guenther
2004-06-20 19:25 ` Guido Guenther
2 siblings, 1 reply; 17+ messages in thread
From: Guido Guenther @ 2004-06-16 7:03 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Kernel list
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
signed-off-by: Guido Guenther <agx@sigxcpu.org>
--- ../linux-2.6.7-rc2.orig/drivers/video/riva/fbdev.c 2004-06-04 17:40:30.000000000 +0200
+++ drivers/video/riva/fbdev.c 2004-06-16 08:50:41.122924416 +0200
@@ -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 },
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_
2004-06-16 7:03 ` [Patch]: Fix rivafb's NV_ARCH_ Guido Guenther
@ 2004-06-20 19:25 ` Guido Guenther
2004-06-20 22:05 ` Giuseppe Bilotta
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Guido Guenther @ 2004-06-20 19:25 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Kernel list
Hi,
On Wed, Jun 16, 2004 at 09:03:27AM +0200, Guido Guenther wrote:
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_
2004-06-20 19:25 ` Guido Guenther
@ 2004-06-20 22:05 ` Giuseppe Bilotta
2004-06-21 4:11 ` Benjamin Herrenschmidt
2004-06-23 19:35 ` [Patch]: Fix rivafb's NV_ARCH_ jsimmons
2 siblings, 0 replies; 17+ messages in thread
From: Giuseppe Bilotta @ 2004-06-20 22:05 UTC (permalink / raw)
To: linux-kernel
Guido Guenther wrote:
> Hi,
> On Wed, Jun 16, 2004 at 09:03:27AM +0200, Guido Guenther wrote:
> > 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)
--
Giuseppe "Oblomov" Bilotta
Can't you see
It all makes perfect sense
Expressed in dollar and cents
Pounds shillings and pence
(Roger Waters)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_
2004-06-20 19:25 ` Guido Guenther
2004-06-20 22:05 ` Giuseppe Bilotta
@ 2004-06-21 4:11 ` Benjamin Herrenschmidt
2004-06-21 7:11 ` Guido Guenther
2004-06-23 19:35 ` [Patch]: Fix rivafb's NV_ARCH_ jsimmons
2 siblings, 1 reply; 17+ messages in thread
From: Benjamin Herrenschmidt @ 2004-06-21 4:11 UTC (permalink / raw)
To: Guido Guenther; +Cc: Linux Kernel list
On Sun, 2004-06-20 at 14:25, Guido Guenther wrote:
> Hi,
> On Wed, Jun 16, 2004 at 09:03:27AM +0200, Guido Guenther wrote:
> > 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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_
2004-06-21 4:11 ` Benjamin Herrenschmidt
@ 2004-06-21 7:11 ` Guido Guenther
2004-06-21 15:36 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 17+ messages in thread
From: Guido Guenther @ 2004-06-21 7:11 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Kernel list
[-- Attachment #1: Type: text/plain, Size: 854 bytes --]
On Sun, Jun 20, 2004 at 11:11:41PM -0500, Benjamin Herrenschmidt wrote:
> On Sun, 2004-06-20 at 14:25, Guido Guenther wrote:
> > Hi,
> > On Wed, Jun 16, 2004 at 09:03:27AM +0200, Guido Guenther wrote:
> > > 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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_
2004-06-21 7:11 ` Guido Guenther
@ 2004-06-21 15:36 ` Benjamin Herrenschmidt
2004-06-21 19:51 ` Guido Guenther
2004-07-09 11:25 ` [Patch]: Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc Guido Guenther
0 siblings, 2 replies; 17+ messages in thread
From: Benjamin Herrenschmidt @ 2004-06-21 15:36 UTC (permalink / raw)
To: Guido Guenther; +Cc: Linux Kernel list
On Mon, 2004-06-21 at 02:11, Guido Guenther wrote:
> On Sun, Jun 20, 2004 at 11:11:41PM -0500, Benjamin Herrenschmidt wrote:
> > On Sun, 2004-06-20 at 14:25, Guido Guenther wrote:
> > > Hi,
> > > On Wed, Jun 16, 2004 at 09:03:27AM +0200, Guido Guenther wrote:
> > > > 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.
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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_
2004-06-21 15:36 ` Benjamin Herrenschmidt
@ 2004-06-21 19:51 ` Guido Guenther
2004-07-09 11:25 ` [Patch]: Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc Guido Guenther
1 sibling, 0 replies; 17+ messages in thread
From: Guido Guenther @ 2004-06-21 19:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Kernel list
[-- Attachment #1: Type: text/plain, Size: 362 bytes --]
On Mon, Jun 21, 2004 at 10:36:44AM -0500, Benjamin Herrenschmidt wrote:
> 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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_
2004-06-20 19:25 ` Guido Guenther
2004-06-20 22:05 ` Giuseppe Bilotta
2004-06-21 4:11 ` Benjamin Herrenschmidt
@ 2004-06-23 19:35 ` jsimmons
2004-06-24 6:55 ` Guido Guenther
2 siblings, 1 reply; 17+ messages in thread
From: jsimmons @ 2004-06-23 19:35 UTC (permalink / raw)
To: Guido Guenther; +Cc: Benjamin Herrenschmidt, Linux Kernel list
Could you compare it to my latest Nvidia driver?
On Sun, 20 Jun 2004, Guido Guenther wrote:
> Hi,
> On Wed, Jun 16, 2004 at 09:03:27AM +0200, Guido Guenther wrote:
> > 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_
2004-06-23 19:35 ` [Patch]: Fix rivafb's NV_ARCH_ jsimmons
@ 2004-06-24 6:55 ` Guido Guenther
0 siblings, 0 replies; 17+ messages in thread
From: Guido Guenther @ 2004-06-24 6:55 UTC (permalink / raw)
To: jsimmons; +Cc: Benjamin Herrenschmidt, Linux Kernel list
[-- Attachment #1: Type: text/plain, Size: 324 bytes --]
On Wed, Jun 23, 2004 at 08:35:56PM +0100, jsimmons@pentafluge.infradead.org wrote:
>
> 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
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Patch]: Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc
2004-06-21 15:36 ` Benjamin Herrenschmidt
2004-06-21 19:51 ` Guido Guenther
@ 2004-07-09 11:25 ` Guido Guenther
2004-07-09 21:33 ` Antonino A. Daplas
1 sibling, 1 reply; 17+ messages in thread
From: Guido Guenther @ 2004-07-09 11:25 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Linux Kernel list, Antonino Daplas, Andrew Morton
On Mon, Jun 21, 2004 at 10:36:44AM -0500, Benjamin Herrenschmidt wrote:
> 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
Signed-off-by: Guido Guenther <agx@sigxcpu.org>
--- ../linux-2.6.7-bk20.orig/drivers/video/riva/fbdev.c 2004-07-09 10:26:30.000000000 +0200
+++ drivers/video/riva/fbdev.c 2004-07-09 13:06:29.000000000 +0200
@@ -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, ®s->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 = ®s->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 */
--- ../linux-2.6.7-bk20.orig/drivers/video/Kconfig 2004-07-09 10:26:29.000000000 +0200
+++ drivers/video/Kconfig 2004-07-09 10:33:11.000000000 +0200
@@ -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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [Patch]: Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc
2004-07-09 11:25 ` [Patch]: Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc Guido Guenther
@ 2004-07-09 21:33 ` Antonino A. Daplas
0 siblings, 0 replies; 17+ messages in thread
From: Antonino A. Daplas @ 2004-07-09 21:33 UTC (permalink / raw)
To: Guido Guenther, Benjamin Herrenschmidt; +Cc: Linux Kernel list, Andrew Morton
On Friday 09 July 2004 19:25, Guido Guenther wrote:
> On Mon, Jun 21, 2004 at 10:36:44AM -0500, Benjamin Herrenschmidt wrote:
> > 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
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
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2004-07-09 21:34 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-01 4:16 [Patch]: Fix rivafb's OF parsing Guido Guenther
2004-06-01 4:28 ` Benjamin Herrenschmidt
2004-06-01 13:53 ` Guido Guenther
2004-06-02 9:57 ` Herbert Xu
2004-06-03 22:40 ` Benjamin Herrenschmidt
2004-06-04 15:49 ` Guido Guenther
2004-06-16 7:03 ` [Patch]: Fix rivafb's NV_ARCH_ Guido Guenther
2004-06-20 19:25 ` Guido Guenther
2004-06-20 22:05 ` Giuseppe Bilotta
2004-06-21 4:11 ` Benjamin Herrenschmidt
2004-06-21 7:11 ` Guido Guenther
2004-06-21 15:36 ` Benjamin Herrenschmidt
2004-06-21 19:51 ` Guido Guenther
2004-07-09 11:25 ` [Patch]: Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc Guido Guenther
2004-07-09 21:33 ` Antonino A. Daplas
2004-06-23 19:35 ` [Patch]: Fix rivafb's NV_ARCH_ jsimmons
2004-06-24 6:55 ` Guido Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox