Commit | Line | Data |
---|---|---|
79e53945 JB |
1 | /* |
2 | * Copyright © 2006 Eric Anholt | |
3 | * | |
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. | |
13 | * | |
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. | |
21 | */ | |
22 | ||
23 | #ifndef _INTEL_DVO_H | |
24 | #define _INTEL_DVO_H | |
25 | ||
26 | #include <linux/i2c.h> | |
760285e7 DH |
27 | #include <drm/drmP.h> |
28 | #include <drm/drm_crtc.h> | |
79e53945 JB |
29 | #include "intel_drv.h" |
30 | ||
31 | struct intel_dvo_device { | |
ea5b213a | 32 | const char *name; |
79e53945 JB |
33 | int type; |
34 | /* DVOA/B/C output register */ | |
f0f59a00 VS |
35 | i915_reg_t dvo_reg; |
36 | i915_reg_t dvo_srcdim_reg; | |
79e53945 JB |
37 | /* GPIO register used for i2c bus to control this device */ |
38 | u32 gpio; | |
39 | int slave_addr; | |
79e53945 JB |
40 | |
41 | const struct intel_dvo_dev_ops *dev_ops; | |
42 | void *dev_priv; | |
ea5b213a | 43 | struct i2c_adapter *i2c_bus; |
79e53945 JB |
44 | }; |
45 | ||
46 | struct intel_dvo_dev_ops { | |
47 | /* | |
48 | * Initialize the device at startup time. | |
49 | * Returns NULL if the device does not exist. | |
50 | */ | |
51 | bool (*init)(struct intel_dvo_device *dvo, | |
f9c10a9b | 52 | struct i2c_adapter *i2cbus); |
79e53945 JB |
53 | |
54 | /* | |
55 | * Called to allow the output a chance to create properties after the | |
56 | * RandR objects have been created. | |
57 | */ | |
58 | void (*create_resources)(struct intel_dvo_device *dvo); | |
59 | ||
60 | /* | |
fac3274c | 61 | * Turn on/off output. |
79e53945 | 62 | * |
fac3274c DV |
63 | * Because none of our dvo drivers support an intermediate power levels, |
64 | * we don't expose this in the interfac. | |
79e53945 | 65 | */ |
fac3274c | 66 | void (*dpms)(struct intel_dvo_device *dvo, bool enable); |
79e53945 | 67 | |
79e53945 JB |
68 | /* |
69 | * Callback for testing a video mode for a given output. | |
70 | * | |
71 | * This function should only check for cases where a mode can't | |
72 | * be supported on the output specifically, and not represent | |
73 | * generic CRTC limitations. | |
74 | * | |
75 | * \return MODE_OK if the mode is valid, or another MODE_* otherwise. | |
76 | */ | |
77 | int (*mode_valid)(struct intel_dvo_device *dvo, | |
78 | struct drm_display_mode *mode); | |
79 | ||
79e53945 JB |
80 | /* |
81 | * Callback for preparing mode changes on an output | |
82 | */ | |
83 | void (*prepare)(struct intel_dvo_device *dvo); | |
84 | ||
85 | /* | |
86 | * Callback for committing mode changes on an output | |
87 | */ | |
88 | void (*commit)(struct intel_dvo_device *dvo); | |
89 | ||
90 | /* | |
91 | * Callback for setting up a video mode after fixups have been made. | |
92 | * | |
93 | * This is only called while the output is disabled. The dpms callback | |
94 | * must be all that's necessary for the output, to turn the output on | |
95 | * after this function is called. | |
96 | */ | |
97 | void (*mode_set)(struct intel_dvo_device *dvo, | |
7c5f93b0 VS |
98 | const struct drm_display_mode *mode, |
99 | const struct drm_display_mode *adjusted_mode); | |
79e53945 JB |
100 | |
101 | /* | |
102 | * Probe for a connected output, and return detect_status. | |
103 | */ | |
104 | enum drm_connector_status (*detect)(struct intel_dvo_device *dvo); | |
105 | ||
732ce74f DV |
106 | /* |
107 | * Probe the current hw status, returning true if the connected output | |
108 | * is active. | |
109 | */ | |
110 | bool (*get_hw_state)(struct intel_dvo_device *dev); | |
111 | ||
79e53945 JB |
112 | /** |
113 | * Query the device for the modes it provides. | |
114 | * | |
115 | * This function may also update MonInfo, mm_width, and mm_height. | |
116 | * | |
117 | * \return singly-linked list of modes or NULL if no modes found. | |
118 | */ | |
119 | struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo); | |
120 | ||
121 | /** | |
122 | * Clean up driver-specific bits of the output | |
123 | */ | |
124 | void (*destroy) (struct intel_dvo_device *dvo); | |
125 | ||
126 | /** | |
127 | * Debugging hook to dump device registers to log file | |
128 | */ | |
129 | void (*dump_regs)(struct intel_dvo_device *dvo); | |
130 | }; | |
131 | ||
0f555644 JL |
132 | extern const struct intel_dvo_dev_ops sil164_ops; |
133 | extern const struct intel_dvo_dev_ops ch7xxx_ops; | |
134 | extern const struct intel_dvo_dev_ops ivch_ops; | |
135 | extern const struct intel_dvo_dev_ops tfp410_ops; | |
136 | extern const struct intel_dvo_dev_ops ch7017_ops; | |
137 | extern const struct intel_dvo_dev_ops ns2501_ops; | |
606df4e0 | 138 | |
79e53945 | 139 | #endif /* _INTEL_DVO_H */ |