xref: /rk3399_rockchip-uboot/drivers/video/videomodes.h (revision b7ce12ddd7a7aba80fc8f10a50bfdec4f3aceb52)
1352d2591SJean-Christophe PLAGNIOL-VILLARD /*
2352d2591SJean-Christophe PLAGNIOL-VILLARD  * (C) Copyright 2004
3352d2591SJean-Christophe PLAGNIOL-VILLARD  * Pierre Aubert, Staubli Faverges , <p.aubert@staubli.com>
4352d2591SJean-Christophe PLAGNIOL-VILLARD  *
51a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
6352d2591SJean-Christophe PLAGNIOL-VILLARD  */
7352d2591SJean-Christophe PLAGNIOL-VILLARD 
8*b7ce12ddSHans de Goede #include <edid.h>
9352d2591SJean-Christophe PLAGNIOL-VILLARD 
106d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #ifndef CONFIG_SYS_DEFAULT_VIDEO_MODE
116d0f6bcfSJean-Christophe PLAGNIOL-VILLARD #define CONFIG_SYS_DEFAULT_VIDEO_MODE	0x301
12352d2591SJean-Christophe PLAGNIOL-VILLARD #endif
13352d2591SJean-Christophe PLAGNIOL-VILLARD 
14352d2591SJean-Christophe PLAGNIOL-VILLARD /* Some mode definitions */
15352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_SYNC_HOR_HIGH_ACT	1	/* horizontal sync high active	*/
16352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_SYNC_VERT_HIGH_ACT	2	/* vertical sync high active	*/
17352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_SYNC_EXT		4	/* external sync		*/
18352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_SYNC_COMP_HIGH_ACT	8	/* composite sync high active	*/
19352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_SYNC_BROADCAST	16	/* broadcast video timings	*/
20352d2591SJean-Christophe PLAGNIOL-VILLARD 					/* vtotal = 144d/288n/576i => PAL  */
21352d2591SJean-Christophe PLAGNIOL-VILLARD 					/* vtotal = 121d/242n/484i => NTSC */
22352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_SYNC_ON_GREEN	32	/* sync on green */
23352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_VMODE_NONINTERLACED	0	/* non interlaced */
24352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_VMODE_INTERLACED	1	/* interlaced	*/
25352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_VMODE_DOUBLE		2	/* double scan */
26352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_VMODE_MASK		255
27352d2591SJean-Christophe PLAGNIOL-VILLARD 
28352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_VMODE_YWRAP		256	/* ywrap instead of panning	*/
29352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_VMODE_SMOOTH_XPAN	512	/* smooth xpan possible (internally used) */
30352d2591SJean-Christophe PLAGNIOL-VILLARD #define FB_VMODE_CONUPDATE	512	/* don't update x/yoffset	*/
31352d2591SJean-Christophe PLAGNIOL-VILLARD 
32352d2591SJean-Christophe PLAGNIOL-VILLARD 
33352d2591SJean-Christophe PLAGNIOL-VILLARD /******************************************************************
34352d2591SJean-Christophe PLAGNIOL-VILLARD  * Resolution Struct
35352d2591SJean-Christophe PLAGNIOL-VILLARD  ******************************************************************/
36352d2591SJean-Christophe PLAGNIOL-VILLARD struct ctfb_res_modes {
37352d2591SJean-Christophe PLAGNIOL-VILLARD 	int xres;		/* visible resolution		*/
38352d2591SJean-Christophe PLAGNIOL-VILLARD 	int yres;
390c91d257SHans de Goede 	int refresh;		/* vertical refresh rate in hz  */
40352d2591SJean-Christophe PLAGNIOL-VILLARD 	/* Timing: All values in pixclocks, except pixclock (of course) */
41352d2591SJean-Christophe PLAGNIOL-VILLARD 	int pixclock;		/* pixel clock in ps (pico seconds) */
420c91d257SHans de Goede 	int pixclock_khz;	/* pixel clock in kHz           */
43352d2591SJean-Christophe PLAGNIOL-VILLARD 	int left_margin;	/* time from sync to picture	*/
44352d2591SJean-Christophe PLAGNIOL-VILLARD 	int right_margin;	/* time from picture to sync	*/
45352d2591SJean-Christophe PLAGNIOL-VILLARD 	int upper_margin;	/* time from sync to picture	*/
46352d2591SJean-Christophe PLAGNIOL-VILLARD 	int lower_margin;
47352d2591SJean-Christophe PLAGNIOL-VILLARD 	int hsync_len;		/* length of horizontal sync	*/
48352d2591SJean-Christophe PLAGNIOL-VILLARD 	int vsync_len;		/* length of vertical sync	*/
49352d2591SJean-Christophe PLAGNIOL-VILLARD 	int sync;		/* see FB_SYNC_*		*/
50352d2591SJean-Christophe PLAGNIOL-VILLARD 	int vmode;		/* see FB_VMODE_*		*/
51352d2591SJean-Christophe PLAGNIOL-VILLARD };
52352d2591SJean-Christophe PLAGNIOL-VILLARD 
53352d2591SJean-Christophe PLAGNIOL-VILLARD /******************************************************************
54352d2591SJean-Christophe PLAGNIOL-VILLARD  * Vesa Mode Struct
55352d2591SJean-Christophe PLAGNIOL-VILLARD  ******************************************************************/
56352d2591SJean-Christophe PLAGNIOL-VILLARD struct ctfb_vesa_modes {
57352d2591SJean-Christophe PLAGNIOL-VILLARD 	int vesanr;		/* Vesa number as in LILO (VESA Nr + 0x200} */
58352d2591SJean-Christophe PLAGNIOL-VILLARD 	int resindex;		/* index to resolution struct */
59352d2591SJean-Christophe PLAGNIOL-VILLARD 	int bits_per_pixel;	/* bpp */
60352d2591SJean-Christophe PLAGNIOL-VILLARD };
61352d2591SJean-Christophe PLAGNIOL-VILLARD 
62352d2591SJean-Christophe PLAGNIOL-VILLARD #define RES_MODE_640x480	0
63352d2591SJean-Christophe PLAGNIOL-VILLARD #define RES_MODE_800x600	1
64352d2591SJean-Christophe PLAGNIOL-VILLARD #define RES_MODE_1024x768	2
65352d2591SJean-Christophe PLAGNIOL-VILLARD #define RES_MODE_960_720	3
66352d2591SJean-Christophe PLAGNIOL-VILLARD #define RES_MODE_1152x864	4
67352d2591SJean-Christophe PLAGNIOL-VILLARD #define RES_MODE_1280x1024	5
6859bb6109SHans de Goede #define RES_MODE_1280x720	6
6959bb6109SHans de Goede #define RES_MODE_1360x768	7
7059bb6109SHans de Goede #define RES_MODE_1920x1080	8
7159bb6109SHans de Goede #define RES_MODE_1920x1200	9
7259bb6109SHans de Goede #define RES_MODES_COUNT		10
73352d2591SJean-Christophe PLAGNIOL-VILLARD 
74352d2591SJean-Christophe PLAGNIOL-VILLARD #define VESA_MODES_COUNT 19
75352d2591SJean-Christophe PLAGNIOL-VILLARD 
76352d2591SJean-Christophe PLAGNIOL-VILLARD extern const struct ctfb_vesa_modes vesa_modes[];
77352d2591SJean-Christophe PLAGNIOL-VILLARD extern const struct ctfb_res_modes res_mode_init[];
78352d2591SJean-Christophe PLAGNIOL-VILLARD 
79352d2591SJean-Christophe PLAGNIOL-VILLARD int video_get_params (struct ctfb_res_modes *pPar, char *penv);
80a5dbdc81STimur Tabi 
81a5dbdc81STimur Tabi int video_get_video_mode(unsigned int *xres, unsigned int *yres,
82a5dbdc81STimur Tabi 	unsigned int *depth, unsigned int *freq, const char **options);
83e976b868SHans de Goede 
84e976b868SHans de Goede void video_get_ctfb_res_modes(int default_mode, unsigned int default_depth,
85e976b868SHans de Goede 			      const struct ctfb_res_modes **mode_ret,
86e976b868SHans de Goede 			      unsigned int *depth_ret,
87e976b868SHans de Goede 			      const char **options);
88eb3c0cf8SHans de Goede 
89eb3c0cf8SHans de Goede void video_get_option_string(const char *options, const char *name,
90eb3c0cf8SHans de Goede 			     char *dest, int dest_len, const char *def);
91eb3c0cf8SHans de Goede 
92eb3c0cf8SHans de Goede int video_get_option_int(const char *options, const char *name, int def);
93*b7ce12ddSHans de Goede 
94*b7ce12ddSHans de Goede int video_edid_dtd_to_ctfb_res_modes(struct edid_detailed_timing *t,
95*b7ce12ddSHans de Goede 				     struct ctfb_res_modes *mode);
96