1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright © 2006-2011 Intel Corporation
6 * Eric Anholt <eric@anholt.net>
7 * Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
10 #ifndef _GMA_DISPLAY_H_
11 #define _GMA_DISPLAY_H_
13 #include <linux/pm_runtime.h>
14 #include <drm/drm_vblank.h>
41 struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
43 bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
44 int target, int refclk,
45 struct gma_clock_t *best_clock);
48 struct gma_clock_funcs {
49 void (*clock)(int refclk, struct gma_clock_t *clock);
50 const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk);
51 bool (*pll_is_valid)(struct drm_crtc *crtc,
52 const struct gma_limit_t *limit,
53 struct gma_clock_t *clock);
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 void gma_crtc_load_lut(struct drm_crtc *crtc);
62 extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
63 extern void gma_crtc_prepare(struct drm_crtc *crtc);
64 extern void gma_crtc_commit(struct drm_crtc *crtc);
65 extern void gma_crtc_disable(struct drm_crtc *crtc);
66 extern void gma_crtc_destroy(struct drm_crtc *crtc);
67 extern int gma_crtc_page_flip(struct drm_crtc *crtc,
68 struct drm_framebuffer *fb,
69 struct drm_pending_vblank_event *event,
70 uint32_t page_flip_flags,
71 struct drm_modeset_acquire_ctx *ctx);
72 extern int gma_crtc_set_config(struct drm_mode_set *set,
73 struct drm_modeset_acquire_ctx *ctx);
75 extern void gma_crtc_save(struct drm_crtc *crtc);
76 extern void gma_crtc_restore(struct drm_crtc *crtc);
78 extern const struct drm_crtc_funcs gma_crtc_funcs;
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);
84 /* Common clock related functions */
85 extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
86 extern void gma_clock(int refclk, struct gma_clock_t *clock);
87 extern bool gma_pll_is_valid(struct drm_crtc *crtc,
88 const struct gma_limit_t *limit,
89 struct gma_clock_t *clock);
90 extern bool gma_find_best_pll(const struct gma_limit_t *limit,
91 struct drm_crtc *crtc, int target, int refclk,
92 struct gma_clock_t *best_clock);