xref: /linux/drivers/video/fbdev/controlfb.h (revision ac831a379d34109451b3c41a44a20ee10ecb615f)
1f7018c21STomi Valkeinen /*
2f7018c21STomi Valkeinen  * controlfb_hw.h: Constants of all sorts for controlfb
3f7018c21STomi Valkeinen  *
4f7018c21STomi Valkeinen  * Copyright (C) 1998 Daniel Jacobowitz <dan@debian.org>
5f7018c21STomi Valkeinen  *
6f7018c21STomi Valkeinen  * This program is free software; you can redistribute it and/or
7f7018c21STomi Valkeinen  * modify it under the terms of the GNU General Public License
8f7018c21STomi Valkeinen  * as published by the Free Software Foundation; either version
9f7018c21STomi Valkeinen  * 2 of the License, or (at your option) any later version.
10f7018c21STomi Valkeinen  *
11f7018c21STomi Valkeinen  * Based on an awful lot of code, including:
12f7018c21STomi Valkeinen  *
13f7018c21STomi Valkeinen  * control.c: Console support for PowerMac "control" display adaptor.
14f7018c21STomi Valkeinen  * Copyright (C) 1996 Paul Mackerras.
15f7018c21STomi Valkeinen  *
16f7018c21STomi Valkeinen  * The so far unpublished platinumfb.c
17f7018c21STomi Valkeinen  * Copyright (C) 1998 Jon Howell
18f7018c21STomi Valkeinen  */
19f7018c21STomi Valkeinen 
20f7018c21STomi Valkeinen /*
21f7018c21STomi Valkeinen  * Structure of the registers for the RADACAL colormap device.
22f7018c21STomi Valkeinen  */
23f7018c21STomi Valkeinen struct cmap_regs {
24f7018c21STomi Valkeinen 	unsigned char addr;	/* index for both cmap and misc registers */
25f7018c21STomi Valkeinen 	char pad1[15];
26f7018c21STomi Valkeinen 	unsigned char crsr;	/* cursor palette */
27f7018c21STomi Valkeinen 	char pad2[15];
28f7018c21STomi Valkeinen 	unsigned char dat;	/* RADACAL misc register data */
29f7018c21STomi Valkeinen 	char pad3[15];
30f7018c21STomi Valkeinen 	unsigned char lut;	/* cmap data */
31f7018c21STomi Valkeinen 	char pad4[15];
32f7018c21STomi Valkeinen };
33f7018c21STomi Valkeinen 
34f7018c21STomi Valkeinen /*
35f7018c21STomi Valkeinen  * Structure of the registers for the "control" display adaptor.
36f7018c21STomi Valkeinen  */
37f7018c21STomi Valkeinen #define PAD(x)	char x[12]
38f7018c21STomi Valkeinen 
39f7018c21STomi Valkeinen struct preg {			/* padded register */
40f7018c21STomi Valkeinen 	unsigned r;
41f7018c21STomi Valkeinen 	char pad[12];
42f7018c21STomi Valkeinen };
43f7018c21STomi Valkeinen 
44f7018c21STomi Valkeinen struct control_regs {
45f7018c21STomi Valkeinen 	struct preg vcount;	/* vertical counter */
46f7018c21STomi Valkeinen 	/* Vertical parameters are in units of 1/2 scan line */
47f7018c21STomi Valkeinen 	struct preg vswin;	/* between vsblank and vssync */
48f7018c21STomi Valkeinen 	struct preg vsblank;	/* vert start blank */
49f7018c21STomi Valkeinen 	struct preg veblank;	/* vert end blank (display start) */
50f7018c21STomi Valkeinen 	struct preg vewin;	/* between vesync and veblank */
51f7018c21STomi Valkeinen 	struct preg vesync;	/* vert end sync */
52f7018c21STomi Valkeinen 	struct preg vssync;	/* vert start sync */
53f7018c21STomi Valkeinen 	struct preg vperiod;	/* vert period */
54f7018c21STomi Valkeinen 	struct preg piped;	/* pipe delay hardware cursor */
55f7018c21STomi Valkeinen 	/* Horizontal params are in units of 2 pixels */
56f7018c21STomi Valkeinen 	struct preg hperiod;	/* horiz period - 2 */
57f7018c21STomi Valkeinen 	struct preg hsblank;	/* horiz start blank */
58f7018c21STomi Valkeinen 	struct preg heblank;	/* horiz end blank */
59f7018c21STomi Valkeinen 	struct preg hesync;	/* horiz end sync */
60f7018c21STomi Valkeinen 	struct preg hssync;	/* horiz start sync */
61f7018c21STomi Valkeinen 	struct preg heq;	/* half horiz sync len */
62f7018c21STomi Valkeinen 	struct preg hlfln;	/* half horiz period */
63f7018c21STomi Valkeinen 	struct preg hserr;	/* horiz period - horiz sync len */
64f7018c21STomi Valkeinen 	struct preg cnttst;
65f7018c21STomi Valkeinen 	struct preg ctrl;	/* display control */
66f7018c21STomi Valkeinen 	struct preg start_addr;	/* start address: 5 lsbs zero */
67f7018c21STomi Valkeinen 	struct preg pitch;	/* addrs diff between scan lines */
68f7018c21STomi Valkeinen 	struct preg mon_sense;	/* monitor sense bits */
69f7018c21STomi Valkeinen 	struct preg vram_attr;	/* enable vram banks */
70f7018c21STomi Valkeinen 	struct preg mode;
71f7018c21STomi Valkeinen 	struct preg rfrcnt;	/* refresh count */
72f7018c21STomi Valkeinen 	struct preg intr_ena;	/* interrupt enable */
73f7018c21STomi Valkeinen 	struct preg intr_stat;	/* interrupt status */
74f7018c21STomi Valkeinen 	struct preg res[5];
75f7018c21STomi Valkeinen };
76f7018c21STomi Valkeinen 
77f7018c21STomi Valkeinen struct control_regints {
78f7018c21STomi Valkeinen 	/* Vertical parameters are in units of 1/2 scan line */
79f7018c21STomi Valkeinen 	unsigned vswin;	/* between vsblank and vssync */
80f7018c21STomi Valkeinen 	unsigned vsblank;	/* vert start blank */
81f7018c21STomi Valkeinen 	unsigned veblank;	/* vert end blank (display start) */
82f7018c21STomi Valkeinen 	unsigned vewin;	/* between vesync and veblank */
83f7018c21STomi Valkeinen 	unsigned vesync;	/* vert end sync */
84f7018c21STomi Valkeinen 	unsigned vssync;	/* vert start sync */
85f7018c21STomi Valkeinen 	unsigned vperiod;	/* vert period */
86f7018c21STomi Valkeinen 	unsigned piped;		/* pipe delay hardware cursor */
87f7018c21STomi Valkeinen 	/* Horizontal params are in units of 2 pixels */
88f7018c21STomi Valkeinen 	/* Except, apparently, for hres > 1024 (or == 1280?) */
89f7018c21STomi Valkeinen 	unsigned hperiod;	/* horiz period - 2 */
90f7018c21STomi Valkeinen 	unsigned hsblank;	/* horiz start blank */
91f7018c21STomi Valkeinen 	unsigned heblank;	/* horiz end blank */
92f7018c21STomi Valkeinen 	unsigned hesync;	/* horiz end sync */
93f7018c21STomi Valkeinen 	unsigned hssync;	/* horiz start sync */
94f7018c21STomi Valkeinen 	unsigned heq;		/* half horiz sync len */
95f7018c21STomi Valkeinen 	unsigned hlfln;		/* half horiz period */
96f7018c21STomi Valkeinen 	unsigned hserr;		/* horiz period - horiz sync len */
97f7018c21STomi Valkeinen };
98f7018c21STomi Valkeinen 
99f7018c21STomi Valkeinen /*
100f7018c21STomi Valkeinen  * Dot clock rate is
101f7018c21STomi Valkeinen  * 3.9064MHz * 2**clock_params[2] * clock_params[1] / clock_params[0].
102f7018c21STomi Valkeinen  */
103f7018c21STomi Valkeinen struct control_regvals {
104f7018c21STomi Valkeinen 	unsigned regs[16];		/* for vswin .. hserr */
105f7018c21STomi Valkeinen 	unsigned char mode;
106f7018c21STomi Valkeinen 	unsigned char radacal_ctrl;
107f7018c21STomi Valkeinen 	unsigned char clock_params[3];
108f7018c21STomi Valkeinen };
109f7018c21STomi Valkeinen 
110f7018c21STomi Valkeinen #define CTRLFB_OFF 16	/* position of pixel 0 in frame buffer */
111f7018c21STomi Valkeinen 
112f7018c21STomi Valkeinen 
113f7018c21STomi Valkeinen /*
114f7018c21STomi Valkeinen  * Best cmode supported by control
115f7018c21STomi Valkeinen  */
116f7018c21STomi Valkeinen struct max_cmodes {
117f7018c21STomi Valkeinen 	int m[2];	/* 0: 2MB vram, 1: 4MB vram */
118f7018c21STomi Valkeinen };
119f7018c21STomi Valkeinen 
120f7018c21STomi Valkeinen /*
121f7018c21STomi Valkeinen  * Video modes supported by macmodes.c
122f7018c21STomi Valkeinen  */
123f7018c21STomi Valkeinen static struct max_cmodes control_mac_modes[] = {
124f7018c21STomi Valkeinen 	{{-1,-1}},	/* 512x384, 60Hz interlaced (NTSC) */
125f7018c21STomi Valkeinen 	{{-1,-1}},	/* 512x384, 60Hz */
126f7018c21STomi Valkeinen 	{{-1,-1}},	/* 640x480, 50Hz interlaced (PAL) */
127f7018c21STomi Valkeinen 	{{-1,-1}},	/* 640x480, 60Hz interlaced (NTSC) */
128f7018c21STomi Valkeinen 	{{ 2, 2}},	/* 640x480, 60Hz (VGA) */
129f7018c21STomi Valkeinen 	{{ 2, 2}},	/* 640x480, 67Hz */
130f7018c21STomi Valkeinen 	{{-1,-1}},	/* 640x870, 75Hz (portrait) */
131f7018c21STomi Valkeinen 	{{-1,-1}},	/* 768x576, 50Hz (PAL full frame) */
132f7018c21STomi Valkeinen 	{{ 2, 2}},	/* 800x600, 56Hz */
133f7018c21STomi Valkeinen 	{{ 2, 2}},	/* 800x600, 60Hz */
134f7018c21STomi Valkeinen 	{{ 2, 2}},	/* 800x600, 72Hz */
135f7018c21STomi Valkeinen 	{{ 2, 2}},	/* 800x600, 75Hz */
136f7018c21STomi Valkeinen 	{{ 1, 2}},	/* 832x624, 75Hz */
137f7018c21STomi Valkeinen 	{{ 1, 2}},	/* 1024x768, 60Hz */
138f7018c21STomi Valkeinen 	{{ 1, 2}},	/* 1024x768, 70Hz (or 72Hz?) */
139f7018c21STomi Valkeinen 	{{ 1, 2}},	/* 1024x768, 75Hz (VESA) */
140f7018c21STomi Valkeinen 	{{ 1, 2}},	/* 1024x768, 75Hz */
141f7018c21STomi Valkeinen 	{{ 1, 2}},	/* 1152x870, 75Hz */
142f7018c21STomi Valkeinen 	{{ 0, 1}},	/* 1280x960, 75Hz */
143f7018c21STomi Valkeinen 	{{ 0, 1}},	/* 1280x1024, 75Hz */
144*ac831a37SGeert Uytterhoeven 	{{ 1, 2}},	/* 1152x768, 60Hz */
145*ac831a37SGeert Uytterhoeven 	{{ 0, 1}},	/* 1600x1024, 60Hz */
146f7018c21STomi Valkeinen };
147f7018c21STomi Valkeinen 
148