linux/drivers/video/fbdev/neofb.c

/*
 * linux/drivers/video/neofb.c -- NeoMagic Framebuffer Driver
 *
 * Copyright (c) 2001-2002  Denis Oliver Kropp <[email protected]>
 *
 *
 * Card specific code is based on XFree86's neomagic driver.
 * Framebuffer framework code is based on code of cyber2000fb.
 *
 * 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.1
 *  - Cosmetic changes (dok)
 *
 * 0.4
 *  - Toshiba Libretto support, allow modes larger than LCD size if
 *    LCD is disabled, keep BIOS settings if internal/external display
 *    haven't been enabled explicitly
 *                          (Thomas J. Moore <[email protected]>)
 *
 * 0.3.3
 *  - Porting over to new fbdev api. (jsimmons)
 *
 * 0.3.2
 *  - got rid of all floating point (dok)
 *
 * 0.3.1
 *  - added module license (dok)
 *
 * 0.3
 *  - hardware accelerated clear and move for 2200 and above (dok)
 *  - maximum allowed dotclock is handled now (dok)
 *
 * 0.2.1
 *  - correct panning after X usage (dok)
 *  - added module and kernel parameters (dok)
 *  - no stretching if external display is enabled (dok)
 *
 * 0.2
 *  - initial version (dok)
 *
 *
 * TODO
 * - ioctl for internal/external switching
 * - blanking
 * - 32bit depth support, maybe impossible
 * - disable pan-on-sync, need specs
 *
 * BUGS
 * - white margin on bootup like with tdfxfb (colormap problem?)
 *
 */

#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>
#ifdef CONFIG_TOSHIBA
#include <linux/toshiba.h>
#endif

#include <asm/io.h>
#include <asm/irq.h>
#include <video/vga.h>
#include <video/neomagic.h>

#define NEOFB_VERSION

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

static bool internal;
static bool external;
static bool libretto;
static bool nostretch;
static bool nopciburst;
static char *mode_option =;

#ifdef MODULE

MODULE_AUTHOR("(c) 2001-2002  Denis Oliver Kropp <[email protected]>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("FBDev driver for NeoMagic PCI Chips");
module_param(internal, bool, 0);
MODULE_PARM_DESC(internal, "Enable output on internal LCD Display.");
module_param(external, bool, 0);
MODULE_PARM_DESC(external, "Enable output on external CRT.");
module_param(libretto, bool, 0);
MODULE_PARM_DESC(libretto, "Force Libretto 100/110 800x480 LCD.");
module_param(nostretch, bool, 0);
MODULE_PARM_DESC(nostretch,
		 "Disable stretching of modes smaller than LCD.");
module_param(nopciburst, bool, 0);
MODULE_PARM_DESC(nopciburst, "Disable PCI burst mode.");
module_param(mode_option, charp, 0);
MODULE_PARM_DESC(mode_option, "Preferred video mode ('640x480-8@60', etc)");

#endif


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

static biosMode bios8[] =;

static biosMode bios16[] =;

static biosMode bios24[] =;

#ifdef NO_32BIT_SUPPORT_YET
/* FIXME: guessed values, wrong */
static biosMode bios32[] = {
	{640, 480, 0x33},
	{800, 600, 0x36},
	{1024, 768, 0x39}
};
#endif

static inline void write_le32(int regindex, u32 val, const struct neofb_par *par)
{}

static int neoFindMode(int xres, int yres, int depth)
{}

/*
 * neoCalcVCLK --
 *
 * Determine the closest clock frequency to the one requested.
 */
#define MAX_N
#define MAX_D
#define MAX_F

static void neoCalcVCLK(const struct fb_info *info,
			struct neofb_par *par, long freq)
{}

/*
 * vgaHWInit --
 *      Handle the initialization, etc. of a screen.
 *      Return FALSE on failure.
 */

static int vgaHWInit(const struct fb_var_screeninfo *var,
		     struct neofb_par *par)
{}

static void vgaHWLock(struct vgastate *state)
{}

static void vgaHWUnlock(void)
{}

static void neoLock(struct vgastate *state)
{}

static void neoUnlock(void)
{}

/*
 * VGA Palette management
 */
static int paletteEnabled =;

static inline void VGAenablePalette(void)
{}

static inline void VGAdisablePalette(void)
{}

static inline void VGAwATTR(u8 index, u8 value)
{}

static void vgaHWProtect(int on)
{}

static void vgaHWRestore(const struct fb_info *info,
			 const struct neofb_par *par)
{}


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

/*
 * Hardware Acceleration for Neo2200+
 */
static inline int neo2200_sync(struct fb_info *info)
{}

static inline void neo2200_wait_fifo(struct fb_info *info,
				     int requested_fifo_space)
{}

static inline void neo2200_accel_init(struct fb_info *info,
				      struct fb_var_screeninfo *var)
{}

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

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

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

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

static int neofb_set_par(struct fb_info *info)
{}

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

static int neofb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
			   u_int transp, struct fb_info *fb)
{}

/*
 *    (Un)Blank the display.
 */
static int neofb_blank(int blank_mode, struct fb_info *info)
{}

static void
neo2200_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{}

static void
neo2200_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{}

static void
neo2200_imageblit(struct fb_info *info, const struct fb_image *image)
{}

static void
neofb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{}

static void
neofb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{}

static void
neofb_imageblit(struct fb_info *info, const struct fb_image *image)
{}

static int
neofb_sync(struct fb_info *info)
{}

/*
static void
neofb_draw_cursor(struct fb_info *info, u8 *dst, u8 *src, unsigned int width)
{
	//memset_io(info->sprite.addr, 0xff, 1);
}

static int
neofb_cursor(struct fb_info *info, struct fb_cursor *cursor)
{
	struct neofb_par *par = (struct neofb_par *) info->par;

	* Disable cursor *
	write_le32(NEOREG_CURSCNTL, ~NEO_CURS_ENABLE, par);

	if (cursor->set & FB_CUR_SETPOS) {
		u32 x = cursor->image.dx;
		u32 y = cursor->image.dy;

		info->cursor.image.dx = x;
		info->cursor.image.dy = y;
		write_le32(NEOREG_CURSX, x, par);
		write_le32(NEOREG_CURSY, y, par);
	}

	if (cursor->set & FB_CUR_SETSIZE) {
		info->cursor.image.height = cursor->image.height;
		info->cursor.image.width = cursor->image.width;
	}

	if (cursor->set & FB_CUR_SETHOT)
		info->cursor.hot = cursor->hot;

	if (cursor->set & FB_CUR_SETCMAP) {
		if (cursor->image.depth == 1) {
			u32 fg = cursor->image.fg_color;
			u32 bg = cursor->image.bg_color;

			info->cursor.image.fg_color = fg;
			info->cursor.image.bg_color = bg;

			fg = ((fg & 0xff0000) >> 16) | ((fg & 0xff) << 16) | (fg & 0xff00);
			bg = ((bg & 0xff0000) >> 16) | ((bg & 0xff) << 16) | (bg & 0xff00);
			write_le32(NEOREG_CURSFGCOLOR, fg, par);
			write_le32(NEOREG_CURSBGCOLOR, bg, par);
		}
	}

	if (cursor->set & FB_CUR_SETSHAPE)
		fb_load_cursor_image(info);

	if (info->cursor.enable)
		write_le32(NEOREG_CURSCNTL, NEO_CURS_ENABLE, par);
	return 0;
}
*/

static const struct fb_ops neofb_ops =;

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

static struct fb_videomode mode800x480 =;

static int neo_map_mmio(struct fb_info *info, struct pci_dev *dev)
{}

static void neo_unmap_mmio(struct fb_info *info)
{}

static int neo_map_video(struct fb_info *info, struct pci_dev *dev,
			 int video_len)
{}

static void neo_unmap_video(struct fb_info *info)
{}

static int neo_scan_monitor(struct fb_info *info)
{}

static int neo_init_hw(struct fb_info *info)
{}


static struct fb_info *neo_alloc_fb_info(struct pci_dev *dev,
					 const struct pci_device_id *id)
{}

static void neo_free_fb_info(struct fb_info *info)
{}

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

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

static void neofb_remove(struct pci_dev *dev)
{}

static const struct pci_device_id neofb_devices[] =;

MODULE_DEVICE_TABLE(pci, neofb_devices);

static struct pci_driver neofb_driver =;

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

#ifndef MODULE
static int __init neofb_setup(char *options)
{}
#endif  /*  MODULE  */

static int __init neofb_init(void)
{}

module_init();

#ifdef MODULE
static void __exit neofb_exit(void)
{
	pci_unregister_driver(&neofb_driver);
}

module_exit(neofb_exit);
#endif				/* MODULE */