Loading...
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#include <linux/pm_runtime.h>
26
27struct gma_clock_t {
28 /* given values */
29 int n;
30 int m1, m2;
31 int p1, p2;
32 /* derived values */
33 int dot;
34 int vco;
35 int m;
36 int p;
37};
38
39struct gma_range_t {
40 int min, max;
41};
42
43struct gma_p2_t {
44 int dot_limit;
45 int p2_slow, p2_fast;
46};
47
48struct gma_limit_t {
49 struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
50 struct gma_p2_t p2;
51 bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
52 int target, int refclk,
53 struct gma_clock_t *best_clock);
54};
55
56struct gma_clock_funcs {
57 void (*clock)(int refclk, struct gma_clock_t *clock);
58 const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk);
59 bool (*pll_is_valid)(struct drm_crtc *crtc,
60 const struct gma_limit_t *limit,
61 struct gma_clock_t *clock);
62};
63
64/* Common pipe related functions */
65extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type);
66extern void gma_wait_for_vblank(struct drm_device *dev);
67extern int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
68 struct drm_framebuffer *old_fb);
69extern int gma_crtc_cursor_set(struct drm_crtc *crtc,
70 struct drm_file *file_priv,
71 uint32_t handle,
72 uint32_t width, uint32_t height);
73extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
74extern void gma_crtc_load_lut(struct drm_crtc *crtc);
75extern void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
76 u16 *blue, u32 start, u32 size);
77extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
78extern void gma_crtc_prepare(struct drm_crtc *crtc);
79extern void gma_crtc_commit(struct drm_crtc *crtc);
80extern void gma_crtc_disable(struct drm_crtc *crtc);
81extern void gma_crtc_destroy(struct drm_crtc *crtc);
82extern int gma_crtc_set_config(struct drm_mode_set *set);
83
84extern void gma_crtc_save(struct drm_crtc *crtc);
85extern void gma_crtc_restore(struct drm_crtc *crtc);
86
87extern void gma_encoder_prepare(struct drm_encoder *encoder);
88extern void gma_encoder_commit(struct drm_encoder *encoder);
89extern void gma_encoder_destroy(struct drm_encoder *encoder);
90
91/* Common clock related functions */
92extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
93extern void gma_clock(int refclk, struct gma_clock_t *clock);
94extern bool gma_pll_is_valid(struct drm_crtc *crtc,
95 const struct gma_limit_t *limit,
96 struct gma_clock_t *clock);
97extern bool gma_find_best_pll(const struct gma_limit_t *limit,
98 struct drm_crtc *crtc, int target, int refclk,
99 struct gma_clock_t *best_clock);
100#endif
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
16struct drm_encoder;
17struct drm_mode_set;
18
19struct 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
31struct gma_range_t {
32 int min, max;
33};
34
35struct gma_p2_t {
36 int dot_limit;
37 int p2_slow, p2_fast;
38};
39
40struct 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
48struct 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 */
57extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type);
58extern void gma_wait_for_vblank(struct drm_device *dev);
59extern int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
60 struct drm_framebuffer *old_fb);
61extern void gma_crtc_load_lut(struct drm_crtc *crtc);
62extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
63extern void gma_crtc_prepare(struct drm_crtc *crtc);
64extern void gma_crtc_commit(struct drm_crtc *crtc);
65extern void gma_crtc_disable(struct drm_crtc *crtc);
66extern void gma_crtc_destroy(struct drm_crtc *crtc);
67extern 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
73extern void gma_crtc_save(struct drm_crtc *crtc);
74extern void gma_crtc_restore(struct drm_crtc *crtc);
75
76extern const struct drm_crtc_funcs gma_crtc_funcs;
77
78extern void gma_encoder_prepare(struct drm_encoder *encoder);
79extern void gma_encoder_commit(struct drm_encoder *encoder);
80extern void gma_encoder_destroy(struct drm_encoder *encoder);
81
82/* Common clock related functions */
83extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
84extern bool gma_pll_is_valid(struct drm_crtc *crtc,
85 const struct gma_limit_t *limit,
86 struct gma_clock_t *clock);
87extern bool gma_find_best_pll(const struct gma_limit_t *limit,
88 struct drm_crtc *crtc, int target, int refclk,
89 struct gma_clock_t *best_clock);
90#endif