#undef SST_DEBUG
#include <linux/aperture.h>
#include <linux/string.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/fb.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <asm/io.h>
#include <linux/uaccess.h>
#include <video/sstfb.h>
static bool vgapass;
static int mem;
static bool clipping = …;
static int gfxclk;
static bool slowpci;
#define DEFAULT_VIDEO_MODE …
static char *mode_option = …;
enum { … };
#define IS_VOODOO2(par) …
static struct sst_spec voodoo_spec[] = …;
#if (SST_DEBUG_REG > 0)
static void sst_dbg_print_read_reg(u32 reg, u32 val) {
const char *regname;
switch (reg) {
case FBIINIT0: regname = "FbiInit0"; break;
case FBIINIT1: regname = "FbiInit1"; break;
case FBIINIT2: regname = "FbiInit2"; break;
case FBIINIT3: regname = "FbiInit3"; break;
case FBIINIT4: regname = "FbiInit4"; break;
case FBIINIT5: regname = "FbiInit5"; break;
case FBIINIT6: regname = "FbiInit6"; break;
default: regname = NULL; break;
}
if (regname == NULL)
r_ddprintk("sst_read(%#x): %#x\n", reg, val);
else
r_dprintk(" sst_read(%s): %#x\n", regname, val);
}
static void sst_dbg_print_write_reg(u32 reg, u32 val) {
const char *regname;
switch (reg) {
case FBIINIT0: regname = "FbiInit0"; break;
case FBIINIT1: regname = "FbiInit1"; break;
case FBIINIT2: regname = "FbiInit2"; break;
case FBIINIT3: regname = "FbiInit3"; break;
case FBIINIT4: regname = "FbiInit4"; break;
case FBIINIT5: regname = "FbiInit5"; break;
case FBIINIT6: regname = "FbiInit6"; break;
default: regname = NULL; break;
}
if (regname == NULL)
r_ddprintk("sst_write(%#x, %#x)\n", reg, val);
else
r_dprintk(" sst_write(%s, %#x)\n", regname, val);
}
#else
#define sst_dbg_print_read_reg(reg, val) …
#define sst_dbg_print_write_reg(reg, val) …
#endif
#define sst_read(reg) …
#define sst_write(reg,val) …
#define sst_set_bits(reg,val) …
#define sst_unset_bits(reg,val) …
#define sst_dac_read(reg) …
#define sst_dac_write(reg,val) …
#define dac_i_read(reg) …
#define dac_i_write(reg,val) …
static inline u32 __sst_read(u8 __iomem *vbase, u32 reg)
{ … }
static inline void __sst_write(u8 __iomem *vbase, u32 reg, u32 val)
{ … }
static inline void __sst_set_bits(u8 __iomem *vbase, u32 reg, u32 val)
{ … }
static inline void __sst_unset_bits(u8 __iomem *vbase, u32 reg, u32 val)
{ … }
#define sst_wait_idle() …
static int __sst_wait_idle(u8 __iomem *vbase)
{ … }
static u8 __sst_dac_read(u8 __iomem *vbase, u8 reg)
{ … }
static void __sst_dac_write(u8 __iomem *vbase, u8 reg, u8 val)
{ … }
static u32 __dac_i_read(u8 __iomem *vbase, u8 reg)
{ … }
static void __dac_i_write(u8 __iomem *vbase, u8 reg,u8 val)
{ … }
static int sst_calc_pll(const int freq, int *freq_out, struct pll_timing *t)
{ … }
static void sstfb_clear_screen(struct fb_info *info)
{ … }
static int sstfb_check_var(struct fb_var_screeninfo *var,
struct fb_info *info)
{ … }
static int sstfb_set_par(struct fb_info *info)
{ … }
static int sstfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info)
{ … }
static void sstfb_setvgapass( struct fb_info *info, int enable )
{ … }
#ifdef CONFIG_FB_DEVICE
static ssize_t store_vgapass(struct device *device, struct device_attribute *attr,
const char *buf, size_t count)
{ … }
static ssize_t show_vgapass(struct device *device, struct device_attribute *attr,
char *buf)
{ … }
static struct device_attribute device_attrs[] = …;
#endif
static int sstfb_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg)
{ … }
#if 0
static void sstfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
struct sstfb_par *par = info->par;
u32 stride = info->fix.line_length;
if (!IS_VOODOO2(par))
return;
sst_write(BLTSRCBASEADDR, 0);
sst_write(BLTDSTBASEADDR, 0);
sst_write(BLTROP, BLTROP_COPY);
sst_write(BLTXYSTRIDES, stride | (stride << 16));
sst_write(BLTSRCXY, area->sx | (area->sy << 16));
sst_write(BLTDSTXY, area->dx | (area->dy << 16));
sst_write(BLTSIZE, area->width | (area->height << 16));
sst_write(BLTCOMMAND, BLT_SCR2SCR_BITBLT | LAUNCH_BITBLT |
(BLT_16BPP_FMT << 3) | BIT(15) );
sst_wait_idle();
}
#endif
#if 0
static void sstfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{
struct sstfb_par *par = info->par;
u32 stride = info->fix.line_length;
if (!IS_VOODOO2(par))
return;
sst_write(BLTCLIPX, info->var.xres);
sst_write(BLTCLIPY, info->var.yres);
sst_write(BLTDSTBASEADDR, 0);
sst_write(BLTCOLOR, rect->color);
sst_write(BLTROP, rect->rop == ROP_COPY ? BLTROP_COPY : BLTROP_XOR);
sst_write(BLTXYSTRIDES, stride | (stride << 16));
sst_write(BLTDSTXY, rect->dx | (rect->dy << 16));
sst_write(BLTSIZE, rect->width | (rect->height << 16));
sst_write(BLTCOMMAND, BLT_RECFILL_BITBLT | LAUNCH_BITBLT
| (BLT_16BPP_FMT << 3) | BIT(15) | BIT(16) );
sst_wait_idle();
}
#endif
static int sst_get_memsize(struct fb_info *info, __u32 *memsize)
{ … }
static int sst_detect_att(struct fb_info *info)
{ … }
static int sst_detect_ti(struct fb_info *info)
{ … }
static int sst_detect_ics(struct fb_info *info)
{ … }
static int sst_set_pll_att_ti(struct fb_info *info,
const struct pll_timing *t, const int clock)
{ … }
static int sst_set_pll_ics(struct fb_info *info,
const struct pll_timing *t, const int clock)
{ … }
static void sst_set_vidmod_att_ti(struct fb_info *info, const int bpp)
{ … }
static void sst_set_vidmod_ics(struct fb_info *info, const int bpp)
{ … }
static struct dac_switch dacs[] = …;
static int sst_detect_dactype(struct fb_info *info, struct sstfb_par *par)
{ … }
static int sst_init(struct fb_info *info, struct sstfb_par *par)
{ … }
static void sst_shutdown(struct fb_info *info)
{ … }
static int sstfb_setup(char *options)
{ … }
static const struct fb_ops sstfb_ops = …;
static int sstfb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{ … }
static void sstfb_remove(struct pci_dev *pdev)
{ … }
static const struct pci_device_id sstfb_id_tbl[] = …;
static struct pci_driver sstfb_driver = …;
static int sstfb_init(void)
{ … }
static void sstfb_exit(void)
{ … }
module_init(…) …;
module_exit(sstfb_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_param(mem, int, 0);
MODULE_PARM_DESC(…) …;
module_param(vgapass, bool, 0);
MODULE_PARM_DESC(…) …;
module_param(clipping, bool, 0);
MODULE_PARM_DESC(…) …;
module_param(gfxclk, int, 0);
MODULE_PARM_DESC(…) …;
module_param(slowpci, bool, 0);
MODULE_PARM_DESC(…) …;
module_param(mode_option, charp, 0);
MODULE_PARM_DESC(…) …;