summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-10 23:18:26 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-10 23:18:26 +0000
commitc7c4310f7fc1485925d800628bf50b3aeab535ef (patch)
treeb12aa4be0e8fb82aaaea97fb475e793e8a347c49 /drivers/video
parent1ffd1d069ca4c5ffe16fea6175dab1b9bbb15820 (diff)
Merge with Linux 2.4.0-test3-pre8. Linus has accepted most of what
I've sent him, so we're very close to full integration of the MIPS port into his sources.
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/aty128fb.c174
-rw-r--r--drivers/video/matrox/matroxfb_crtc2.c40
-rw-r--r--drivers/video/matrox/matroxfb_maven.c4
-rw-r--r--drivers/video/valkyriefb.c2
-rw-r--r--drivers/video/valkyriefb.h2
5 files changed, 101 insertions, 121 deletions
diff --git a/drivers/video/aty128fb.c b/drivers/video/aty128fb.c
index cf3512043..0770f4448 100644
--- a/drivers/video/aty128fb.c
+++ b/drivers/video/aty128fb.c
@@ -75,9 +75,9 @@
#undef DEBUG
#ifdef DEBUG
-#define DBG(x) printk(KERN_DEBUG "aty128fb: %s\n",(x));
+#define DBG(fmt, args...) printk(KERN_DEBUG "aty128fb: %s " fmt, __FUNCTION__, ##args);
#else
-#define DBG(x)
+#define DBG(fmt, args...)
#endif
#ifndef CONFIG_PPC
@@ -104,10 +104,20 @@ static struct fb_var_screeninfo default_var = {
#ifndef MODULE
/* default modedb mode */
+/* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */
static struct fb_videomode defaultmode __initdata = {
- /* 640x480, 60 Hz, Non-Interlaced (25.172 MHz dotclock) */
- NULL, 60, 640, 480, 39722, 48, 16, 33, 10, 96, 2,
- 0, FB_VMODE_NONINTERLACED
+ refresh: 60,
+ xres: 640,
+ yres: 480,
+ pixclock: 39722,
+ left_margin: 48,
+ right_margin: 16,
+ upper_margin: 33,
+ lower_margin: 10,
+ hsync_len: 96,
+ vsync_len: 2,
+ sync: 0,
+ vmode: FB_VMODE_NONINTERLACED
};
#endif /* MODULE */
@@ -141,32 +151,30 @@ static const struct aty128_chip_info aty128_pci_probe_list[] __initdata =
/* packed BIOS settings */
#ifndef CONFIG_PPC
-#pragma pack(1)
typedef struct {
- u8 clock_chip_type;
- u8 struct_size;
- u8 accelerator_entry;
- u8 VGA_entry;
- u16 VGA_table_offset;
- u16 POST_table_offset;
- u16 XCLK;
- u16 MCLK;
- u8 num_PLL_blocks;
- u8 size_PLL_blocks;
- u16 PCLK_ref_freq;
- u16 PCLK_ref_divider;
- u32 PCLK_min_freq;
- u32 PCLK_max_freq;
- u16 MCLK_ref_freq;
- u16 MCLK_ref_divider;
- u32 MCLK_min_freq;
- u32 MCLK_max_freq;
- u16 XCLK_ref_freq;
- u16 XCLK_ref_divider;
- u32 XCLK_min_freq;
- u32 XCLK_max_freq;
-} PLL_BLOCK;
-#pragma pack()
+ u8 clock_chip_type;
+ u8 struct_size;
+ u8 accelerator_entry;
+ u8 VGA_entry;
+ u16 VGA_table_offset;
+ u16 POST_table_offset;
+ u16 XCLK;
+ u16 MCLK;
+ u8 num_PLL_blocks;
+ u8 size_PLL_blocks;
+ u16 PCLK_ref_freq;
+ u16 PCLK_ref_divider;
+ u32 PCLK_min_freq;
+ u32 PCLK_max_freq;
+ u16 MCLK_ref_freq;
+ u16 MCLK_ref_divider;
+ u32 MCLK_min_freq;
+ u32 MCLK_max_freq;
+ u16 XCLK_ref_freq;
+ u16 XCLK_ref_divider;
+ u32 XCLK_min_freq;
+ u32 XCLK_max_freq;
+} __attribute__ ((packed)) PLL_BLOCK;
#endif /* !CONFIG_PPC */
/* onboard memory information */
@@ -194,12 +202,9 @@ static const struct aty128_meminfo sdr_sgram =
static const struct aty128_meminfo ddr_sgram =
{ 4, 4, 3, 3, 2, 3, 1, 16, 31, 16, "64-bit DDR SGRAM" };
-static int currcon = 0;
-
-static char *aty128fb_name = "ATY Rage128";
+static const char *aty128fb_name = "ATY Rage128";
static char fontname[40] __initdata = { 0 };
-static char noaccel __initdata = 0;
-static unsigned int initdepth __initdata = 8;
+static int noaccel __initdata = 0;
#ifndef MODULE
static const char *mode_option __initdata = NULL;
@@ -291,13 +296,14 @@ struct fb_info_aty128 {
u32 cfb32[16];
#endif
} fbcon_cmap;
- int blitter_may_be_busy;
#ifdef CONFIG_PCI
struct pci_dev *pdev;
#endif
#ifdef CONFIG_MTRR
struct { int vram; int vram_valid; } mtrr;
#endif
+ int currcon;
+ int blitter_may_be_busy;
int fifo_slots; /* free slots in FIFO (64 max) */
};
@@ -515,10 +521,8 @@ aty_pll_wait_readupdate(const struct fb_info_aty128 *info)
break;
}
-#ifdef DEBUG
if (reset) /* reset engine?? */
- DBG("PLL write timeout!");
-#endif
+ printk(KERN_DEBUG "aty128fb: PLL write timeout!");
}
@@ -645,9 +649,7 @@ aty128_reset_engine(const struct fb_info_aty128 *info)
/* use old pio mode */
aty_st_le32(PM4_BUFFER_CNTL, PM4_BUFFER_CNTL_NONPM4);
-#ifdef DEBUG
DBG("engine reset");
-#endif
}
@@ -1075,12 +1077,10 @@ aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
pll->feedback_divider = round_div(n, d);
pll->vclk = vclk;
-#ifdef DEBUG
- printk(KERN_DEBUG "var_to_pll: post %d feedback %d vlck %d output %d ref_divider %d\n",
- pll->post_divider, pll->feedback_divider, vclk, output_freq,
- c.ref_divider);
- printk(KERN_DEBUG "var_to_pll: vclk_per: %d\n", period_in_ps);
-#endif
+ DBG("post %d feedback %d vlck %d output %d ref_divider %d "
+ "vclk_per: %d\n", pll->post_divider,
+ pll->feedback_divider, vclk, output_freq,
+ c.ref_divider, period_in_ps);
return 0;
}
@@ -1134,9 +1134,8 @@ aty128_ddafifo(struct aty128_ddafifo *dsp,
m->Tr2w +
x;
-#ifdef DEBUG
- printk(KERN_DEBUG "aty128fb: x %x\n", x);
-#endif
+ DBG("x %x\n", x);
+
b = 0;
while (x) {
x >>= 1;
@@ -1155,10 +1154,9 @@ aty128_ddafifo(struct aty128_ddafifo *dsp,
return -EINVAL;
}
-#ifdef DEBUG
- printk(KERN_DEBUG "aty128fb: p: %x rloop: %x x: %x ron: %x roff: %x\n",
- p, m->Rloop, x, ron, roff);
-#endif
+ DBG("p: %x rloop: %x x: %x ron: %x roff: %x\n",
+ p, m->Rloop, x, ron, roff);
+
dsp->dda_config = p << 16 | m->Rloop << 20 | x;
dsp->dda_on_off = ron << 16 | roff;
@@ -1543,7 +1541,12 @@ static int
aty128fb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info)
{
- if (con == currcon) /* current console? */
+#if 1
+ fb_copy_cmap(&info->cmap, cmap, kspc ? 0 : 2);
+#else
+ struct fb_info_aty128 fb = (struct fb_info_aty128 *)info;
+
+ if (con == fb->currcon) /* current console? */
return fb_get_cmap(cmap, kspc, aty128_getcolreg, info);
else if (fb_display[con].cmap.len) /* non default colormap? */
fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
@@ -1551,6 +1554,7 @@ aty128fb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
int size = (fb_display[con].var.bits_per_pixel <= 8) ? 256 : 32;
fb_copy_cmap(fb_default_cmap(size), cmap, kspc ? 0 : 2);
}
+#endif
return 0;
}
@@ -1564,6 +1568,7 @@ aty128fb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
struct fb_info *info)
{
int err;
+ struct fb_info_aty128 *fb = (struct fb_info_aty128 *)info;
struct display *disp;
if (con >= 0)
@@ -1577,7 +1582,7 @@ aty128fb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
return err;
}
- if (con == currcon) /* current console? */
+ if (con == fb->currcon) /* current console? */
return fb_set_cmap(cmap, kspc, aty128_setcolreg, info);
else
fb_copy_cmap(cmap, &disp->cmap, kspc ? 0 : 1);
@@ -1632,24 +1637,6 @@ aty128fb_setup(char *options)
fontname[i] = 0;
} else if (!strncmp(this_opt, "noaccel", 7)) {
noaccel = 1;
- } else if (!strncmp(this_opt, "depth:", 6)) {
- unsigned int depth = simple_strtoul(this_opt+6, NULL, 0);
- switch (depth) {
- case 0 ... 8:
- initdepth = 8;
- break;
- case 9 ... 16:
- initdepth = 16;
- break;
- case 17 ... 24:
- initdepth = 24;
- break;
- case 25 ... 32:
- initdepth = 32;
- break;
- default:
- initdepth = 8;
- }
}
#ifdef CONFIG_MTRR
else if(!strncmp(this_opt, "nomtrr", 6)) {
@@ -1762,7 +1749,7 @@ aty128_init(struct fb_info_aty128 *info, const char *name)
#endif /* CONFIG_PPC */
{
if (fb_find_mode(&var, &info->fb_info, mode_option, NULL, 0,
- &defaultmode, initdepth) == 0)
+ &defaultmode, 8) == 0)
var = default_var;
}
#endif /* MODULE */
@@ -1859,16 +1846,6 @@ aty128_pci_register(struct pci_dev *pdev,
u32 fb_addr, reg_addr, io_addr = 0;
int err;
-#if 0
- /* Request resources we're going to use */
- io_addr = pci_resource_start(pdev, 1);
- if (!request_region(io_addr, pci_resource_len(pdev, 1),
- "aty128fb IO")) {
- printk(KERN_ERR "aty128fb: cannot reserve I/O ports\n");
- goto err_out_none;
- }
-#endif
-
fb_addr = pci_resource_start(pdev, 0);
if (!request_mem_region(fb_addr, pci_resource_len(pdev, 0),
"aty128fb FB")) {
@@ -1894,6 +1871,8 @@ aty128_pci_register(struct pci_dev *pdev,
/* Copy PCI device info into info->pdev */
info->pdev = pdev;
+ info->currcon = -1;
+
/* Virtualize mmio region */
info->regbase_phys = reg_addr;
info->regbase = ioremap(reg_addr, 0x1FFF);
@@ -1966,7 +1945,6 @@ err_free_mmio:
err_free_fb:
release_mem_region(pci_resource_start(pdev, 1),
pci_resource_len(pdev, 1));
-err_out_none:
return -ENODEV;
}
#endif /* CONFIG_PCI */
@@ -2072,13 +2050,12 @@ aty128_get_pllinfo(struct fb_info_aty128 *info)
if (bios_seg)
iounmap(bios_seg);
-#ifdef DEBUG
- printk(KERN_DEBUG "get_pllinfo: ppll_max %d ppll_min %d xclk %d "
- "ref_divider %d dotclock %d\n",
- info->constants.ppll_max, info->constants.ppll_min,
- info->constants.xclk, info->constants.ref_divider,
- info->constants.dotclock);
-#endif
+ DBG("ppll_max %d ppll_min %d xclk %d "
+ "ref_divider %d dotclock %d\n",
+ info->constants.ppll_max, info->constants.ppll_min,
+ info->constants.xclk, info->constants.ref_divider,
+ info->constants.dotclock);
+
return;
}
#endif /* !CONFIG_PPC */
@@ -2159,11 +2136,12 @@ aty128fbcon_switch(int con, struct fb_info *fb)
struct aty128fb_par par;
/* Do we have to save the colormap? */
- if (fb_display[currcon].cmap.len)
- fb_get_cmap(&fb_display[currcon].cmap, 1, aty128_getcolreg, fb);
+ if (fb_display[info->currcon].cmap.len)
+ fb_get_cmap(&fb_display[info->currcon].cmap, 1,
+ aty128_getcolreg, fb);
/* set the current console */
- currcon = con;
+ info->currcon = con;
aty128_decode_var(&fb_display[con].var, &par, info);
aty128_set_par(&par, info);
@@ -2319,7 +2297,9 @@ aty128_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
static void
do_install_cmap(int con, struct fb_info *info)
{
- if (con != currcon)
+ struct fb_info_aty128 *fb = (struct fb_info_aty128 *)info;
+
+ if (con != fb->currcon)
return;
if (fb_display[con].cmap.len)
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c
index f4824762b..fff0a4f39 100644
--- a/drivers/video/matrox/matroxfb_crtc2.c
+++ b/drivers/video/matrox/matroxfb_crtc2.c
@@ -85,7 +85,7 @@ static void matroxfb_dh_restore(struct matroxfb_dh_fb_info* m2info,
int mode,
unsigned int pos) {
u_int32_t tmp;
- struct matrox_fb_info* minfo = m2info->primary_dev;
+ MINFO_FROM(m2info->primary_dev);
switch (mode) {
case 15:
@@ -250,9 +250,9 @@ static void initMatroxDH(struct matroxfb_dh_fb_info* m2info, struct display* p)
static int matroxfb_dh_open(struct fb_info* info, int user) {
#define m2info ((struct matroxfb_dh_fb_info*)info)
- struct matrox_fb_info* minfo = m2info->primary_dev;
+ MINFO_FROM(m2info->primary_dev);
- if (minfo) {
+ if (MINFO) {
if (ACCESS_FBINFO(dead)) {
return -ENXIO;
}
@@ -263,9 +263,9 @@ static int matroxfb_dh_open(struct fb_info* info, int user) {
static int matroxfb_dh_release(struct fb_info* info, int user) {
#define m2info ((struct matroxfb_dh_fb_info*)info)
- struct matrox_fb_info* minfo = m2info->primary_dev;
+ MINFO_FROM(m2info->primary_dev);
- if (minfo) {
+ if (MINFO) {
}
return 0;
#undef m2info
@@ -320,7 +320,7 @@ static int matroxfb_dh_set_var(struct fb_var_screeninfo* var, int con,
int cmap_len;
int mode;
int err;
- struct matrox_fb_info* minfo = m2info->primary_dev;
+ MINFO_FROM(m2info->primary_dev);
if (con < 0)
p = m2info->fbcon.disp;
@@ -477,7 +477,7 @@ static int matroxfb_dh_pan_display(struct fb_var_screeninfo* var, int con,
static int matroxfb_dh_switch(int con, struct fb_info* info);
static int matroxfb_dh_get_vblank(const struct matroxfb_dh_fb_info* m2info, struct fb_vblank* vblank) {
- struct matrox_fb_info* minfo = m2info->primary_dev;
+ MINFO_FROM(m2info->primary_dev);
memset(vblank, 0, sizeof(*vblank));
vblank->flags = FB_VBLANK_HAVE_VCOUNT | FB_VBLANK_HAVE_VBLANK;
@@ -496,7 +496,7 @@ static int matroxfb_dh_ioctl(struct inode* inode,
int con,
struct fb_info* info) {
#define m2info ((struct matroxfb_dh_fb_info*)info)
- struct matrox_fb_info* minfo = m2info->primary_dev;
+ MINFO_FROM(m2info->primary_dev);
DBG("matroxfb_crtc2_ioctl")
@@ -516,7 +516,7 @@ static int matroxfb_dh_ioctl(struct inode* inode,
case MATROXFB_GET_OUTPUT_MODE:
case MATROXFB_GET_ALL_OUTPUTS:
{
- return ACCESS_FBINFO(fbcon.fbops)->fb_ioctl(inode, file, cmd, arg, con, &minfo->fbcon);
+ return ACCESS_FBINFO(fbcon.fbops)->fb_ioctl(inode, file, cmd, arg, con, &ACCESS_FBINFO(fbcon));
}
case MATROXFB_SET_OUTPUT_CONNECTION:
{
@@ -660,15 +660,15 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) {
if (mem < 64*1024)
mem *= 1024;
mem &= ~0x00000FFF; /* PAGE_MASK? */
- if (minfo->video.len_usable + mem <= minfo->video.len)
- m2info->video.offbase = minfo->video.len - mem;
- else if (minfo->video.len < mem) {
+ if (ACCESS_FBINFO(video.len_usable) + mem <= ACCESS_FBINFO(video.len))
+ m2info->video.offbase = ACCESS_FBINFO(video.len) - mem;
+ else if (ACCESS_FBINFO(video.len) < mem) {
kfree(d);
return -ENOMEM;
} else { /* check yres on first head... */
m2info->video.borrowed = mem;
- minfo->video.len_usable -= mem;
- m2info->video.offbase = minfo->video.len_usable;
+ ACCESS_FBINFO(video.len_usable) -= mem;
+ m2info->video.offbase = ACCESS_FBINFO(video.len_usable);
}
m2info->video.base = ACCESS_FBINFO(video.base) + m2info->video.offbase;
m2info->video.len = m2info->video.len_usable = m2info->video.len_maximum = mem;
@@ -698,8 +698,8 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) {
matroxfb_dh_set_var(&matroxfb_dh_defined, -1, &m2info->fbcon);
}
down_write(&ACCESS_FBINFO(crtc2.lock));
- oldcrtc2 = minfo->crtc2.info;
- minfo->crtc2.info = &m2info->fbcon;
+ oldcrtc2 = ACCESS_FBINFO(crtc2.info);
+ ACCESS_FBINFO(crtc2.info) = &m2info->fbcon;
up_write(&ACCESS_FBINFO(crtc2.lock));
if (oldcrtc2) {
printk(KERN_ERR "matroxfb_crtc2: Internal consistency check failed: crtc2 already present: %p\n",
@@ -731,9 +731,9 @@ static void matroxfb_dh_deregisterfb(struct matroxfb_dh_fb_info* m2info) {
struct fb_info* crtc2;
down_write(&ACCESS_FBINFO(crtc2.lock));
- crtc2 = minfo->crtc2.info;
+ crtc2 = ACCESS_FBINFO(crtc2.info);
if (crtc2 == &m2info->fbcon)
- minfo->crtc2.info = NULL;
+ ACCESS_FBINFO(crtc2.info) = NULL;
up_write(&ACCESS_FBINFO(crtc2.lock));
if (crtc2 != &m2info->fbcon) {
printk(KERN_ERR "matroxfb_crtc2: Internal consistency check failed: crtc2 mismatch at unload: %p != %p\n",
@@ -756,7 +756,7 @@ static void* matroxfb_crtc2_probe(struct matrox_fb_info* minfo) {
struct matroxfb_dh_fb_info* m2info;
/* hardware is CRTC2 incapable... */
- if (!minfo->devflags.crtc2)
+ if (!ACCESS_FBINFO(devflags.crtc2))
return NULL;
m2info = (struct matroxfb_dh_fb_info*)kmalloc(sizeof(*m2info), GFP_KERNEL);
if (!m2info) {
@@ -764,7 +764,7 @@ static void* matroxfb_crtc2_probe(struct matrox_fb_info* minfo) {
return NULL;
}
memset(m2info, 0, sizeof(*m2info));
- m2info->primary_dev = minfo;
+ m2info->primary_dev = MINFO;
if (matroxfb_dh_registerfb(m2info)) {
kfree(m2info);
printk(KERN_ERR "matroxfb_crtc2: CRTC2 framebuffer failed to register\n");
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c
index e7d515ec2..57b822293 100644
--- a/drivers/video/matrox/matroxfb_maven.c
+++ b/drivers/video/matrox/matroxfb_maven.c
@@ -892,9 +892,9 @@ static struct matrox_altout maven_altout = {
static int maven_init_client(struct i2c_client* clnt) {
struct i2c_adapter* a = clnt->adapter;
- struct matroxfb_dh_maven_info* m2info = ((struct i2c_bit_adapter*)a)->minfo;
struct maven_data* md = clnt->data;
- struct matrox_fb_info* minfo = m2info->primary_dev;
+ struct matroxfb_dh_maven_info* m2info __attribute__((unused)) = ((struct i2c_bit_adapter*)a)->minfo;
+ MINFO_FROM(m2info->primary_dev);
md->mode = MODE_MONITOR;
md->primary_head = MINFO;
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c
index 6a4e41e9e..23fc97915 100644
--- a/drivers/video/valkyriefb.c
+++ b/drivers/video/valkyriefb.c
@@ -4,7 +4,7 @@
* Created 8 August 1998 by Martin Costabel and Kevin Schoedel
*
* Vmode-switching changes and vmode 15/17 modifications created 29 August
- * 1998 by Barry Nathan <barryn@pobox.com>.
+ * 1998 by Barry K. Nathan <barryn@pobox.com>.
*
* Derived directly from:
*
diff --git a/drivers/video/valkyriefb.h b/drivers/video/valkyriefb.h
index ee246a4fc..c8984b38b 100644
--- a/drivers/video/valkyriefb.h
+++ b/drivers/video/valkyriefb.h
@@ -4,7 +4,7 @@
* Created 8 August 1998 by Martin Costabel and Kevin Schoedel
*
* Vmode-switching changes and vmode 15/17 modifications created 29 August
- * 1998 by Barry Nathan <barryn@pobox.com>.
+ * 1998 by Barry K. Nathan <barryn@pobox.com>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License