[PATCH] gx1fb: (try to) play nicer with various BIOSes
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / video / amifb.c
CommitLineData
1da177e4
LT
1/*
2 * linux/drivers/video/amifb.c -- Amiga builtin chipset frame buffer device
3 *
4 * Copyright (C) 1995-2003 Geert Uytterhoeven
5 *
6 * with work by Roman Zippel
7 *
8 *
9 * This file is based on the Atari frame buffer device (atafb.c):
10 *
11 * Copyright (C) 1994 Martin Schaller
12 * Roman Hodek
13 *
14 * with work by Andreas Schwab
15 * Guenther Kelleter
16 *
17 * and on the original Amiga console driver (amicon.c):
18 *
19 * Copyright (C) 1993 Hamish Macdonald
20 * Greg Harp
21 * Copyright (C) 1994 David Carter [carter@compsci.bristol.ac.uk]
22 *
23 * with work by William Rucklidge (wjr@cs.cornell.edu)
24 * Geert Uytterhoeven
25 * Jes Sorensen (jds@kom.auc.dk)
26 *
27 *
28 * History:
29 *
30 * - 24 Jul 96: Copper generates now vblank interrupt and
31 * VESA Power Saving Protocol is fully implemented
32 * - 14 Jul 96: Rework and hopefully last ECS bugs fixed
33 * - 7 Mar 96: Hardware sprite support by Roman Zippel
34 * - 18 Feb 96: OCS and ECS support by Roman Zippel
35 * Hardware functions completely rewritten
36 * - 2 Dec 95: AGA version by Geert Uytterhoeven
37 *
38 * This file is subject to the terms and conditions of the GNU General Public
39 * License. See the file COPYING in the main directory of this archive
40 * for more details.
41 */
42
43#include <linux/module.h>
44#include <linux/kernel.h>
45#include <linux/errno.h>
46#include <linux/string.h>
47#include <linux/mm.h>
48#include <linux/tty.h>
49#include <linux/slab.h>
50#include <linux/delay.h>
51#include <linux/config.h>
52#include <linux/interrupt.h>
53#include <linux/fb.h>
54#include <linux/init.h>
55#include <linux/ioport.h>
56
57#include <asm/uaccess.h>
58#include <asm/system.h>
59#include <asm/irq.h>
60#include <asm/amigahw.h>
61#include <asm/amigaints.h>
62#include <asm/setup.h>
63
64#include "c2p.h"
65
66
67#define DEBUG
68
69#if !defined(CONFIG_FB_AMIGA_OCS) && !defined(CONFIG_FB_AMIGA_ECS) && !defined(CONFIG_FB_AMIGA_AGA)
70#define CONFIG_FB_AMIGA_OCS /* define at least one fb driver, this will change later */
71#endif
72
73#if !defined(CONFIG_FB_AMIGA_OCS)
74# define IS_OCS (0)
75#elif defined(CONFIG_FB_AMIGA_ECS) || defined(CONFIG_FB_AMIGA_AGA)
76# define IS_OCS (chipset == TAG_OCS)
77#else
78# define CONFIG_FB_AMIGA_OCS_ONLY
79# define IS_OCS (1)
80#endif
81
82#if !defined(CONFIG_FB_AMIGA_ECS)
83# define IS_ECS (0)
84#elif defined(CONFIG_FB_AMIGA_OCS) || defined(CONFIG_FB_AMIGA_AGA)
85# define IS_ECS (chipset == TAG_ECS)
86#else
87# define CONFIG_FB_AMIGA_ECS_ONLY
88# define IS_ECS (1)
89#endif
90
91#if !defined(CONFIG_FB_AMIGA_AGA)
92# define IS_AGA (0)
93#elif defined(CONFIG_FB_AMIGA_OCS) || defined(CONFIG_FB_AMIGA_ECS)
94# define IS_AGA (chipset == TAG_AGA)
95#else
96# define CONFIG_FB_AMIGA_AGA_ONLY
97# define IS_AGA (1)
98#endif
99
100#ifdef DEBUG
101# define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
102#else
103# define DPRINTK(fmt, args...)
104#endif
105
106/*******************************************************************************
107
108
109 Generic video timings
110 ---------------------
111
112 Timings used by the frame buffer interface:
113
114 +----------+---------------------------------------------+----------+-------+
115 | | ^ | | |
116 | | |upper_margin | | |
117