First Support on Ginger and OMAP TI
[linux-ginger.git] / drivers / gpu / drm / i915 / dvo.h
blob288fc50627e2de2f795854b2ec965a3ebc19a8c5
1 /*
2 * Copyright © 2006 Eric Anholt
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
23 #ifndef _INTEL_DVO_H
24 #define _INTEL_DVO_H
26 #include <linux/i2c.h>
27 #include "drmP.h"
28 #include "drm.h"
29 #include "drm_crtc.h"
30 #include "intel_drv.h"
32 struct intel_dvo_device {
33 char *name;
34 int type;
35 /* DVOA/B/C output register */
36 u32 dvo_reg;
37 /* GPIO register used for i2c bus to control this device */
38 u32 gpio;
39 int slave_addr;
40 struct i2c_adapter *i2c_bus;
42 const struct intel_dvo_dev_ops *dev_ops;
43 void *dev_priv;
45 struct drm_display_mode *panel_fixed_mode;
46 bool panel_wants_dither;
49 struct intel_dvo_dev_ops {
51 * Initialize the device at startup time.
52 * Returns NULL if the device does not exist.
54 bool (*init)(struct intel_dvo_device *dvo,
55 struct i2c_adapter *i2cbus);
58 * Called to allow the output a chance to create properties after the
59 * RandR objects have been created.
61 void (*create_resources)(struct intel_dvo_device *dvo);
64 * Turn on/off output or set intermediate power levels if available.
66 * Unsupported intermediate modes drop to the lower power setting.
67 * If the mode is DPMSModeOff, the output must be disabled,
68 * as the DPLL may be disabled afterwards.
70 void (*dpms)(struct intel_dvo_device *dvo, int mode);
73 * Saves the output's state for restoration on VT switch.
75 void (*save)(struct intel_dvo_device *dvo);
78 * Restore's the output's state at VT switch.
80 void (*restore)(struct intel_dvo_device *dvo);
83 * Callback for testing a video mode for a given output.
85 * This function should only check for cases where a mode can't
86 * be supported on the output specifically, and not represent
87 * generic CRTC limitations.
89 * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
91 int (*mode_valid)(struct intel_dvo_device *dvo,
92 struct drm_display_mode *mode);
95 * Callback to adjust the mode to be set in the CRTC.
97 * This allows an output to adjust the clock or even the entire set of
98 * timings, which is used for panels with fixed timings or for
99 * buses with clock limitations.
101 bool (*mode_fixup)(struct intel_dvo_device *dvo,
102 struct drm_display_mode *mode,
103 struct drm_display_mode *adjusted_mode);
106 * Callback for preparing mode changes on an output
108 void (*prepare)(struct intel_dvo_device *dvo);
111 * Callback for committing mode changes on an output
113 void (*commit)(struct intel_dvo_device *dvo);
116 * Callback for setting up a video mode after fixups have been made.
118 * This is only called while the output is disabled. The dpms callback
119 * must be all that's necessary for the output, to turn the output on
120 * after this function is called.
122 void (*mode_set)(struct intel_dvo_device *dvo,
123 struct drm_display_mode *mode,
124 struct drm_display_mode *adjusted_mode);
127 * Probe for a connected output, and return detect_status.
129 enum drm_connector_status (*detect)(struct intel_dvo_device *dvo);
132 * Query the device for the modes it provides.
134 * This function may also update MonInfo, mm_width, and mm_height.
136 * \return singly-linked list of modes or NULL if no modes found.
138 struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo);
141 * Clean up driver-specific bits of the output
143 void (*destroy) (struct intel_dvo_device *dvo);
146 * Debugging hook to dump device registers to log file
148 void (*dump_regs)(struct intel_dvo_device *dvo);
151 extern struct intel_dvo_dev_ops sil164_ops;
152 extern struct intel_dvo_dev_ops ch7xxx_ops;
153 extern struct intel_dvo_dev_ops ivch_ops;
154 extern struct intel_dvo_dev_ops tfp410_ops;
155 extern struct intel_dvo_dev_ops ch7017_ops;
157 #endif /* _INTEL_DVO_H */