videomodes.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * (C) Copyright 2004
  3. * Pierre Aubert, Staubli Faverges , <p.aubert@staubli.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <edid.h>
  8. #ifndef CONFIG_SYS_DEFAULT_VIDEO_MODE
  9. #define CONFIG_SYS_DEFAULT_VIDEO_MODE 0x301
  10. #endif
  11. /* Some mode definitions */
  12. #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */
  13. #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */
  14. #define FB_SYNC_EXT 4 /* external sync */
  15. #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
  16. #define FB_SYNC_BROADCAST 16 /* broadcast video timings */
  17. /* vtotal = 144d/288n/576i => PAL */
  18. /* vtotal = 121d/242n/484i => NTSC */
  19. #define FB_SYNC_ON_GREEN 32 /* sync on green */
  20. #define FB_VMODE_NONINTERLACED 0 /* non interlaced */
  21. #define FB_VMODE_INTERLACED 1 /* interlaced */
  22. #define FB_VMODE_DOUBLE 2 /* double scan */
  23. #define FB_VMODE_MASK 255
  24. #define FB_VMODE_YWRAP 256 /* ywrap instead of panning */
  25. #define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
  26. #define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
  27. /******************************************************************
  28. * Resolution Struct
  29. ******************************************************************/
  30. struct ctfb_res_modes {
  31. int xres; /* visible resolution */
  32. int yres;
  33. int refresh; /* vertical refresh rate in hz */
  34. /* Timing: All values in pixclocks, except pixclock (of course) */
  35. int pixclock; /* pixel clock in ps (pico seconds) */
  36. int pixclock_khz; /* pixel clock in kHz */
  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. * Vesa Mode Struct
  48. ******************************************************************/
  49. struct ctfb_vesa_modes {
  50. int vesanr; /* Vesa number as in LILO (VESA Nr + 0x200} */
  51. int resindex; /* index to resolution struct */
  52. int bits_per_pixel; /* bpp */
  53. };
  54. #define RES_MODE_640x480 0
  55. #define RES_MODE_800x600 1
  56. #define RES_MODE_1024x768 2
  57. #define RES_MODE_960_720 3
  58. #define RES_MODE_1152x864 4
  59. #define RES_MODE_1280x1024 5
  60. #define RES_MODE_1280x720 6
  61. #define RES_MODE_1360x768 7
  62. #define RES_MODE_1920x1080 8
  63. #define RES_MODE_1920x1200 9
  64. #define RES_MODES_COUNT 10
  65. #define VESA_MODES_COUNT 19
  66. extern const struct ctfb_vesa_modes vesa_modes[];
  67. extern const struct ctfb_res_modes res_mode_init[];
  68. int video_get_params (struct ctfb_res_modes *pPar, char *penv);
  69. int video_get_video_mode(unsigned int *xres, unsigned int *yres,
  70. unsigned int *depth, unsigned int *freq, const char **options);
  71. void video_get_ctfb_res_modes(int default_mode, unsigned int default_depth,
  72. const struct ctfb_res_modes **mode_ret,
  73. unsigned int *depth_ret,
  74. const char **options);
  75. void video_get_option_string(const char *options, const char *name,
  76. char *dest, int dest_len, const char *def);
  77. int video_get_option_int(const char *options, const char *name, int def);
  78. int video_edid_dtd_to_ctfb_res_modes(struct edid_detailed_timing *t,
  79. struct ctfb_res_modes *mode);