Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright © 2006-2011 Intel Corporation
0004  *
0005  * Authors:
0006  *  Eric Anholt <eric@anholt.net>
0007  *  Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
0008  */
0009 
0010 #ifndef _GMA_DISPLAY_H_
0011 #define _GMA_DISPLAY_H_
0012 
0013 #include <linux/pm_runtime.h>
0014 #include <drm/drm_vblank.h>
0015 
0016 struct drm_encoder;
0017 struct drm_mode_set;
0018 
0019 struct gma_clock_t {
0020     /* given values */
0021     int n;
0022     int m1, m2;
0023     int p1, p2;
0024     /* derived values */
0025     int dot;
0026     int vco;
0027     int m;
0028     int p;
0029 };
0030 
0031 struct gma_range_t {
0032     int min, max;
0033 };
0034 
0035 struct gma_p2_t {
0036     int dot_limit;
0037     int p2_slow, p2_fast;
0038 };
0039 
0040 struct gma_limit_t {
0041     struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
0042     struct gma_p2_t p2;
0043     bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
0044              int target, int refclk,
0045              struct gma_clock_t *best_clock);
0046 };
0047 
0048 struct gma_clock_funcs {
0049     void (*clock)(int refclk, struct gma_clock_t *clock);
0050     const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk);
0051     bool (*pll_is_valid)(struct drm_crtc *crtc,
0052                  const struct gma_limit_t *limit,
0053                  struct gma_clock_t *clock);
0054 };
0055 
0056 /* Common pipe related functions */
0057 extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type);
0058 extern void gma_wait_for_vblank(struct drm_device *dev);
0059 extern int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
0060                  struct drm_framebuffer *old_fb);
0061 extern void gma_crtc_load_lut(struct drm_crtc *crtc);
0062 extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
0063 extern void gma_crtc_prepare(struct drm_crtc *crtc);
0064 extern void gma_crtc_commit(struct drm_crtc *crtc);
0065 extern void gma_crtc_disable(struct drm_crtc *crtc);
0066 extern void gma_crtc_destroy(struct drm_crtc *crtc);
0067 extern int gma_crtc_page_flip(struct drm_crtc *crtc,
0068                   struct drm_framebuffer *fb,
0069                   struct drm_pending_vblank_event *event,
0070                   uint32_t page_flip_flags,
0071                   struct drm_modeset_acquire_ctx *ctx);
0072 extern int gma_crtc_set_config(struct drm_mode_set *set,
0073                    struct drm_modeset_acquire_ctx *ctx);
0074 
0075 extern void gma_crtc_save(struct drm_crtc *crtc);
0076 extern void gma_crtc_restore(struct drm_crtc *crtc);
0077 
0078 extern const struct drm_crtc_funcs gma_crtc_funcs;
0079 
0080 extern void gma_encoder_prepare(struct drm_encoder *encoder);
0081 extern void gma_encoder_commit(struct drm_encoder *encoder);
0082 extern void gma_encoder_destroy(struct drm_encoder *encoder);
0083 
0084 /* Common clock related functions */
0085 extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
0086 extern void gma_clock(int refclk, struct gma_clock_t *clock);
0087 extern bool gma_pll_is_valid(struct drm_crtc *crtc,
0088                  const struct gma_limit_t *limit,
0089                  struct gma_clock_t *clock);
0090 extern bool gma_find_best_pll(const struct gma_limit_t *limit,
0091                   struct drm_crtc *crtc, int target, int refclk,
0092                   struct gma_clock_t *best_clock);
0093 #endif