Commit | Line | Data |
---|---|---|
5ea75e0f PJ |
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 | ||
22 | #ifndef _GMA_DISPLAY_H_ | |
23 | #define _GMA_DISPLAY_H_ | |
24 | ||
25 | struct gma_clock_t { | |
26 | /* given values */ | |
27 | int n; | |
28 | int m1, m2; | |
29 | int p1, p2; | |
30 | /* derived values */ | |
31 | int dot; | |
32 | int vco; | |
33 | int m; | |
34 | int p; | |
35 | }; | |
36 | ||
37 | struct gma_range_t { | |
38 | int min, max; | |
39 | }; | |
40 | ||
41 | struct gma_p2_t { | |
42 | int dot_limit; | |
43 | int p2_slow, p2_fast; | |
44 | }; | |
45 | ||
46 | struct gma_limit_t { | |
47 | struct gma_range_t dot, vco, n, m, m1, m2, p, p1; | |
48 | struct gma_p2_t p2; | |
49 | bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *, | |
50 | int target, int refclk, | |
51 | struct gma_clock_t *best_clock); | |
52 | }; | |
53 | ||
54 | struct gma_clock_funcs { | |
55 | void (*clock)(int refclk, struct gma_clock_t *clock); | |
56 | const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk); | |
57 | bool (*pll_is_valid)(struct drm_crtc *crtc, | |
58 | const struct gma_limit_t *limit, | |
59 | struct gma_clock_t *clock); | |
60 | }; | |
61 | ||
62 | /* Common pipe related functions */ | |
63 | extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type); | |
64 | ||
65 | /* Common clock related functions */ | |
66 | extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk); | |
67 | extern void gma_clock(int refclk, struct gma_clock_t *clock); | |
68 | extern bool gma_pll_is_valid(struct drm_crtc *crtc, | |
69 | const struct gma_limit_t *limit, | |
70 | struct gma_clock_t *clock); | |
71 | extern bool gma_find_best_pll(const struct gma_limit_t *limit, | |
72 | struct drm_crtc *crtc, int target, int refclk, | |
73 | struct gma_clock_t *best_clock); | |
74 | #endif |