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