gma_display.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright © 2006-2011 Intel Corporation
  4. *
  5. * Authors:
  6. * Eric Anholt <[email protected]>
  7. * Patrik Jakobsson <[email protected]>
  8. */
  9. #ifndef _GMA_DISPLAY_H_
  10. #define _GMA_DISPLAY_H_
  11. #include <linux/pm_runtime.h>
  12. #include <drm/drm_vblank.h>
  13. struct drm_encoder;
  14. struct drm_mode_set;
  15. struct gma_clock_t {
  16. /* given values */
  17. int n;
  18. int m1, m2;
  19. int p1, p2;
  20. /* derived values */
  21. int dot;
  22. int vco;
  23. int m;
  24. int p;
  25. };
  26. struct gma_range_t {
  27. int min, max;
  28. };
  29. struct gma_p2_t {
  30. int dot_limit;
  31. int p2_slow, p2_fast;
  32. };
  33. struct gma_limit_t {
  34. struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
  35. struct gma_p2_t p2;
  36. bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
  37. int target, int refclk,
  38. struct gma_clock_t *best_clock);
  39. };
  40. struct gma_clock_funcs {
  41. void (*clock)(int refclk, struct gma_clock_t *clock);
  42. const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk);
  43. bool (*pll_is_valid)(struct drm_crtc *crtc,
  44. const struct gma_limit_t *limit,
  45. struct gma_clock_t *clock);
  46. };
  47. /* Common pipe related functions */
  48. extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type);
  49. extern void gma_wait_for_vblank(struct drm_device *dev);
  50. extern int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
  51. struct drm_framebuffer *old_fb);
  52. extern void gma_crtc_load_lut(struct drm_crtc *crtc);
  53. extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
  54. extern void gma_crtc_prepare(struct drm_crtc *crtc);
  55. extern void gma_crtc_commit(struct drm_crtc *crtc);
  56. extern void gma_crtc_disable(struct drm_crtc *crtc);
  57. extern void gma_crtc_destroy(struct drm_crtc *crtc);
  58. extern int gma_crtc_page_flip(struct drm_crtc *crtc,
  59. struct drm_framebuffer *fb,
  60. struct drm_pending_vblank_event *event,
  61. uint32_t page_flip_flags,
  62. struct drm_modeset_acquire_ctx *ctx);
  63. extern void gma_crtc_save(struct drm_crtc *crtc);
  64. extern void gma_crtc_restore(struct drm_crtc *crtc);
  65. extern const struct drm_crtc_funcs gma_crtc_funcs;
  66. extern void gma_encoder_prepare(struct drm_encoder *encoder);
  67. extern void gma_encoder_commit(struct drm_encoder *encoder);
  68. extern void gma_encoder_destroy(struct drm_encoder *encoder);
  69. /* Common clock related functions */
  70. extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
  71. extern void gma_clock(int refclk, struct gma_clock_t *clock);
  72. extern bool gma_pll_is_valid(struct drm_crtc *crtc,
  73. const struct gma_limit_t *limit,
  74. struct gma_clock_t *clock);
  75. extern bool gma_find_best_pll(const struct gma_limit_t *limit,
  76. struct drm_crtc *crtc, int target, int refclk,
  77. struct gma_clock_t *best_clock);
  78. #endif