1/* Copyright (c) 2005 Advanced Micro Devices, Inc.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to
5 * deal in the Software without restriction, including without limitation the
6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 * sell copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19 * IN THE SOFTWARE.
20 *
21 * Neither the name of the Advanced Micro Devices, Inc. nor the names of its
22 * contributors may be used to endorse or promote products derived from this
23 * software without specific prior written permission.
24 * */
25
26/*
27 * This header file contains the mode tables.  It is used by the "gfx_disp.c"
28 * file to set a display mode.
29 * */
30
31#ifndef _gfx_mode_h
32#define _gfx_mode_h
33
34/* MODE FLAGS (BITWISE-OR) */
35
36#define GFX_MODE_8BPP		  0x00000001
37#define GFX_MODE_12BPP        0x00000002
38#define GFX_MODE_15BPP        0x00000004
39#define GFX_MODE_16BPP		  0x00000008
40#define GFX_MODE_24BPP        0x00000010
41#define GFX_MODE_56HZ         0x00000020
42#define GFX_MODE_60HZ		  0x00000040
43#define GFX_MODE_70HZ		  0x00000080
44#define GFX_MODE_72HZ		  0x00000100
45#define GFX_MODE_75HZ		  0x00000200
46#define GFX_MODE_85HZ		  0x00000400
47#define GFX_MODE_90HZ         0x00000800
48#define GFX_MODE_100HZ        0x00001000
49#define GFX_MODE_NEG_HSYNC	  0x00002000
50#define GFX_MODE_NEG_VSYNC	  0x00004000
51#define GFX_MODE_PIXEL_DOUBLE 0x00008000
52#define GFX_MODE_LINE_DOUBLE  0x00010000
53#define GFX_MODE_TV_NTSC      0x00020000
54#define GFX_MODE_TV_PAL       0x00040000
55#define GFX_MODE_EXCLUDE_PLL  0x00080000
56#define GFX_MODE_LOCK_TIMING  0x10000000
57
58#define gfx_mode_hz_conversion		\
59	switch (hz) {					\
60	case 56:						\
61		hz_flag = GFX_MODE_56HZ;	\
62		break;						\
63	case 60:						\
64       	hz_flag = GFX_MODE_60HZ;	\
65		break;						\
66	case 70:						\
67       	hz_flag = GFX_MODE_70HZ;	\
68		break;						\
69	case 72:						\
70       	hz_flag = GFX_MODE_72HZ;	\
71		break;						\
72	case 75:						\
73     	hz_flag = GFX_MODE_75HZ;	\
74		break;						\
75	case 85:						\
76      	hz_flag = GFX_MODE_85HZ;	\
77		break;						\
78	case 90:						\
79      	hz_flag = GFX_MODE_90HZ;	\
80		break;						\
81	case 100:						\
82      	hz_flag = GFX_MODE_100HZ;	\
83		break;						\
84	}
85
86#define gfx_mode_bpp_conversion			\
87	switch (bpp) {						\
88    case 8:								\
89        bpp_flag = GFX_MODE_8BPP;		\
90		break;							\
91    case 12:							\
92		bpp_flag = GFX_MODE_12BPP;		\
93		break;							\
94    case 15:							\
95		bpp_flag = GFX_MODE_15BPP;		\
96		break;							\
97    case 16:							\
98		bpp_flag = GFX_MODE_16BPP;		\
99		break;							\
100    case 32:							\
101		bpp_flag = GFX_MODE_24BPP;		\
102		break;							\
103    default:							\
104        return -1;						\
105    }
106
107#define gfx_mode_bpp_conversion_def(bpp) \
108	switch (bpp) {						\
109    case 8:								\
110        bpp_flag = GFX_MODE_8BPP;		\
111		break;							\
112    case 12:							\
113		bpp_flag = GFX_MODE_12BPP;		\
114		break;							\
115    case 15:							\
116		bpp_flag = GFX_MODE_15BPP;		\
117		break;							\
118    case 16:							\
119		bpp_flag = GFX_MODE_16BPP;		\
120		break;							\
121    case 32:							\
122		bpp_flag = GFX_MODE_24BPP;		\
123		break;							\
124    default:							\
125        bpp_flag = GFX_MODE_8BPP;		\
126    }
127
128/* STRUCTURE DEFINITION */
129
130typedef struct tagDISPLAYMODE {
131    /* DISPLAY MODE FLAGS */
132    /* Specify valid color depths and the refresh rate. */
133
134    unsigned long flags;
135
136    /* TIMINGS */
137
138    unsigned short hactive;
139    unsigned short hblankstart;
140    unsigned short hsyncstart;
141    unsigned short hsyncend;
142    unsigned short hblankend;
143    unsigned short htotal;
144
145    unsigned short vactive;
146    unsigned short vblankstart;
147    unsigned short vsyncstart;
148    unsigned short vsyncend;
149    unsigned short vblankend;
150    unsigned short vtotal;
151
152    /* CLOCK FREQUENCY */
153
154    unsigned long frequency;
155
156} DISPLAYMODE;
157
158/* For Fixed timings */
159typedef struct tagFIXEDTIMINGS {
160    /* DISPLAY MODE FLAGS */
161    /* Specify valid color depths and the refresh rate. */
162
163    int panelresx;
164    int panelresy;
165    unsigned short xres;
166    unsigned short yres;
167
168    /* TIMINGS */
169
170    unsigned short hactive;
171    unsigned short hblankstart;
172    unsigned short hsyncstart;
173    unsigned short hsyncend;
174    unsigned short hblankend;
175    unsigned short htotal;
176
177    unsigned short vactive;
178    unsigned short vblankstart;
179    unsigned short vsyncstart;
180    unsigned short vsyncend;
181    unsigned short vblankend;
182    unsigned short vtotal;
183
184    /* CLOCK FREQUENCY */
185
186    unsigned long frequency;
187
188} FIXEDTIMINGS;
189
190#endif                          /* !_gfx_mode_h */
191
192/* END OF FILE */
193