2 * Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
3 * Copyright (c) 2007 Intel Corporation
4 * Jesse Barnes <jesse.barnes@intel.com>
6 #ifndef __INTEL_DRV_H__
7 #define __INTEL_DRV_H__
10 #include <linux/i2c-id.h>
11 #include <linux/i2c-algo-bit.h>
14 #include "drm_crtc_helper.h"
16 * Display related stuff
19 /* store information about an Ixxx DVO */
20 /* The i830->i865 use multiple DVOs with multiple i2cs */
21 /* the i915, i945 have a single sDVO i2c bus - which is different */
24 #define INTEL_I2C_BUS_DVO 1
25 #define INTEL_I2C_BUS_SDVO 2
27 /* these are outputs from the chip - integrated only
28 external chips are via DVO or SDVO output */
29 #define INTEL_OUTPUT_UNUSED 0
30 #define INTEL_OUTPUT_ANALOG 1
31 #define INTEL_OUTPUT_DVO 2
32 #define INTEL_OUTPUT_SDVO 3
33 #define INTEL_OUTPUT_LVDS 4
34 #define INTEL_OUTPUT_TVOUT 5
36 #define INTEL_DVO_CHIP_NONE 0
37 #define INTEL_DVO_CHIP_LVDS 1
38 #define INTEL_DVO_CHIP_TMDS 2
39 #define INTEL_DVO_CHIP_TVOUT 4
41 struct intel_i2c_chan {
42 struct drm_device *drm_dev; /* for getting at dev. private (mmio etc.) */
43 u32 reg; /* GPIO reg */
44 struct i2c_adapter adapter;
45 struct i2c_algo_bit_data algo;
49 struct intel_framebuffer {
50 struct drm_framebuffer base;
51 struct drm_buffer_object *bo;
52 struct drm_bo_kmap_obj kmap;
56 struct drm_connector base;
58 struct drm_encoder enc;
60 struct intel_i2c_chan *i2c_bus; /* for control functions */
61 struct intel_i2c_chan *ddc_bus; /* for DDC only stuff */
62 bool load_detect_temp;
71 u8 lut_r[256], lut_g[256], lut_b[256];
75 #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
76 #define to_intel_output(x) container_of(x, struct intel_output, base)
77 #define enc_to_intel_output(x) container_of(x, struct intel_output, enc)
78 #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
80 struct intel_i2c_chan *intel_i2c_create(struct drm_device *dev, const u32 reg,
82 void intel_i2c_destroy(struct intel_i2c_chan *chan);
83 int intel_ddc_get_modes(struct intel_output *intel_output);
84 extern bool intel_ddc_probe(struct intel_output *intel_output);
86 extern void intel_crt_init(struct drm_device *dev);
87 extern void intel_sdvo_init(struct drm_device *dev, int output_device);
88 extern void intel_dvo_init(struct drm_device *dev);
89 extern void intel_tv_init(struct drm_device *dev);
90 extern void intel_lvds_init(struct drm_device *dev);
92 extern void intel_crtc_load_lut(struct drm_crtc *crtc);
93 extern void intel_encoder_prepare (struct drm_encoder *encoder);
94 extern void intel_encoder_commit (struct drm_encoder *encoder);
96 extern struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
98 extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
99 struct drm_crtc *crtc);
100 extern void intel_wait_for_vblank(struct drm_device *dev);
101 extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe);
102 extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
103 struct drm_display_mode *mode,
105 extern void intel_release_load_detect_pipe(struct intel_output *intel_output,
108 extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB);
109 extern int intel_sdvo_supports_hotplug(struct drm_connector *connector);
110 extern void intel_sdvo_set_hotplug(struct drm_connector *connector, int enable);
111 extern int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc, struct drm_connector *connector);
112 extern int intelfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
113 extern int intelfb_resize(struct drm_device *dev, struct drm_crtc *crtc);
114 extern void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
115 u16 blue, int regno);
117 extern struct drm_framebuffer *intel_user_framebuffer_create(struct drm_device *dev,
118 struct drm_file *file_priv,
119 struct drm_mode_fb_cmd *mode_cmd);
120 #endif /* __INTEL_DRV_H__ */