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;
50 struct drm_connector base;
52 struct drm_encoder enc;
54 struct intel_i2c_chan *i2c_bus; /* for control functions */
55 struct intel_i2c_chan *ddc_bus; /* for DDC only stuff */
56 bool load_detect_temp;
65 u8 lut_r[256], lut_g[256], lut_b[256];
69 #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
70 #define to_intel_output(x) container_of(x, struct intel_output, base)
71 #define enc_to_intel_output(x) container_of(x, struct intel_output, enc)
73 struct intel_i2c_chan *intel_i2c_create(struct drm_device *dev, const u32 reg,
75 void intel_i2c_destroy(struct intel_i2c_chan *chan);
76 int intel_ddc_get_modes(struct intel_output *intel_output);
77 extern bool intel_ddc_probe(struct intel_output *intel_output);
79 extern void intel_crt_init(struct drm_device *dev);
80 extern void intel_sdvo_init(struct drm_device *dev, int output_device);
81 extern void intel_dvo_init(struct drm_device *dev);
82 extern void intel_tv_init(struct drm_device *dev);
83 extern void intel_lvds_init(struct drm_device *dev);
85 extern void intel_crtc_load_lut(struct drm_crtc *crtc);
86 extern void intel_encoder_prepare (struct drm_encoder *encoder);
87 extern void intel_encoder_commit (struct drm_encoder *encoder);
89 extern struct drm_encoder *intel_best_encoder(struct drm_connector *connector);
91 extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
92 struct drm_crtc *crtc);
93 extern void intel_wait_for_vblank(struct drm_device *dev);
94 extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe);
95 extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
96 struct drm_display_mode *mode,
98 extern void intel_release_load_detect_pipe(struct intel_output *intel_output,
101 extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB);
102 extern int intel_sdvo_supports_hotplug(struct drm_connector *connector);
103 extern void intel_sdvo_set_hotplug(struct drm_connector *connector, int enable);
104 extern int intelfb_probe(struct drm_device *dev, struct drm_crtc *crtc, struct drm_connector *connector);
105 extern int intelfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
106 extern int intelfb_resize(struct drm_device *dev, struct drm_crtc *crtc);
108 #endif /* __INTEL_DRV_H__ */