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 int gma_crtc_cursor_set(struct drm_crtc
*crtc
,
62 struct drm_file
*file_priv
,
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 int gma_crtc_gamma_set(struct drm_crtc
*crtc
, u16
*red
, u16
*green
,
69 struct drm_modeset_acquire_ctx
*ctx
);
70 extern void gma_crtc_dpms(struct drm_crtc
*crtc
, int mode
);
71 extern void gma_crtc_prepare(struct drm_crtc
*crtc
);
72 extern void gma_crtc_commit(struct drm_crtc
*crtc
);
73 extern void gma_crtc_disable(struct drm_crtc
*crtc
);
74 extern void gma_crtc_destroy(struct drm_crtc
*crtc
);
75 extern int gma_crtc_page_flip(struct drm_crtc
*crtc
,
76 struct drm_framebuffer
*fb
,
77 struct drm_pending_vblank_event
*event
,
78 uint32_t page_flip_flags
,
79 struct drm_modeset_acquire_ctx
*ctx
);
80 extern int gma_crtc_set_config(struct drm_mode_set
*set
,
81 struct drm_modeset_acquire_ctx
*ctx
);
83 extern void gma_crtc_save(struct drm_crtc
*crtc
);
84 extern void gma_crtc_restore(struct drm_crtc
*crtc
);
86 extern void gma_encoder_prepare(struct drm_encoder
*encoder
);
87 extern void gma_encoder_commit(struct drm_encoder
*encoder
);
88 extern void gma_encoder_destroy(struct drm_encoder
*encoder
);
90 /* Common clock related functions */
91 extern const struct gma_limit_t
*gma_limit(struct drm_crtc
*crtc
, int refclk
);
92 extern void gma_clock(int refclk
, struct gma_clock_t
*clock
);
93 extern bool gma_pll_is_valid(struct drm_crtc
*crtc
,
94 const struct gma_limit_t
*limit
,
95 struct gma_clock_t
*clock
);
96 extern bool gma_find_best_pll(const struct gma_limit_t
*limit
,
97 struct drm_crtc
*crtc
, int target
, int refclk
,
98 struct gma_clock_t
*best_clock
);