videomodes.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2004
  4. * Pierre Aubert, Staubli Faverges , <p.aubert@staubli.com>
  5. */
  6. #include <edid.h>
  7. #ifndef CONFIG_SYS_DEFAULT_VIDEO_MODE
  8. #define CONFIG_SYS_DEFAULT_VIDEO_MODE 0x301
  9. #endif
  10. /* Some mode definitions */
  11. #define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */
  12. #define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */
  13. #define FB_SYNC_EXT 4 /* external sync */
  14. #define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
  15. #define FB_SYNC_BROADCAST 16 /* broadcast video timings */
  16. /* vtotal = 144d/288n/576i => PAL */
  17. /* vtotal = 121d/242n/484i => NTSC */
  18. #define FB_SYNC_ON_GREEN 32 /* sync on green */
  19. #define FB_VMODE_NONINTERLACED 0 /* non interlaced */
  20. #define FB_VMODE_INTERLACED 1 /* interlaced */
  21. #define FB_VMODE_DOUBLE 2 /* double scan */
  22. #define FB_VMODE_MASK 255
  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. /******************************************************************
  27. * Resolution Struct
  28. ******************************************************************/
  29. struct ctfb_res_modes {
  30. int xres; /* visible resolution */
  31. int yres;
  32. int refresh; /* vertical refresh rate in hz */
  33. /* Timing: All values in pixclocks, except pixclock (of course) */
  34. int pixclock; /* pixel clock in ps (pico seconds) */
  35. int pixclock_khz; /* pixel clock in kHz */
  36. int left_margin; /* time from sync to picture */
  37. int right_margin; /* time from picture to sync */
  38. int upper_margin; /* time from sync to picture */
  39. int lower_margin;
  40. int hsync_len; /* length of horizontal sync */
  41. int vsync_len; /* length of vertical sync */
  42. int sync; /* see FB_SYNC_* */
  43. int vmode; /* see FB_VMODE_* */
  44. };
  45. /******************************************************************
  46. * Vesa Mode Struct
  47. ******************************************************************/
  48. struct ctfb_vesa_modes {
  49. int vesanr; /* Vesa number as in LILO (VESA Nr + 0x200} */
  50. int resindex; /* index to resolution struct */
  51. int bits_per_pixel; /* bpp */
  52. };
  53. #define RES_MODE_640x480 0
  54. #define RES_MODE_800x600 1
  55. #define RES_MODE_1024x768 2
  56. #define RES_MODE_960_720 3
  57. #define RES_MODE_1152x864 4
  58. #define RES_MODE_1280x1024 5
  59. #define RES_MODE_1280x720 6
  60. #define RES_MODE_1360x768 7
  61. #define RES_MODE_1920x1080 8
  62. #define RES_MODE_1920x1200 9
  63. #define RES_MODES_COUNT 10
  64. #define VESA_MODES_COUNT 19
  65. extern const struct ctfb_vesa_modes vesa_modes[];
  66. extern const struct ctfb_res_modes res_mode_init[];
  67. int video_get_params (struct ctfb_res_modes *pPar, char *penv);
  68. int video_get_video_mode(unsigned int *xres, unsigned int *yres,
  69. unsigned int *depth, unsigned int *freq, const char **options);
  70. void video_get_ctfb_res_modes(int default_mode, unsigned int default_depth,
  71. const struct ctfb_res_modes **mode_ret,
  72. unsigned int *depth_ret,
  73. const char **options);
  74. void video_get_option_string(const char *options, const char *name,
  75. char *dest, int dest_len, const char *def);
  76. int video_get_option_int(const char *options, const char *name, int def);
  77. int video_edid_dtd_to_ctfb_res_modes(struct edid_detailed_timing *t,
  78. struct ctfb_res_modes *mode);
  79. /**
  80. * video_ctfb_mode_to_display_timing() - Convert a ctfb(Cathode Tube Frame
  81. * Buffer)_res_modes struct to a
  82. * display_timing struct.
  83. *
  84. * @mode: Input ctfb_res_modes structure pointer to be converted
  85. * from
  86. * @timing: Output display_timing structure pointer to be converted to
  87. */
  88. void video_ctfb_mode_to_display_timing(const struct ctfb_res_modes *mode,
  89. struct display_timing *timing);