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