gma_display.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright © 2006-2011 Intel Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  16. *
  17. * Authors:
  18. * Eric Anholt <eric@anholt.net>
  19. * Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
  20. */
  21. #ifndef _GMA_DISPLAY_H_
  22. #define _GMA_DISPLAY_H_
  23. #include <linux/pm_runtime.h>
  24. struct gma_clock_t {
  25. /* given values */
  26. int n;
  27. int m1, m2;
  28. int p1, p2;
  29. /* derived values */
  30. int dot;
  31. int vco;
  32. int m;
  33. int p;
  34. };
  35. struct gma_range_t {
  36. int min, max;
  37. };
  38. struct gma_p2_t {
  39. int dot_limit;
  40. int p2_slow, p2_fast;
  41. };
  42. struct gma_limit_t {
  43. struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
  44. struct gma_p2_t p2;
  45. bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
  46. int target, int refclk,
  47. struct gma_clock_t *best_clock);
  48. };
  49. struct gma_clock_funcs {
  50. void (*clock)(int refclk, struct gma_clock_t *clock);
  51. const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk);
  52. bool (*pll_is_valid)(struct drm_crtc *crtc,
  53. const struct gma_limit_t *limit,
  54. struct gma_clock_t *clock);
  55. };
  56. /* Common pipe related functions */
  57. extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type);
  58. extern void gma_wait_for_vblank(struct drm_device *dev);
  59. extern int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
  60. struct drm_framebuffer *old_fb);
  61. extern int gma_crtc_cursor_set(struct drm_crtc *crtc,
  62. struct drm_file *file_priv,
  63. uint32_t handle,
  64. uint32_t width, uint32_t height);
  65. extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
  66. extern void gma_crtc_load_lut(struct drm_crtc *crtc);
  67. extern void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
  68. u16 *blue, u32 start, u32 size);
  69. extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
  70. extern bool gma_crtc_mode_fixup(struct drm_crtc *crtc,
  71. const struct drm_display_mode *mode,
  72. struct drm_display_mode *adjusted_mode);
  73. extern void gma_crtc_prepare(struct drm_crtc *crtc);
  74. extern void gma_crtc_commit(struct drm_crtc *crtc);
  75. extern void gma_crtc_disable(struct drm_crtc *crtc);
  76. extern void gma_crtc_destroy(struct drm_crtc *crtc);
  77. extern int gma_crtc_set_config(struct drm_mode_set *set);
  78. extern void gma_crtc_save(struct drm_crtc *crtc);
  79. extern void gma_crtc_restore(struct drm_crtc *crtc);
  80. extern void gma_encoder_prepare(struct drm_encoder *encoder);
  81. extern void gma_encoder_commit(struct drm_encoder *encoder);
  82. extern void gma_encoder_destroy(struct drm_encoder *encoder);
  83. extern bool gma_encoder_mode_fixup(struct drm_encoder *encoder,
  84. const struct drm_display_mode *mode,
  85. struct drm_display_mode *adjusted_mode);
  86. /* Common clock related functions */
  87. extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
  88. extern void gma_clock(int refclk, struct gma_clock_t *clock);
  89. extern bool gma_pll_is_valid(struct drm_crtc *crtc,
  90. const struct gma_limit_t *limit,
  91. struct gma_clock_t *clock);
  92. extern bool gma_find_best_pll(const struct gma_limit_t *limit,
  93. struct drm_crtc *crtc, int target, int refclk,
  94. struct gma_clock_t *best_clock);
  95. #endif