Merge branch 'modesetting-101' of git+ssh://git.freedesktop.org/git/mesa/drm into...
[platform/upstream/libdrm.git] / linux-core / intel_drv.h
1 /*
2  * Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
3  * Copyright (c) 2007 Intel Corporation
4  *   Jesse Barnes <jesse.barnes@intel.com>
5  */
6 #ifndef __INTEL_DRV_H__
7 #define __INTEL_DRV_H__
8
9 #include <linux/i2c.h>
10 #include <linux/i2c-id.h>
11 #include <linux/i2c-algo-bit.h>
12 #include "drm_crtc.h"
13
14 /*
15  * Display related stuff
16  */
17
18 /* store information about an Ixxx DVO */
19 /* The i830->i865 use multiple DVOs with multiple i2cs */
20 /* the i915, i945 have a single sDVO i2c bus - which is different */
21 #define MAX_OUTPUTS 6
22
23 #define INTEL_I2C_BUS_DVO 1
24 #define INTEL_I2C_BUS_SDVO 2
25
26 /* these are outputs from the chip - integrated only 
27    external chips are via DVO or SDVO output */
28 #define INTEL_OUTPUT_UNUSED 0
29 #define INTEL_OUTPUT_ANALOG 1
30 #define INTEL_OUTPUT_DVO 2
31 #define INTEL_OUTPUT_SDVO 3
32 #define INTEL_OUTPUT_LVDS 4
33 #define INTEL_OUTPUT_TVOUT 5
34
35 #define INTEL_DVO_CHIP_NONE 0
36 #define INTEL_DVO_CHIP_LVDS 1
37 #define INTEL_DVO_CHIP_TMDS 2
38 #define INTEL_DVO_CHIP_TVOUT 4
39
40 struct intel_i2c_chan {
41         drm_device_t *drm_dev; /* for getting at dev. private (mmio etc.) */
42         u32 reg; /* GPIO reg */
43         struct i2c_adapter adapter;
44         struct i2c_algo_bit_data algo;
45         u8 slave_addr;
46 };
47
48 struct intel_output {
49         int type;
50         struct intel_i2c_chan *i2c_bus; /* for control functions */
51         struct intel_i2c_chan *ddc_bus; /* for DDC only stuff */
52         bool load_detect_tmp;
53         void *dev_priv;
54 };
55
56 struct intel_crtc {
57         int pipe;
58         u8 lut_r[256], lut_g[256], lut_b[256];
59 };
60
61 struct intel_i2c_chan *intel_i2c_create(drm_device_t *dev, const u32 reg,
62                                         const char *name);
63 void intel_i2c_destroy(struct intel_i2c_chan *chan);
64 int intel_ddc_get_modes(struct drm_output *output);
65 extern bool intel_ddc_probe(struct drm_output *output);
66
67 extern void intel_crt_init(drm_device_t *dev);
68 extern void intel_sdvo_init(drm_device_t *dev, int output_device);
69 extern void intel_lvds_init(drm_device_t *dev);
70
71 extern void intel_crtc_load_lut(struct drm_crtc *crtc);
72 extern void intel_output_prepare (struct drm_output *output);
73 extern void intel_output_commit (struct drm_output *output);
74 extern struct drm_display_mode *intel_crtc_mode_get(drm_device_t *dev,
75                                                     struct drm_crtc *crtc);
76 extern void intel_wait_for_vblank(drm_device_t *dev);
77 extern struct drm_crtc *intel_get_crtc_from_pipe(drm_device_t *dev, int pipe);
78
79 extern int intelfb_probe(struct drm_device *dev, struct drm_framebuffer *fb);
80 extern int intelfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
81
82 #endif /* __INTEL_DRV_H__ */