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