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