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
26 #include <linux/i2c.h>
28 #include <drm/drm_crtc.h>
29 #include "intel_drv.h"
31 struct intel_dvo_device
{
34 /* DVOA/B/C output register */
36 /* GPIO register used for i2c bus to control this device */
40 const struct intel_dvo_dev_ops
*dev_ops
;
42 struct i2c_adapter
*i2c_bus
;
45 struct intel_dvo_dev_ops
{
47 * Initialize the device at startup time.
48 * Returns NULL if the device does not exist.
50 bool (*init
)(struct intel_dvo_device
*dvo
,
51 struct i2c_adapter
*i2cbus
);
54 * Called to allow the output a chance to create properties after the
55 * RandR objects have been created.
57 void (*create_resources
)(struct intel_dvo_device
*dvo
);
62 * Because none of our dvo drivers support an intermediate power levels,
63 * we don't expose this in the interfac.
65 void (*dpms
)(struct intel_dvo_device
*dvo
, bool enable
);
68 * Callback for testing a video mode for a given output.
70 * This function should only check for cases where a mode can't
71 * be supported on the output specifically, and not represent
72 * generic CRTC limitations.
74 * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
76 int (*mode_valid
)(struct intel_dvo_device
*dvo
,
77 struct drm_display_mode
*mode
);
80 * Callback to adjust the mode to be set in the CRTC.
82 * This allows an output to adjust the clock or even the entire set of
83 * timings, which is used for panels with fixed timings or for
84 * buses with clock limitations.
86 bool (*mode_fixup
)(struct intel_dvo_device
*dvo
,
87 const struct drm_display_mode
*mode
,
88 struct drm_display_mode
*adjusted_mode
);
91 * Callback for preparing mode changes on an output
93 void (*prepare
)(struct intel_dvo_device
*dvo
);
96 * Callback for committing mode changes on an output
98 void (*commit
)(struct intel_dvo_device
*dvo
);
101 * Callback for setting up a video mode after fixups have been made.
103 * This is only called while the output is disabled. The dpms callback
104 * must be all that's necessary for the output, to turn the output on
105 * after this function is called.
107 void (*mode_set
)(struct intel_dvo_device
*dvo
,
108 struct drm_display_mode
*mode
,
109 struct drm_display_mode
*adjusted_mode
);
112 * Probe for a connected output, and return detect_status.
114 enum drm_connector_status (*detect
)(struct intel_dvo_device
*dvo
);
117 * Probe the current hw status, returning true if the connected output
120 bool (*get_hw_state
)(struct intel_dvo_device
*dev
);
123 * Query the device for the modes it provides.
125 * This function may also update MonInfo, mm_width, and mm_height.
127 * \return singly-linked list of modes or NULL if no modes found.
129 struct drm_display_mode
*(*get_modes
)(struct intel_dvo_device
*dvo
);
132 * Clean up driver-specific bits of the output
134 void (*destroy
) (struct intel_dvo_device
*dvo
);
137 * Debugging hook to dump device registers to log file
139 void (*dump_regs
)(struct intel_dvo_device
*dvo
);
142 extern struct intel_dvo_dev_ops sil164_ops
;
143 extern struct intel_dvo_dev_ops ch7xxx_ops
;
144 extern struct intel_dvo_dev_ops ivch_ops
;
145 extern struct intel_dvo_dev_ops tfp410_ops
;
146 extern struct intel_dvo_dev_ops ch7017_ops
;
147 extern struct intel_dvo_dev_ops ns2501_ops
;
149 #endif /* _INTEL_DVO_H */