• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright © 2006-2011 Intel Corporation
4  *
5  * Authors:
6  *	Eric Anholt <eric@anholt.net>
7  *	Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
8  */
9 
10 #ifndef _GMA_DISPLAY_H_
11 #define _GMA_DISPLAY_H_
12 
13 #include <linux/pm_runtime.h>
14 #include <drm/drm_vblank.h>
15 
16 struct drm_encoder;
17 struct drm_mode_set;
18 
19 struct gma_clock_t {
20 	/* given values */
21 	int n;
22 	int m1, m2;
23 	int p1, p2;
24 	/* derived values */
25 	int dot;
26 	int vco;
27 	int m;
28 	int p;
29 };
30 
31 struct gma_range_t {
32 	int min, max;
33 };
34 
35 struct gma_p2_t {
36 	int dot_limit;
37 	int p2_slow, p2_fast;
38 };
39 
40 struct gma_limit_t {
41 	struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
42 	struct gma_p2_t p2;
43 	bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
44 			 int target, int refclk,
45 			 struct gma_clock_t *best_clock);
46 };
47 
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);
54 };
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 int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
68 			      u16 *blue, u32 size,
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);
82 
83 extern void gma_crtc_save(struct drm_crtc *crtc);
84 extern void gma_crtc_restore(struct drm_crtc *crtc);
85 
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);
89 
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);
99 #endif
100