xref: /linux/drivers/gpu/drm/ast/ast_vbios.h (revision 1260ed77798502de9c98020040d2995008de10cc)
1*517e28d4SThomas Zimmermann /* SPDX-License-Identifier: MIT */
2*517e28d4SThomas Zimmermann /*
3*517e28d4SThomas Zimmermann  * Copyright (c) 2005 ASPEED Technology Inc.
4*517e28d4SThomas Zimmermann  *
5*517e28d4SThomas Zimmermann  * Permission to use, copy, modify, distribute, and sell this software and its
6*517e28d4SThomas Zimmermann  * documentation for any purpose is hereby granted without fee, provided that
7*517e28d4SThomas Zimmermann  * the above copyright notice appear in all copies and that both that
8*517e28d4SThomas Zimmermann  * copyright notice and this permission notice appear in supporting
9*517e28d4SThomas Zimmermann  * documentation, and that the name of the authors not be used in
10*517e28d4SThomas Zimmermann  * advertising or publicity pertaining to distribution of the software without
11*517e28d4SThomas Zimmermann  * specific, written prior permission.  The authors makes no representations
12*517e28d4SThomas Zimmermann  * about the suitability of this software for any purpose.  It is provided
13*517e28d4SThomas Zimmermann  * "as is" without express or implied warranty.
14*517e28d4SThomas Zimmermann  *
15*517e28d4SThomas Zimmermann  * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16*517e28d4SThomas Zimmermann  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17*517e28d4SThomas Zimmermann  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18*517e28d4SThomas Zimmermann  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
19*517e28d4SThomas Zimmermann  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
20*517e28d4SThomas Zimmermann  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21*517e28d4SThomas Zimmermann  * PERFORMANCE OF THIS SOFTWARE.
22*517e28d4SThomas Zimmermann  */
23*517e28d4SThomas Zimmermann /* Ported from xf86-video-ast driver */
24*517e28d4SThomas Zimmermann 
25*517e28d4SThomas Zimmermann #ifndef AST_VBIOS_H
26*517e28d4SThomas Zimmermann #define AST_VBIOS_H
27*517e28d4SThomas Zimmermann 
28*517e28d4SThomas Zimmermann #include <linux/types.h>
29*517e28d4SThomas Zimmermann 
30*517e28d4SThomas Zimmermann struct ast_device;
31*517e28d4SThomas Zimmermann struct drm_display_mode;
32*517e28d4SThomas Zimmermann 
33*517e28d4SThomas Zimmermann #define Charx8Dot               0x00000001
34*517e28d4SThomas Zimmermann #define HalfDCLK                0x00000002
35*517e28d4SThomas Zimmermann #define DoubleScanMode          0x00000004
36*517e28d4SThomas Zimmermann #define LineCompareOff          0x00000008
37*517e28d4SThomas Zimmermann #define HBorder                 0x00000020
38*517e28d4SThomas Zimmermann #define VBorder                 0x00000010
39*517e28d4SThomas Zimmermann #define WideScreenMode		0x00000100
40*517e28d4SThomas Zimmermann #define NewModeInfo		0x00000200
41*517e28d4SThomas Zimmermann #define NHSync			0x00000400
42*517e28d4SThomas Zimmermann #define PHSync			0x00000800
43*517e28d4SThomas Zimmermann #define NVSync			0x00001000
44*517e28d4SThomas Zimmermann #define PVSync			0x00002000
45*517e28d4SThomas Zimmermann #define SyncPP			(PVSync | PHSync)
46*517e28d4SThomas Zimmermann #define SyncPN			(PVSync | NHSync)
47*517e28d4SThomas Zimmermann #define SyncNP			(NVSync | PHSync)
48*517e28d4SThomas Zimmermann #define SyncNN			(NVSync | NHSync)
49*517e28d4SThomas Zimmermann #define AST2500PreCatchCRT		0x00004000
50*517e28d4SThomas Zimmermann 
51*517e28d4SThomas Zimmermann /* DCLK Index */
52*517e28d4SThomas Zimmermann #define VCLK25_175		0x00
53*517e28d4SThomas Zimmermann #define VCLK28_322		0x01
54*517e28d4SThomas Zimmermann #define VCLK31_5		0x02
55*517e28d4SThomas Zimmermann #define VCLK36			0x03
56*517e28d4SThomas Zimmermann #define VCLK40			0x04
57*517e28d4SThomas Zimmermann #define VCLK49_5		0x05
58*517e28d4SThomas Zimmermann #define VCLK50			0x06
59*517e28d4SThomas Zimmermann #define VCLK56_25		0x07
60*517e28d4SThomas Zimmermann #define VCLK65			0x08
61*517e28d4SThomas Zimmermann #define VCLK75			0x09
62*517e28d4SThomas Zimmermann #define VCLK78_75		0x0a
63*517e28d4SThomas Zimmermann #define VCLK94_5		0x0b
64*517e28d4SThomas Zimmermann #define VCLK108			0x0c
65*517e28d4SThomas Zimmermann #define VCLK135			0x0d
66*517e28d4SThomas Zimmermann #define VCLK157_5		0x0e
67*517e28d4SThomas Zimmermann #define VCLK162			0x0f
68*517e28d4SThomas Zimmermann /* #define VCLK193_25		0x10 */
69*517e28d4SThomas Zimmermann #define VCLK154			0x10
70*517e28d4SThomas Zimmermann #define VCLK83_5		0x11
71*517e28d4SThomas Zimmermann #define VCLK106_5		0x12
72*517e28d4SThomas Zimmermann #define VCLK146_25		0x13
73*517e28d4SThomas Zimmermann #define VCLK148_5		0x14
74*517e28d4SThomas Zimmermann #define VCLK71			0x15
75*517e28d4SThomas Zimmermann #define VCLK88_75		0x16
76*517e28d4SThomas Zimmermann #define VCLK119			0x17
77*517e28d4SThomas Zimmermann #define VCLK85_5		0x18
78*517e28d4SThomas Zimmermann #define VCLK97_75		0x19
79*517e28d4SThomas Zimmermann #define VCLK118_25		0x1a
80*517e28d4SThomas Zimmermann 
81*517e28d4SThomas Zimmermann struct ast_vbios_enhtable {
82*517e28d4SThomas Zimmermann 	u32 ht;
83*517e28d4SThomas Zimmermann 	u32 hde;
84*517e28d4SThomas Zimmermann 	u32 hfp;
85*517e28d4SThomas Zimmermann 	u32 hsync;
86*517e28d4SThomas Zimmermann 	u32 vt;
87*517e28d4SThomas Zimmermann 	u32 vde;
88*517e28d4SThomas Zimmermann 	u32 vfp;
89*517e28d4SThomas Zimmermann 	u32 vsync;
90*517e28d4SThomas Zimmermann 	u32 dclk_index;
91*517e28d4SThomas Zimmermann 	u32 flags;
92*517e28d4SThomas Zimmermann 	u32 refresh_rate;
93*517e28d4SThomas Zimmermann 	u32 refresh_rate_index;
94*517e28d4SThomas Zimmermann 	u32 mode_id;
95*517e28d4SThomas Zimmermann };
96*517e28d4SThomas Zimmermann 
97*517e28d4SThomas Zimmermann #define AST_VBIOS_INVALID_MODE \
98*517e28d4SThomas Zimmermann 	{0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u}
99*517e28d4SThomas Zimmermann 
100*517e28d4SThomas Zimmermann static inline bool ast_vbios_mode_is_valid(const struct ast_vbios_enhtable *vmode)
101*517e28d4SThomas Zimmermann {
102*517e28d4SThomas Zimmermann 	return vmode->ht && vmode->vt && vmode->refresh_rate;
103*517e28d4SThomas Zimmermann }
104*517e28d4SThomas Zimmermann 
105*517e28d4SThomas Zimmermann const struct ast_vbios_enhtable *ast_vbios_find_mode(const struct ast_device *ast,
106*517e28d4SThomas Zimmermann 						     const struct drm_display_mode *mode);
107*517e28d4SThomas Zimmermann 
108*517e28d4SThomas Zimmermann #endif
109