⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pm3fb.c

📁 S3C44B0X下的LCD (framebuffer)驱动资料与相关代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/* *  linux/drivers/video/pm3fb.c -- 3DLabs Permedia3 frame buffer device *   *  Copyright (C) 2001 Romain Dolbeau <dolbeau@irisa.fr> *  Based on code written by: *           Sven Luther, <luther@dpt-info.u-strasbg.fr> *           Alan Hourihane, <alanh@fairlite.demon.co.uk> *           Russel King, <rmk@arm.linux.org.uk> *  Based on linux/drivers/video/skeletonfb.c: *	Copyright (C) 1997 Geert Uytterhoeven *  Based on linux/driver/video/pm2fb.c: *      Copyright (C) 1998-1999 Ilario Nardinocchi (nardinoc@CS.UniBO.IT) *      Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) * *  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. * *  $Header: /cvsroot/linux/drivers/video/pm3fb.c,v 1.1 2002/02/25 19:11:06 marcelo Exp $ * *  CHANGELOG: *  Mon Feb 11 10:35:48 MET 2002, v 1.4.11B: Cosmetic update. *  Wed Jan 23 14:16:59 MET 2002, v 1.4.11: Preliminary 2.5.x support, patch for 2.5.2. *  Wed Nov 28 11:08:29 MET 2001, v 1.4.10: potential bug fix for SDRAM-based board, patch for 2.4.16. *  Thu Sep 20 10:24:42 MET DST 2001, v 1.4.9: sync bug fix, preliminary flatpanel support, better timings. *  Tue Aug 28 10:13:01 MET DST 2001, v 1.4.8: memory timings check, minor bug fixes. *  Wed Jul 18 19:06:14 CEST 2001, v 1.4.7: Mode fix (800x600-100, 1024x768-100 changed), using HW panning + accel bug fix. *  Mon Jun 25 10:33:56 MET DST 2001, v 1.4.6: Depth 12 fix, chip reset ioctl, moved memory erase ioctl to DEBUG. *  Wed Jun 20 11:13:08 MET DST 2001, v 1.4.5: Fixed missing blinking cursor in 8bpp, code cleaning, memory erase IOCTL. *  Mon Jun 18 16:00:27 CEST 2001, v 1.4.4: Depth 12 (RGBA 4444) support, code cleaning. *  Fri Jun 15 13:53:01 CEST 2001, v 1.4.3: Removed warnings, depth 15 support, add 'depth' option. *  Thu Jun 14 10:13:52 MET DST 2001, v 1.4.2: Fixed depth switching bug, preliminary 15bpp (RGB5551) support. *  Thu Apr 12 11:16:45 MET DST 2001, v 1.4.1B: Doc updates. *  Fri Apr  6 11:12:53 MET DST 2001, v 1.4.1: Configure.help, minor cleanup *  Thu Mar 29 10:56:50 MET DST 2001, v 1.4.0: Module & module options support (note: linux patch changed, 2.2.19 added). *  Thu Mar 15 15:30:31 MET 2001, v 1.3.2: Fixed mirroring bug on little-endian. *  Wed Mar 14 21:25:54 CET 2001, v 1.3.1: Fixed bug in BlockMove (_bmov). *  Tue Mar 13 10:53:19 MET 2001, v 1.3.0: Character drawing hardware support (in all width between 1 and 16), fixes. *  Thu Mar  8 10:20:16 MET 2001, v 1.2.2: Better J2000 support, "font:" option. *  Tue Mar  6 21:25:04 CET 2001, v 1.2.1: Better acceleration support. *  Mon Mar  5 21:54:17 CET 2001, v 1.2.0: Partial acceleration support (clear & bmove) *  Mon Mar  5 12:52:15 CET 2001, v 1.1.3: Big pan_display fix. *  Sun Mar  4 22:21:50 CET 2001, v 1.1.2: (numerous) bug fixes. *  Fri Mar  2 15:54:07 CET 2001, v 1.1.1: Might have Appian J2000 support, resource mangement in 2.4 *  Wed Feb 28 18:21:35 CET 2001, v 1.1.0: Might have multiple boards support (added, but not yest tested) *  Tue Feb 27 17:31:12 CET 2001, v 1.0.6: fixes boot-time mode select, add more default mode *  Tue Feb 27 14:01:36 CET 2001, v 1.0.5: fixes (1.0.4 was broken for 2.2), cleaning up *  Mon Feb 26 23:17:36 CET 2001, v 1.0.4: preliminary 2.4.x support, dropped (useless on pm3) partial product, more OF fix *  Mon Feb 26 20:59:05 CET 2001, v 1.0.3: No more shadow register (and wasted memory), endianess fix, use OF-preset resolution by default *  Wed Feb 21 22:09:30 CET 2001, v 1.0.2: Code cleaning for future multiboard support, better OF support, bugs fix *  Wed Feb 21 19:58:56 CET 2001, v 1.0.1: OpenFirmware support, fixed memory detection, better debug support, code cleaning *  Wed Feb 21 14:47:06 CET 2001, v 1.0.0: First working version */#include <linux/config.h>#include <linux/module.h>#include <linux/version.h>#include <linux/kernel.h>#include <linux/errno.h>#include <linux/string.h>#include <linux/mm.h>#include <linux/tty.h>#include <linux/slab.h>#include <linux/vmalloc.h>#include <linux/delay.h>#include <linux/interrupt.h>#include <linux/fb.h>#include <linux/init.h>#include <linux/pci.h>#include <linux/ioport.h>#include <video/fbcon.h>#include <video/fbcon-mfb.h>#include <video/fbcon-cfb2.h>#include <video/fbcon-cfb4.h>#include <video/fbcon-cfb8.h>#include <video/fbcon-cfb16.h>#include <video/fbcon-cfb24.h>#include <video/fbcon-cfb32.h>#include <asm/io.h>#include <asm/uaccess.h>#ifdef CONFIG_FB_OF#include <asm/prom.h>#endif#include "pm3fb.h"/* ************************************* *//* ***** The various "global" data ***** *//* ************************************* *//* those will need a rework for multiple board support *//* Driver name */static const char permedia3_name[16] = "Permedia3";/* the fb_par struct, mandatory */struct pm3fb_par {	u32 pixclock;		/* pixclock in KHz */	u32 width;		/* width of virtual screen */	u32 height;		/* height of virtual screen */	u32 hsstart;		/* horiz. sync start */	u32 hsend;		/* horiz. sync end */	u32 hbend;		/* horiz. blank end (also gate end) */	u32 htotal;		/* total width (w/ sync & blank) */	u32 vsstart;		/* vert. sync start */	u32 vsend;		/* vert. sync end */	u32 vbend;		/* vert. blank end */	u32 vtotal;		/* total height (w/ sync & blank) */	u32 stride;		/* screen stride */	u32 base;		/* screen base (xoffset+yoffset) in 128 bits unit */	/* NOTE : unlike other pm3 stuff above, stored *after* shiftbpp. don't ask */	u32 depth;		/* screen depth (8, 12, 15, 16 or 32) */	u32 video;		/* video control (hsync,vsync) */};/* memory timings */struct pm3fb_timings{	unsigned long caps;	unsigned long timings;	unsigned long control;	unsigned long refresh;	unsigned long powerdown;};typedef enum pm3fb_timing_result { pm3fb_timing_ok, pm3fb_timing_problem, pm3fb_timing_retry } pm3fb_timing_result;#define PM3FB_UNKNOWN_TIMING_VALUE ((unsigned long)-1)#define PM3FB_UNKNOWN_TIMINGS { PM3FB_UNKNOWN_TIMING_VALUE, PM3FB_UNKNOWN_TIMING_VALUE, PM3FB_UNKNOWN_TIMING_VALUE, PM3FB_UNKNOWN_TIMING_VALUE, PM3FB_UNKNOWN_TIMING_VALUE }/* the fb_info struct, mandatory */struct pm3fb_info {	struct fb_info_gen gen;	unsigned long board_num; /* internal board number */	unsigned long use_current;	struct pm3fb_par *current_par;	struct pci_dev *dev;    /* PCI device */#ifdef SUPPORT_FB_OF	struct device_node *dn; /* OF node for the PCI device */#endif /* SUPPORT_FB_OF */	unsigned long board_type; /* index in the cardbase */	unsigned char *fb_base;	/* framebuffer memory base */	u32 fb_size;		/* framebuffer memory size */	unsigned char *p_fb;	/* physical address of frame buffer */	unsigned char *v_fb;	/* virtual address of frame buffer */	unsigned char *pIOBase;	/* physical address of registers region, must be rg_base or rg_base+PM2_REGS_SIZE depending on the host endianness */	unsigned char *vIOBase;	/* address of registers after ioremap() */	struct {		u8 transp;		u8 red;		u8 green;		u8 blue;	} palette[256];	union {#ifdef FBCON_HAS_CFB16		u16 cmap12[16]; /* RGBA 4444 */		u16 cmap15[16]; /* RGBA 5551 */		u16 cmap16[16]; /* RGBA 5650 */#endif#ifdef FBCON_HAS_CFB32		u32 cmap32[16];#endif	} cmap;	struct pm3fb_timings memt;};/* regular resolution database*/static struct {	char name[16];	struct pm3fb_par user_mode;} mode_base[] __initdata = {	{		"default-800x600", {	49500, 800, 600, 16, 96, 256, 1056, 1, 4, 25, 625,			    800, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}}, {		"1024x768-74", {	78752, 1024, 768, 32, 128, 304, 1328, 1, 4, 38,			    806, 1024, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}}, {		"1024x768-74-32", {			78752, 1024, 768, 32, 128, 304, 1328, 1, 4, 38,			806, 1024, 0, 32,			PM3VideoControl_ENABLE |			PM3VideoControl_HSYNC_ACTIVE_HIGH			|			PM3VideoControl_VSYNC_ACTIVE_HIGH			| PM3VideoControl_PIXELSIZE_32BIT}},/* Generated mode : "1600x1024", for the SGI 1600SW flat panel*/	{		"SGI1600SW", {			108000, 1600, 1024, 16, 56, 104, 1704, 3, 6, 32,			1056, 1600, 0, 8,			PM3VideoControl_ENABLE|			PM3VideoControl_HSYNC_ACTIVE_LOW|PM3VideoControl_VSYNC_ACTIVE_LOW|			PM3VideoControl_PIXELSIZE_32BIT}}, /* ##### auto-generated mode, by fbtimings2pm3 *//* Generated mode : "640x480-60" */	{		"640x480-60", {	25174, 640, 480, 16, 112, 160, 800, 10, 12, 45,			    525, 640, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_LOW			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "640x480-72" */	{		"640x480-72", {	31199, 640, 480, 24, 64, 192, 832, 9, 12, 40, 520,			    640, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_LOW			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "640x480-75" */	{		"640x480-75", {	31499, 640, 480, 16, 80, 200, 840, 1, 4, 20, 500,			    640, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_LOW			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "640x480-90" */	{		"640x480-90", {	39909, 640, 480, 32, 72, 192, 832, 25, 39, 53, 533,			    640, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_LOW			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "640x480-100" */	{		"640x480-100", {	44899, 640, 480, 32, 160, 208, 848, 22, 34, 51,			    531, 640, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_LOW			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "800x600-48-lace" *//* INTERLACED NOT SUPPORTED  {"800x600-48-lace", {35999, 800, 600, 80, 208, 264, 1064, 11, 23, 102, 702, 800, 0, 8, PM3VideoControl_ENABLE|PM3VideoControl_HSYNC_ACTIVE_HIGH|PM3VideoControl_VSYNC_ACTIVE_HIGH|PM3VideoControl_PIXELSIZE_8BIT}},    INTERLACED NOT SUPPORTED *//* Generated mode : "800x600-56" */	{		"800x600-56", {	35999, 800, 600, 24, 96, 224, 1024, 1, 3, 25, 625,			    800, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "800x600-60" */	{		"800x600-60", {	40000, 800, 600, 40, 168, 256, 1056, 1, 5, 28, 628,			    800, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "800x600-70" */	{		"800x600-70", {	44899, 800, 600, 24, 168, 208, 1008, 9, 21, 36,			    636, 800, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "800x600-72" */	{		"800x600-72", {	50000, 800, 600, 56, 176, 240, 1040, 37, 43, 66,			    666, 800, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "800x600-75" */	{		"800x600-75", {	49497, 800, 600, 16, 96, 256, 1056, 1, 4, 25, 625,			    800, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "800x600-90" */	{		"800x600-90", {	56637, 800, 600, 8, 72, 192, 992, 8, 19, 35, 635,			    800, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "800x600-100", from /etc/fb.modes *//* DISABLED, hsstart == 0	{		"800x600-100", {	67499, 800, 600, 0, 64, 280, 1080, 7, 11, 25, 625,			    800, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}},*//* Generated mode : "800x600-100", from ??? */	{		"800x600-100", {			69650, 800, 600, 64, 128, 288, 1088, 4, 10, 40, 640, 800, 0, 8,			PM3VideoControl_ENABLE|PM3VideoControl_HSYNC_ACTIVE_LOW|			PM3VideoControl_VSYNC_ACTIVE_LOW|PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "1024x768-43-lace" *//* INTERLACED NOT SUPPORTED  {"1024x768-43-lace", {44899, 1024, 768, 8, 184, 240, 1264, 1, 9, 49, 817, 1024, 0, 8, PM3VideoControl_ENABLE|PM3VideoControl_HSYNC_ACTIVE_HIGH|PM3VideoControl_VSYNC_ACTIVE_HIGH|PM3VideoControl_PIXELSIZE_8BIT}},    INTERLACED NOT SUPPORTED *//* Generated mode : "1024x768-60" */	{		"1024x768-60", {	64998, 1024, 768, 24, 160, 320, 1344, 3, 9, 38,			    806, 1024, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_LOW			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "1024x768-70" */	{		"1024x768-70", {	74996, 1024, 768, 24, 160, 304, 1328, 3, 9, 38,			    806, 1024, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_LOW			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "1024x768-72" */	{		"1024x768-72", {	74996, 10224, 768, 24, 160, 264, 10488, 3, 9, 38,			    806, 10224, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_LOW			    |			    PM3VideoControl_VSYNC_ACTIVE_LOW			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "1024x768-75" */	{		"1024x768-75", {	78746, 1024, 768, 16, 112, 288, 1312, 1, 4, 32,			    800, 1024, 0, 8,			    PM3VideoControl_ENABLE |			    PM3VideoControl_HSYNC_ACTIVE_HIGH			    |			    PM3VideoControl_VSYNC_ACTIVE_HIGH			    | PM3VideoControl_PIXELSIZE_8BIT}},/* Generated mode : "1024x768-90" */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -