gma_display.h (2821B)
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); 72extern int gma_crtc_set_config(struct drm_mode_set *set, 73 struct drm_modeset_acquire_ctx *ctx); 74 75extern void gma_crtc_save(struct drm_crtc *crtc); 76extern void gma_crtc_restore(struct drm_crtc *crtc); 77 78extern const struct drm_crtc_funcs gma_crtc_funcs; 79 80extern void gma_encoder_prepare(struct drm_encoder *encoder); 81extern void gma_encoder_commit(struct drm_encoder *encoder); 82extern void gma_encoder_destroy(struct drm_encoder *encoder); 83 84/* Common clock related functions */ 85extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk); 86extern void gma_clock(int refclk, struct gma_clock_t *clock); 87extern bool gma_pll_is_valid(struct drm_crtc *crtc, 88 const struct gma_limit_t *limit, 89 struct gma_clock_t *clock); 90extern 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); 93#endif