Commit 5fcadd1e authored by Guido Guenther's avatar Guido Guenther Committed by Linus Torvalds

[PATCH] Fix rivafb's NV_ARCH_, cleanup DEBUG, backlight control on ppc

- 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
Signed-off-by: default avatarGuido Guenther <agx@sigxcpu.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent cf8b1162
...@@ -446,6 +446,15 @@ config FB_RIVA_I2C ...@@ -446,6 +446,15 @@ config FB_RIVA_I2C
independently validate video mode parameters, you should say Y independently validate video mode parameters, you should say Y
here. 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 config FB_I810
tristate "Intel 810/815 support (EXPERIMENTAL)" tristate "Intel 810/815 support (EXPERIMENTAL)"
depends on FB && AGP && AGP_INTEL && EXPERIMENTAL && PCI depends on FB && AGP && AGP_INTEL && EXPERIMENTAL && PCI
......
...@@ -48,6 +48,9 @@ ...@@ -48,6 +48,9 @@
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
#endif #endif
#ifdef CONFIG_PMAC_BACKLIGHT
#include <asm/backlight.h>
#endif
#include "rivafb.h" #include "rivafb.h"
#include "nvreg.h" #include "nvreg.h"
...@@ -64,15 +67,16 @@ ...@@ -64,15 +67,16 @@
* various helpful macros and constants * various helpful macros and constants
* *
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
#ifdef CONFIG_FB_RIVA_DEBUG
#undef RIVAFBDEBUG #define NVTRACE printk
#ifdef RIVAFBDEBUG
#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
#else #else
#define DPRINTK(fmt, args...) #define NVTRACE if(0) printk
#endif #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) \ #define assert(expr) \
if(!(expr)) { \ if(!(expr)) { \
printk( "Assertion failed! %s,%s,%s,line=%d\n",\ printk( "Assertion failed! %s,%s,%s,line=%d\n",\
...@@ -173,18 +177,18 @@ static struct riva_chip_info { ...@@ -173,18 +177,18 @@ static struct riva_chip_info {
{ "GeForce2-GTS", NV_ARCH_10 }, { "GeForce2-GTS", NV_ARCH_10 },
{ "GeForce2-ULTRA", NV_ARCH_10 }, { "GeForce2-ULTRA", NV_ARCH_10 },
{ "Quadro2-PRO", NV_ARCH_10 }, { "Quadro2-PRO", NV_ARCH_10 },
{ "GeForce4-MX-460", NV_ARCH_20 }, { "GeForce4-MX-460", NV_ARCH_10 },
{ "GeForce4-MX-440", NV_ARCH_20 }, { "GeForce4-MX-440", NV_ARCH_10 },
{ "GeForce4-MX-420", NV_ARCH_20 }, { "GeForce4-MX-420", NV_ARCH_10 },
{ "GeForce4-440-GO", NV_ARCH_20 }, { "GeForce4-440-GO", NV_ARCH_10 },
{ "GeForce4-420-GO", NV_ARCH_20 }, { "GeForce4-420-GO", NV_ARCH_10 },
{ "GeForce4-420-GO-M32", NV_ARCH_20 }, { "GeForce4-420-GO-M32", NV_ARCH_10 },
{ "Quadro4-500-XGL", NV_ARCH_20 }, { "Quadro4-500-XGL", NV_ARCH_10 },
{ "GeForce4-440-GO-M64", NV_ARCH_20 }, { "GeForce4-440-GO-M64", NV_ARCH_10 },
{ "Quadro4-200", NV_ARCH_20 }, { "Quadro4-200", NV_ARCH_10 },
{ "Quadro4-550-XGL", NV_ARCH_20 }, { "Quadro4-550-XGL", NV_ARCH_10 },
{ "Quadro4-500-GOGL", NV_ARCH_20 }, { "Quadro4-500-GOGL", NV_ARCH_10 },
{ "GeForce2", NV_ARCH_20 }, { "GeForce2", NV_ARCH_10 },
{ "GeForce3", NV_ARCH_20 }, { "GeForce3", NV_ARCH_20 },
{ "GeForce3 Ti 200", NV_ARCH_20 }, { "GeForce3 Ti 200", NV_ARCH_20 },
{ "GeForce3 Ti 500", NV_ARCH_20 }, { "GeForce3 Ti 500", NV_ARCH_20 },
...@@ -351,6 +355,38 @@ static const struct riva_regs reg_template = { ...@@ -351,6 +355,38 @@ static const struct riva_regs reg_template = {
0xEB /* MISC */ 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 * MMIO access macros
...@@ -592,6 +628,7 @@ static void riva_save_state(struct riva_par *par, struct riva_regs *regs) ...@@ -592,6 +628,7 @@ static void riva_save_state(struct riva_par *par, struct riva_regs *regs)
{ {
int i; int i;
NVTRACE_ENTER();
par->riva.LockUnlock(&par->riva, 0); par->riva.LockUnlock(&par->riva, 0);
par->riva.UnloadStateExt(&par->riva, &regs->ext); par->riva.UnloadStateExt(&par->riva, &regs->ext);
...@@ -609,6 +646,7 @@ static void riva_save_state(struct riva_par *par, struct riva_regs *regs) ...@@ -609,6 +646,7 @@ static void riva_save_state(struct riva_par *par, struct riva_regs *regs)
for (i = 0; i < NUM_SEQ_REGS; i++) for (i = 0; i < NUM_SEQ_REGS; i++)
regs->seq[i] = SEQin(par, i); regs->seq[i] = SEQin(par, i);
NVTRACE_LEAVE();
} }
/** /**
...@@ -630,6 +668,7 @@ static void riva_load_state(struct riva_par *par, struct riva_regs *regs) ...@@ -630,6 +668,7 @@ static void riva_load_state(struct riva_par *par, struct riva_regs *regs)
RIVA_HW_STATE *state = &regs->ext; RIVA_HW_STATE *state = &regs->ext;
int i; int i;
NVTRACE_ENTER();
CRTCout(par, 0x11, 0x00); CRTCout(par, 0x11, 0x00);
par->riva.LockUnlock(&par->riva, 0); par->riva.LockUnlock(&par->riva, 0);
...@@ -656,6 +695,7 @@ static void riva_load_state(struct riva_par *par, struct riva_regs *regs) ...@@ -656,6 +695,7 @@ static void riva_load_state(struct riva_par *par, struct riva_regs *regs)
for (i = 0; i < NUM_SEQ_REGS; i++) for (i = 0; i < NUM_SEQ_REGS; i++)
SEQout(par, i, regs->seq[i]); SEQout(par, i, regs->seq[i]);
NVTRACE_LEAVE();
} }
/** /**
...@@ -676,6 +716,7 @@ static void riva_load_video_mode(struct fb_info *info) ...@@ -676,6 +716,7 @@ static void riva_load_video_mode(struct fb_info *info)
struct riva_par *par = (struct riva_par *) info->par; struct riva_par *par = (struct riva_par *) info->par;
struct riva_regs newmode; struct riva_regs newmode;
NVTRACE_ENTER();
/* time to calculate */ /* time to calculate */
rivafb_blank(1, info); rivafb_blank(1, info);
...@@ -806,10 +847,12 @@ static void riva_load_video_mode(struct fb_info *info) ...@@ -806,10 +847,12 @@ static void riva_load_video_mode(struct fb_info *info)
riva_load_state(par, &par->current_state); riva_load_state(par, &par->current_state);
par->riva.LockUnlock(&par->riva, 0); /* important for HW cursor */ par->riva.LockUnlock(&par->riva, 0); /* important for HW cursor */
rivafb_blank(0, info); rivafb_blank(0, info);
NVTRACE_LEAVE();
} }
static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb) static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb)
{ {
NVTRACE_ENTER();
var->xres = var->xres_virtual = modedb->xres; var->xres = var->xres_virtual = modedb->xres;
var->yres = modedb->yres; var->yres = modedb->yres;
if (var->yres_virtual < var->yres) if (var->yres_virtual < var->yres)
...@@ -824,6 +867,7 @@ static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode * ...@@ -824,6 +867,7 @@ static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *
var->vsync_len = modedb->vsync_len; var->vsync_len = modedb->vsync_len;
var->sync = modedb->sync; var->sync = modedb->sync;
var->vmode = modedb->vmode; var->vmode = modedb->vmode;
NVTRACE_LEAVE();
} }
/** /**
...@@ -859,6 +903,7 @@ static int rivafb_do_maximize(struct fb_info *info, ...@@ -859,6 +903,7 @@ static int rivafb_do_maximize(struct fb_info *info,
}; };
int i; int i;
NVTRACE_ENTER();
/* use highest possible virtual resolution */ /* use highest possible virtual resolution */
if (var->xres_virtual == -1 && var->yres_virtual == -1) { if (var->xres_virtual == -1 && var->yres_virtual == -1) {
printk(KERN_WARNING PFX printk(KERN_WARNING PFX
...@@ -871,7 +916,7 @@ static int rivafb_do_maximize(struct fb_info *info, ...@@ -871,7 +916,7 @@ static int rivafb_do_maximize(struct fb_info *info,
if (modes[i].xres == -1) { if (modes[i].xres == -1) {
printk(KERN_ERR PFX printk(KERN_ERR PFX
"could not find a virtual resolution that fits into video memory!!\n"); "could not find a virtual resolution that fits into video memory!!\n");
DPRINTK("EXIT - EINVAL error\n"); NVTRACE("EXIT - EINVAL error\n");
return -EINVAL; return -EINVAL;
} }
var->xres_virtual = modes[i].xres; var->xres_virtual = modes[i].xres;
...@@ -897,7 +942,7 @@ static int rivafb_do_maximize(struct fb_info *info, ...@@ -897,7 +942,7 @@ static int rivafb_do_maximize(struct fb_info *info,
printk(KERN_ERR PFX printk(KERN_ERR PFX
"mode %dx%dx%d rejected...resolution too high to fit into video memory!\n", "mode %dx%dx%d rejected...resolution too high to fit into video memory!\n",
var->xres, var->yres, var->bits_per_pixel); var->xres, var->yres, var->bits_per_pixel);
DPRINTK("EXIT - EINVAL error\n"); NVTRACE("EXIT - EINVAL error\n");
return -EINVAL; return -EINVAL;
} }
} }
...@@ -924,7 +969,7 @@ static int rivafb_do_maximize(struct fb_info *info, ...@@ -924,7 +969,7 @@ static int rivafb_do_maximize(struct fb_info *info,
var->yres_virtual = 0x7fff/nom; var->yres_virtual = 0x7fff/nom;
if (var->xres_virtual > 0x7fff/nom) if (var->xres_virtual > 0x7fff/nom)
var->xres_virtual = 0x7fff/nom; var->xres_virtual = 0x7fff/nom;
NVTRACE_LEAVE();
return 0; return 0;
} }
...@@ -1002,6 +1047,36 @@ static int riva_get_cmap_len(const struct fb_var_screeninfo *var) ...@@ -1002,6 +1047,36 @@ static int riva_get_cmap_len(const struct fb_var_screeninfo *var)
return rc; return rc;
} }
/* ------------------------------------------------------------------------- *
*
* 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 * framebuffer operations
...@@ -1013,6 +1088,7 @@ static int rivafb_open(struct fb_info *info, int user) ...@@ -1013,6 +1088,7 @@ static int rivafb_open(struct fb_info *info, int user)
struct riva_par *par = (struct riva_par *) info->par; struct riva_par *par = (struct riva_par *) info->par;
int cnt = atomic_read(&par->ref_count); int cnt = atomic_read(&par->ref_count);
NVTRACE_ENTER();
if (!cnt) { if (!cnt) {
memset(&par->state, 0, sizeof(struct vgastate)); memset(&par->state, 0, sizeof(struct vgastate));
par->state.flags = VGA_SAVE_MODE | VGA_SAVE_FONTS; par->state.flags = VGA_SAVE_MODE | VGA_SAVE_FONTS;
...@@ -1029,6 +1105,7 @@ static int rivafb_open(struct fb_info *info, int user) ...@@ -1029,6 +1105,7 @@ static int rivafb_open(struct fb_info *info, int user)
riva_save_state(par, &par->initial_state); riva_save_state(par, &par->initial_state);
} }
atomic_inc(&par->ref_count); atomic_inc(&par->ref_count);
NVTRACE_LEAVE();
return 0; return 0;
} }
...@@ -1037,6 +1114,7 @@ static int rivafb_release(struct fb_info *info, int user) ...@@ -1037,6 +1114,7 @@ static int rivafb_release(struct fb_info *info, int user)
struct riva_par *par = (struct riva_par *) info->par; struct riva_par *par = (struct riva_par *) info->par;
int cnt = atomic_read(&par->ref_count); int cnt = atomic_read(&par->ref_count);
NVTRACE_ENTER();
if (!cnt) if (!cnt)
return -EINVAL; return -EINVAL;
if (cnt == 1) { if (cnt == 1) {
...@@ -1047,6 +1125,7 @@ static int rivafb_release(struct fb_info *info, int user) ...@@ -1047,6 +1125,7 @@ static int rivafb_release(struct fb_info *info, int user)
par->riva.LockUnlock(&par->riva, 1); par->riva.LockUnlock(&par->riva, 1);
} }
atomic_dec(&par->ref_count); atomic_dec(&par->ref_count);
NVTRACE_LEAVE();
return 0; return 0;
} }
...@@ -1056,6 +1135,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1056,6 +1135,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
int nom, den; /* translating from pixels->bytes */ int nom, den; /* translating from pixels->bytes */
int mode_valid = 0; int mode_valid = 0;
NVTRACE_ENTER();
switch (var->bits_per_pixel) { switch (var->bits_per_pixel) {
case 1 ... 8: case 1 ... 8:
var->red.offset = var->green.offset = var->blue.offset = 0; var->red.offset = var->green.offset = var->blue.offset = 0;
...@@ -1101,7 +1181,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1101,7 +1181,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
printk(KERN_ERR PFX printk(KERN_ERR PFX
"mode %dx%dx%d rejected...color depth not supported.\n", "mode %dx%dx%d rejected...color depth not supported.\n",
var->xres, var->yres, var->bits_per_pixel); var->xres, var->yres, var->bits_per_pixel);
DPRINTK("EXIT, returning -EINVAL\n"); NVTRACE("EXIT, returning -EINVAL\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1191,6 +1271,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) ...@@ -1191,6 +1271,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
var->green.msb_right = var->green.msb_right =
var->blue.msb_right = var->blue.msb_right =
var->transp.offset = var->transp.length = var->transp.msb_right = 0; var->transp.offset = var->transp.length = var->transp.msb_right = 0;
NVTRACE_LEAVE();
return 0; return 0;
} }
...@@ -1198,6 +1279,7 @@ static int rivafb_set_par(struct fb_info *info) ...@@ -1198,6 +1279,7 @@ static int rivafb_set_par(struct fb_info *info)
{ {
struct riva_par *par = (struct riva_par *) info->par; struct riva_par *par = (struct riva_par *) info->par;
NVTRACE_ENTER();
riva_common_setup(par); riva_common_setup(par);
RivaGetConfig(&par->riva, par->Chipset); RivaGetConfig(&par->riva, par->Chipset);
/* vgaHWunlock() + riva unlock (0x7F) */ /* vgaHWunlock() + riva unlock (0x7F) */
...@@ -1211,6 +1293,7 @@ static int rivafb_set_par(struct fb_info *info) ...@@ -1211,6 +1293,7 @@ static int rivafb_set_par(struct fb_info *info)
info->fix.line_length = (info->var.xres_virtual * (info->var.bits_per_pixel >> 3)); info->fix.line_length = (info->var.xres_virtual * (info->var.bits_per_pixel >> 3));
info->fix.visual = (info->var.bits_per_pixel == 8) ? info->fix.visual = (info->var.bits_per_pixel == 8) ?
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR; FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
NVTRACE_LEAVE();
return 0; return 0;
} }
...@@ -1233,6 +1316,7 @@ static int rivafb_pan_display(struct fb_var_screeninfo *var, ...@@ -1233,6 +1316,7 @@ static int rivafb_pan_display(struct fb_var_screeninfo *var,
struct riva_par *par = (struct riva_par *)info->par; struct riva_par *par = (struct riva_par *)info->par;
unsigned int base; unsigned int base;
NVTRACE_ENTER();
if (var->xoffset > (var->xres_virtual - var->xres)) if (var->xoffset > (var->xres_virtual - var->xres))
return -EINVAL; return -EINVAL;
if (var->yoffset > (var->yres_virtual - var->yres)) if (var->yoffset > (var->yres_virtual - var->yres))
...@@ -1259,6 +1343,7 @@ static int rivafb_pan_display(struct fb_var_screeninfo *var, ...@@ -1259,6 +1343,7 @@ static int rivafb_pan_display(struct fb_var_screeninfo *var,
info->var.vmode |= FB_VMODE_YWRAP; info->var.vmode |= FB_VMODE_YWRAP;
else else
info->var.vmode &= ~FB_VMODE_YWRAP; info->var.vmode &= ~FB_VMODE_YWRAP;
NVTRACE_LEAVE();
return 0; return 0;
} }
...@@ -1270,6 +1355,7 @@ static int rivafb_blank(int blank, struct fb_info *info) ...@@ -1270,6 +1355,7 @@ static int rivafb_blank(int blank, struct fb_info *info)
tmp = SEQin(par, 0x01) & ~0x20; /* screen on/off */ tmp = SEQin(par, 0x01) & ~0x20; /* screen on/off */
vesa = CRTCin(par, 0x1a) & ~0xc0; /* sync on/off */ vesa = CRTCin(par, 0x1a) & ~0xc0; /* sync on/off */
NVTRACE_ENTER();
if (blank) { if (blank) {
tmp |= 0x20; tmp |= 0x20;
switch (blank - 1) { switch (blank - 1) {
...@@ -1288,6 +1374,14 @@ static int rivafb_blank(int blank, struct fb_info *info) ...@@ -1288,6 +1374,14 @@ static int rivafb_blank(int blank, struct fb_info *info)
} }
SEQout(par, 0x01, tmp); SEQout(par, 0x01, tmp);
CRTCout(par, 0x1a, vesa); CRTCout(par, 0x1a, vesa);
#ifdef CONFIG_PMAC_BACKLIGHT
if ( par->FlatPanel && _machine == _MACH_Pmac) {
set_backlight_enable(!blank);
}
#endif
NVTRACE_LEAVE();
return 0; return 0;
} }
...@@ -1676,6 +1770,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info) ...@@ -1676,6 +1770,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info)
{ {
unsigned int cmap_len; unsigned int cmap_len;
NVTRACE_ENTER();
info->flags = FBINFO_DEFAULT info->flags = FBINFO_DEFAULT
| FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_XPAN
| FBINFO_HWACCEL_YPAN | FBINFO_HWACCEL_YPAN
...@@ -1696,6 +1791,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info) ...@@ -1696,6 +1791,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info)
info->pixmap.scan_align = 4; info->pixmap.scan_align = 4;
info->pixmap.flags = FB_PIXMAP_SYSTEM; info->pixmap.flags = FB_PIXMAP_SYSTEM;
info->var.yres_virtual = -1; info->var.yres_virtual = -1;
NVTRACE_LEAVE();
return (rivafb_check_var(&info->var, info)); return (rivafb_check_var(&info->var, info));
} }
...@@ -1710,6 +1806,7 @@ static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) ...@@ -1710,6 +1806,7 @@ static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
"DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL }; "DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL };
int i; int i;
NVTRACE_ENTER();
dp = pci_device_to_OF_node(pd); dp = pci_device_to_OF_node(pd);
for (; dp != NULL; dp = dp->child) { for (; dp != NULL; dp = dp->child) {
disptype = (unsigned char *)get_property(dp, "display-type", NULL); disptype = (unsigned char *)get_property(dp, "display-type", NULL);
...@@ -1726,6 +1823,7 @@ static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd) ...@@ -1726,6 +1823,7 @@ static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
} }
} }
} }
NVTRACE_LEAVE();
return 0; return 0;
} }
#endif /* CONFIG_PPC_OF */ #endif /* CONFIG_PPC_OF */
...@@ -1735,6 +1833,7 @@ static void riva_update_default_var(struct fb_var_screeninfo *var, struct fb_inf ...@@ -1735,6 +1833,7 @@ static void riva_update_default_var(struct fb_var_screeninfo *var, struct fb_inf
struct fb_monspecs *specs = &info->monspecs; struct fb_monspecs *specs = &info->monspecs;
struct fb_videomode modedb; struct fb_videomode modedb;
NVTRACE_ENTER();
/* respect mode options */ /* respect mode options */
if (mode_option) { if (mode_option) {
fb_find_mode(var, info, mode_option, fb_find_mode(var, info, mode_option,
...@@ -1759,20 +1858,24 @@ static void riva_update_default_var(struct fb_var_screeninfo *var, struct fb_inf ...@@ -1759,20 +1858,24 @@ static void riva_update_default_var(struct fb_var_screeninfo *var, struct fb_inf
riva_update_var(var, &modedb); riva_update_var(var, &modedb);
} }
var->accel_flags |= FB_ACCELF_TEXT; var->accel_flags |= FB_ACCELF_TEXT;
NVTRACE_LEAVE();
} }
static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev) static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
{ {
struct riva_par *par;
int i;
NVTRACE_ENTER();
#ifdef CONFIG_PPC_OF #ifdef CONFIG_PPC_OF
if (!riva_get_EDID_OF(info, pdev)) if (!riva_get_EDID_OF(info, pdev))
printk("rivafb: could not retrieve EDID from OF\n"); printk("rivafb: could not retrieve EDID from OF\n");
#else #else
/* XXX use other methods later */ /* XXX use other methods later */
#ifdef CONFIG_FB_RIVA_I2C #ifdef CONFIG_FB_RIVA_I2C
struct riva_par *par = (struct riva_par *) info->par;
int i;
par = (struct riva_par *) info->par;
riva_create_i2c_busses(par); riva_create_i2c_busses(par);
for (i = par->bus; i >= 1; i--) { for (i = par->bus; i >= 1; i--) {
riva_probe_i2c_connector(par, i, &par->EDID); riva_probe_i2c_connector(par, i, &par->EDID);
...@@ -1784,6 +1887,7 @@ static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev) ...@@ -1784,6 +1887,7 @@ static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
riva_delete_i2c_busses(par); riva_delete_i2c_busses(par);
#endif #endif
#endif #endif
NVTRACE_LEAVE();
} }
...@@ -1813,6 +1917,7 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -1813,6 +1917,7 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
struct riva_par *default_par; struct riva_par *default_par;
struct fb_info *info; struct fb_info *info;
NVTRACE_ENTER();
assert(pd != NULL); assert(pd != NULL);
assert(rci != NULL); assert(rci != NULL);
...@@ -1958,6 +2063,12 @@ static int __devinit rivafb_probe(struct pci_dev *pd, ...@@ -1958,6 +2063,12 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
info->fix.id, info->fix.id,
info->fix.smem_len / (1024 * 1024), info->fix.smem_len / (1024 * 1024),
info->fix.smem_start); 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; return 0;
err_out_iounmap_fb: err_out_iounmap_fb:
...@@ -1986,6 +2097,7 @@ static void __exit rivafb_remove(struct pci_dev *pd) ...@@ -1986,6 +2097,7 @@ static void __exit rivafb_remove(struct pci_dev *pd)
struct fb_info *info = pci_get_drvdata(pd); struct fb_info *info = pci_get_drvdata(pd);
struct riva_par *par = (struct riva_par *) info->par; struct riva_par *par = (struct riva_par *) info->par;
NVTRACE_ENTER();
if (!info) if (!info)
return; return;
...@@ -2007,6 +2119,7 @@ static void __exit rivafb_remove(struct pci_dev *pd) ...@@ -2007,6 +2119,7 @@ static void __exit rivafb_remove(struct pci_dev *pd)
kfree(par); kfree(par);
kfree(info); kfree(info);
pci_set_drvdata(pd, NULL); pci_set_drvdata(pd, NULL);
NVTRACE_LEAVE();
} }
/* ------------------------------------------------------------------------- * /* ------------------------------------------------------------------------- *
...@@ -2020,6 +2133,7 @@ int __init rivafb_setup(char *options) ...@@ -2020,6 +2133,7 @@ int __init rivafb_setup(char *options)
{ {
char *this_opt; char *this_opt;
NVTRACE_ENTER();
if (!options || !*options) if (!options || !*options)
return 0; return 0;
...@@ -2043,6 +2157,7 @@ int __init rivafb_setup(char *options) ...@@ -2043,6 +2157,7 @@ int __init rivafb_setup(char *options)
} else } else
mode_option = this_opt; mode_option = this_opt;
} }
NVTRACE_LEAVE();
return 0; return 0;
} }
#endif /* !MODULE */ #endif /* !MODULE */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment