linux/drivers/video/fbdev/savage/savagefb_driver.c

/*
 * linux/drivers/video/savagefb.c -- S3 Savage Framebuffer Driver
 *
 * Copyright (c) 2001-2002  Denis Oliver Kropp <[email protected]>
 *                          Sven Neumann <[email protected]>
 *
 *
 * Card specific code is based on XFree86's savage driver.
 * Framebuffer framework code is based on code of cyber2000fb and tdfxfb.
 *
 * This file is subject to the terms and conditions of the GNU General
 * Public License.  See the file COPYING in the main directory of this
 * archive for more details.
 *
 * 0.4.0 (neo)
 *  - hardware accelerated clear and move
 *
 * 0.3.2 (dok)
 *  - wait for vertical retrace before writing to cr67
 *    at the beginning of savagefb_set_par
 *  - use synchronization registers cr23 and cr26
 *
 * 0.3.1 (dok)
 *  - reset 3D engine
 *  - don't return alpha bits for 32bit format
 *
 * 0.3.0 (dok)
 *  - added WaitIdle functions for all Savage types
 *  - do WaitIdle before mode switching
 *  - code cleanup
 *
 * 0.2.0 (dok)
 *  - first working version
 *
 *
 * TODO
 * - clock validations in decode_var
 *
 * BUGS
 * - white margin on bootup
 *
 */

#include <linux/aperture.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/fb.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/console.h>

#include <asm/io.h>
#include <asm/irq.h>

#include "savagefb.h"


#define SAVAGEFB_VERSION

/* --------------------------------------------------------------------- */


static char *mode_option =;

#ifdef MODULE

MODULE_AUTHOR("(c) 2001-2002  Denis Oliver Kropp <[email protected]>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("FBDev driver for S3 Savage PCI/AGP Chips");

#endif


/* --------------------------------------------------------------------- */

static void vgaHWSeqReset(struct savagefb_par *par, int start)
{}

static void vgaHWProtect(struct savagefb_par *par, int on)
{}

static void vgaHWRestore(struct savagefb_par  *par, struct savage_reg *reg)
{}

static void vgaHWInit(struct fb_var_screeninfo *var,
		      struct savagefb_par            *par,
		      struct xtimings                *timings,
		      struct savage_reg              *reg)
{}

/* -------------------- Hardware specific routines ------------------------- */

/*
 * Hardware Acceleration for SavageFB
 */

/* Wait for fifo space */
static void
savage3D_waitfifo(struct savagefb_par *par, int space)
{}

static void
savage4_waitfifo(struct savagefb_par *par, int space)
{}

static void
savage2000_waitfifo(struct savagefb_par *par, int space)
{}

/* Wait for idle accelerator */
static void
savage3D_waitidle(struct savagefb_par *par)
{}

static void
savage4_waitidle(struct savagefb_par *par)
{}

static void
savage2000_waitidle(struct savagefb_par *par)
{}

#ifdef CONFIG_FB_SAVAGE_ACCEL
static void
SavageSetup2DEngine(struct savagefb_par  *par)
{}

static void savagefb_set_clip(struct fb_info *info)
{}
#else
static void SavageSetup2DEngine(struct savagefb_par  *par) {}

#endif

static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1,
			    int min_n2, int max_n2, long freq_min,
			    long freq_max, unsigned int *mdiv,
			    unsigned int *ndiv, unsigned int *r)
{}

static int common_calc_clock(long freq, int min_m, int min_n1, int max_n1,
			     int min_n2, int max_n2, long freq_min,
			     long freq_max, unsigned char *mdiv,
			     unsigned char *ndiv)
{}

#ifdef SAVAGEFB_DEBUG
/* This function is used to debug, it prints out the contents of s3 regs */

static void SavagePrintRegs(struct savagefb_par *par)
{
	unsigned char i;
	int vgaCRIndex = 0x3d4;
	int vgaCRReg = 0x3d5;

	printk(KERN_DEBUG "SR    x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE "
	       "xF");

	for (i = 0; i < 0x70; i++) {
		if (!(i % 16))
			printk(KERN_DEBUG "\nSR%xx ", i >> 4);
		vga_out8(0x3c4, i, par);
		printk(KERN_DEBUG " %02x", vga_in8(0x3c5, par));
	}

	printk(KERN_DEBUG "\n\nCR    x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC "
	       "xD xE xF");

	for (i = 0; i < 0xB7; i++) {
		if (!(i % 16))
			printk(KERN_DEBUG "\nCR%xx ", i >> 4);
		vga_out8(vgaCRIndex, i, par);
		printk(KERN_DEBUG " %02x", vga_in8(vgaCRReg, par));
	}

	printk(KERN_DEBUG "\n\n");
}
#endif

/* --------------------------------------------------------------------- */

static void savage_get_default_par(struct savagefb_par *par, struct savage_reg *reg)
{}

static void savage_set_default_par(struct savagefb_par *par,
				struct savage_reg *reg)
{}

static void savage_update_var(struct fb_var_screeninfo *var,
			      const struct fb_videomode *modedb)
{}

static int savagefb_check_var(struct fb_var_screeninfo   *var,
			      struct fb_info *info)
{}


static int savagefb_decode_var(struct fb_var_screeninfo   *var,
			       struct savagefb_par        *par,
			       struct savage_reg          *reg)
{}

/* --------------------------------------------------------------------- */

/*
 *    Set a single color register. Return != 0 for invalid regno.
 */
static int savagefb_setcolreg(unsigned        regno,
			      unsigned        red,
			      unsigned        green,
			      unsigned        blue,
			      unsigned        transp,
			      struct fb_info *info)
{}

static void savagefb_set_par_int(struct savagefb_par  *par, struct savage_reg *reg)
{}

static void savagefb_update_start(struct savagefb_par *par, int base)
{}


static void savagefb_set_fix(struct fb_info *info)
{}

static int savagefb_set_par(struct fb_info *info)
{}

/*
 *    Pan or Wrap the Display
 */
static int savagefb_pan_display(struct fb_var_screeninfo *var,
				struct fb_info           *info)
{}

static int savagefb_blank(int blank, struct fb_info *info)
{}

static int savagefb_open(struct fb_info *info, int user)
{}

static int savagefb_release(struct fb_info *info, int user)
{}

static const struct fb_ops savagefb_ops =;

/* --------------------------------------------------------------------- */

static const struct fb_var_screeninfo savagefb_var800x600x8 =;

static void savage_enable_mmio(struct savagefb_par *par)
{}


static void savage_disable_mmio(struct savagefb_par *par)
{}


static int savage_map_mmio(struct fb_info *info)
{}

static void savage_unmap_mmio(struct fb_info *info)
{}

static int savage_map_video(struct fb_info *info, int video_len)
{}

static void savage_unmap_video(struct fb_info *info)
{}

static int savage_init_hw(struct savagefb_par *par)
{}

static int savage_init_fb_info(struct fb_info *info, struct pci_dev *dev,
			       const struct pci_device_id *id)
{}

/* --------------------------------------------------------------------- */

static int savagefb_probe(struct pci_dev *dev, const struct pci_device_id *id)
{}

static void savagefb_remove(struct pci_dev *dev)
{}

static int savagefb_suspend_late(struct device *dev, pm_message_t mesg)
{}

static int __maybe_unused savagefb_suspend(struct device *dev)
{}

static int __maybe_unused savagefb_hibernate(struct device *dev)
{}

static int __maybe_unused savagefb_freeze(struct device *dev)
{}

static int __maybe_unused savagefb_resume(struct device *dev)
{}

static const struct dev_pm_ops savagefb_pm_ops =;

static const struct pci_device_id savagefb_devices[] =;

MODULE_DEVICE_TABLE(pci, savagefb_devices);

static struct pci_driver savagefb_driver =;

/* **************************** exit-time only **************************** */

static void __exit savage_done(void)
{}


/* ************************* init in-kernel code ************************** */

static int __init savagefb_setup(char *options)
{}

static int __init savagefb_init(void)
{}

module_init();
module_exit(savage_done);

module_param(mode_option, charp, 0);
MODULE_PARM_DESC();