linux/drivers/gpu/drm/gma500/gma_display.h
<<
>>
Prefs
   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
  15struct drm_encoder;
  16struct drm_mode_set;
  17
  18struct gma_clock_t {
  19        /* given values */
  20        int n;
  21        int m1, m2;
  22        int p1, p2;
  23        /* derived values */
  24        int dot;
  25        int vco;
  26        int m;
  27        int p;
  28};
  29
  30struct gma_range_t {
  31        int min, max;
  32};
  33
  34struct gma_p2_t {
  35        int dot_limit;
  36        int p2_slow, p2_fast;
  37};
  38
  39struct gma_limit_t {
  40        struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
  41        struct gma_p2_t p2;
  42        bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
  43                         int target, int refclk,
  44                         struct gma_clock_t *best_clock);
  45};
  46
  47struct gma_clock_funcs {
  48        void (*clock)(int refclk, struct gma_clock_t *clock);
  49        const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk);
  50        bool (*pll_is_valid)(struct drm_crtc *crtc,
  51                             const struct gma_limit_t *limit,
  52                             struct gma_clock_t *clock);
  53};
  54
  55/* Common pipe related functions */
  56extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type);
  57extern void gma_wait_for_vblank(struct drm_device *dev);
  58extern int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
  59                             struct drm_framebuffer *old_fb);
  60extern int gma_crtc_cursor_set(struct drm_crtc *crtc,
  61                               struct drm_file *file_priv,
  62                               uint32_t handle,
  63                               uint32_t width, uint32_t height);
  64extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
  65extern void gma_crtc_load_lut(struct drm_crtc *crtc);
  66extern int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
  67                              u16 *blue, u32 size,
  68                              struct drm_modeset_acquire_ctx *ctx);
  69extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
  70extern void gma_crtc_prepare(struct drm_crtc *crtc);
  71extern void gma_crtc_commit(struct drm_crtc *crtc);
  72extern void gma_crtc_disable(struct drm_crtc *crtc);
  73extern void gma_crtc_destroy(struct drm_crtc *crtc);
  74extern int gma_crtc_set_config(struct drm_mode_set *set,
  75                               struct drm_modeset_acquire_ctx *ctx);
  76
  77extern void gma_crtc_save(struct drm_crtc *crtc);
  78extern void gma_crtc_restore(struct drm_crtc *crtc);
  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
  94