wdenk | aea86e4 | 2004-03-23 22:53:55 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2004 |
| 3 | * Pierre Aubert, Staubli Faverges , <p.aubert@staubli.com> |
| 4 | * |
Wolfgang Denk | bd8ec7e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | aea86e4 | 2004-03-23 22:53:55 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
Hans de Goede | e4e7ee6 | 2014-12-19 15:47:37 +0100 | [diff] [blame^] | 8 | #include <edid.h> |
wdenk | aea86e4 | 2004-03-23 22:53:55 +0000 | [diff] [blame] | 9 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 10 | #ifndef CONFIG_SYS_DEFAULT_VIDEO_MODE |
| 11 | #define CONFIG_SYS_DEFAULT_VIDEO_MODE 0x301 |
wdenk | aea86e4 | 2004-03-23 22:53:55 +0000 | [diff] [blame] | 12 | #endif |
| 13 | |
| 14 | /* Some mode definitions */ |
| 15 | #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */ |
| 16 | #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ |
| 17 | #define FB_SYNC_EXT 4 /* external sync */ |
| 18 | #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ |
| 19 | #define FB_SYNC_BROADCAST 16 /* broadcast video timings */ |
| 20 | /* vtotal = 144d/288n/576i => PAL */ |
| 21 | /* vtotal = 121d/242n/484i => NTSC */ |
| 22 | #define FB_SYNC_ON_GREEN 32 /* sync on green */ |
| 23 | #define FB_VMODE_NONINTERLACED 0 /* non interlaced */ |
| 24 | #define FB_VMODE_INTERLACED 1 /* interlaced */ |
| 25 | #define FB_VMODE_DOUBLE 2 /* double scan */ |
| 26 | #define FB_VMODE_MASK 255 |
| 27 | |
| 28 | #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */ |
| 29 | #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */ |
| 30 | #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */ |
| 31 | |
| 32 | |
| 33 | /****************************************************************** |
| 34 | * Resolution Struct |
| 35 | ******************************************************************/ |
| 36 | struct ctfb_res_modes { |
| 37 | int xres; /* visible resolution */ |
| 38 | int yres; |
Hans de Goede | 226ac61 | 2014-12-19 10:38:49 +0100 | [diff] [blame] | 39 | int refresh; /* vertical refresh rate in hz */ |
wdenk | aea86e4 | 2004-03-23 22:53:55 +0000 | [diff] [blame] | 40 | /* Timing: All values in pixclocks, except pixclock (of course) */ |
| 41 | int pixclock; /* pixel clock in ps (pico seconds) */ |
Hans de Goede | 226ac61 | 2014-12-19 10:38:49 +0100 | [diff] [blame] | 42 | int pixclock_khz; /* pixel clock in kHz */ |
wdenk | aea86e4 | 2004-03-23 22:53:55 +0000 | [diff] [blame] | 43 | int left_margin; /* time from sync to picture */ |
| 44 | int right_margin; /* time from picture to sync */ |
| 45 | int upper_margin; /* time from sync to picture */ |
| 46 | int lower_margin; |
| 47 | int hsync_len; /* length of horizontal sync */ |
| 48 | int vsync_len; /* length of vertical sync */ |
| 49 | int sync; /* see FB_SYNC_* */ |
| 50 | int vmode; /* see FB_VMODE_* */ |
| 51 | }; |
| 52 | |
| 53 | /****************************************************************** |
| 54 | * Vesa Mode Struct |
| 55 | ******************************************************************/ |
| 56 | struct ctfb_vesa_modes { |
| 57 | int vesanr; /* Vesa number as in LILO (VESA Nr + 0x200} */ |
| 58 | int resindex; /* index to resolution struct */ |
| 59 | int bits_per_pixel; /* bpp */ |
| 60 | }; |
| 61 | |
| 62 | #define RES_MODE_640x480 0 |
| 63 | #define RES_MODE_800x600 1 |
| 64 | #define RES_MODE_1024x768 2 |
| 65 | #define RES_MODE_960_720 3 |
| 66 | #define RES_MODE_1152x864 4 |
| 67 | #define RES_MODE_1280x1024 5 |
Hans de Goede | d01b2b5 | 2014-12-19 11:45:19 +0100 | [diff] [blame] | 68 | #define RES_MODE_1280x720 6 |
| 69 | #define RES_MODE_1360x768 7 |
| 70 | #define RES_MODE_1920x1080 8 |
| 71 | #define RES_MODE_1920x1200 9 |
| 72 | #define RES_MODES_COUNT 10 |
wdenk | aea86e4 | 2004-03-23 22:53:55 +0000 | [diff] [blame] | 73 | |
| 74 | #define VESA_MODES_COUNT 19 |
| 75 | |
| 76 | extern const struct ctfb_vesa_modes vesa_modes[]; |
| 77 | extern const struct ctfb_res_modes res_mode_init[]; |
| 78 | |
| 79 | int video_get_params (struct ctfb_res_modes *pPar, char *penv); |
Timur Tabi | 5576092 | 2011-03-21 16:38:49 -0500 | [diff] [blame] | 80 | |
| 81 | int video_get_video_mode(unsigned int *xres, unsigned int *yres, |
| 82 | unsigned int *depth, unsigned int *freq, const char **options); |
Hans de Goede | 2e2732d | 2014-12-19 13:22:47 +0100 | [diff] [blame] | 83 | |
| 84 | void video_get_ctfb_res_modes(int default_mode, unsigned int default_depth, |
| 85 | const struct ctfb_res_modes **mode_ret, |
| 86 | unsigned int *depth_ret, |
| 87 | const char **options); |
Hans de Goede | 350a9d6 | 2014-12-19 14:27:46 +0100 | [diff] [blame] | 88 | |
| 89 | void video_get_option_string(const char *options, const char *name, |
| 90 | char *dest, int dest_len, const char *def); |
| 91 | |
| 92 | int video_get_option_int(const char *options, const char *name, int def); |
Hans de Goede | e4e7ee6 | 2014-12-19 15:47:37 +0100 | [diff] [blame^] | 93 | |
| 94 | int video_edid_dtd_to_ctfb_res_modes(struct edid_detailed_timing *t, |
| 95 | struct ctfb_res_modes *mode); |