Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 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> |
| 27 | #include "drmP.h" |
| 28 | #include "drm.h" |
| 29 | #include "drm_crtc.h" |
| 30 | #include "intel_drv.h" |
| 31 | |
| 32 | struct intel_dvo_device { |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 33 | const char *name; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 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; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 40 | |
| 41 | const struct intel_dvo_dev_ops *dev_ops; |
| 42 | void *dev_priv; |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 43 | struct i2c_adapter *i2c_bus; |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 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, |
Keith Packard | f9c10a9 | 2009-05-30 12:16:25 -0700 | [diff] [blame] | 52 | struct i2c_adapter *i2cbus); |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 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 | /* |
Daniel Vetter | fac3274 | 2012-08-12 19:27:12 +0200 | [diff] [blame^] | 61 | * Turn on/off output. |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 62 | * |
Daniel Vetter | fac3274 | 2012-08-12 19:27:12 +0200 | [diff] [blame^] | 63 | * Because none of our dvo drivers support an intermediate power levels, |
| 64 | * we don't expose this in the interfac. |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 65 | */ |
Daniel Vetter | fac3274 | 2012-08-12 19:27:12 +0200 | [diff] [blame^] | 66 | void (*dpms)(struct intel_dvo_device *dvo, bool enable); |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 67 | |
| 68 | /* |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 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 | |
| 80 | /* |
| 81 | * Callback to adjust the mode to be set in the CRTC. |
| 82 | * |
| 83 | * This allows an output to adjust the clock or even the entire set of |
| 84 | * timings, which is used for panels with fixed timings or for |
| 85 | * buses with clock limitations. |
| 86 | */ |
| 87 | bool (*mode_fixup)(struct intel_dvo_device *dvo, |
Laurent Pinchart | e811f5a | 2012-07-17 17:56:50 +0200 | [diff] [blame] | 88 | const struct drm_display_mode *mode, |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 89 | struct drm_display_mode *adjusted_mode); |
| 90 | |
| 91 | /* |
| 92 | * Callback for preparing mode changes on an output |
| 93 | */ |
| 94 | void (*prepare)(struct intel_dvo_device *dvo); |
| 95 | |
| 96 | /* |
| 97 | * Callback for committing mode changes on an output |
| 98 | */ |
| 99 | void (*commit)(struct intel_dvo_device *dvo); |
| 100 | |
| 101 | /* |
| 102 | * Callback for setting up a video mode after fixups have been made. |
| 103 | * |
| 104 | * This is only called while the output is disabled. The dpms callback |
| 105 | * must be all that's necessary for the output, to turn the output on |
| 106 | * after this function is called. |
| 107 | */ |
| 108 | void (*mode_set)(struct intel_dvo_device *dvo, |
| 109 | struct drm_display_mode *mode, |
| 110 | struct drm_display_mode *adjusted_mode); |
| 111 | |
| 112 | /* |
| 113 | * Probe for a connected output, and return detect_status. |
| 114 | */ |
| 115 | enum drm_connector_status (*detect)(struct intel_dvo_device *dvo); |
| 116 | |
| 117 | /** |
| 118 | * Query the device for the modes it provides. |
| 119 | * |
| 120 | * This function may also update MonInfo, mm_width, and mm_height. |
| 121 | * |
| 122 | * \return singly-linked list of modes or NULL if no modes found. |
| 123 | */ |
| 124 | struct drm_display_mode *(*get_modes)(struct intel_dvo_device *dvo); |
| 125 | |
| 126 | /** |
| 127 | * Clean up driver-specific bits of the output |
| 128 | */ |
| 129 | void (*destroy) (struct intel_dvo_device *dvo); |
| 130 | |
| 131 | /** |
| 132 | * Debugging hook to dump device registers to log file |
| 133 | */ |
| 134 | void (*dump_regs)(struct intel_dvo_device *dvo); |
| 135 | }; |
| 136 | |
Hannes Eder | 606df4e | 2008-12-18 21:22:24 +0100 | [diff] [blame] | 137 | extern struct intel_dvo_dev_ops sil164_ops; |
| 138 | extern struct intel_dvo_dev_ops ch7xxx_ops; |
| 139 | extern struct intel_dvo_dev_ops ivch_ops; |
| 140 | extern struct intel_dvo_dev_ops tfp410_ops; |
| 141 | extern struct intel_dvo_dev_ops ch7017_ops; |
Thomas Richter | 7434a25 | 2012-07-18 19:22:30 +0200 | [diff] [blame] | 142 | extern struct intel_dvo_dev_ops ns2501_ops; |
Hannes Eder | 606df4e | 2008-12-18 21:22:24 +0100 | [diff] [blame] | 143 | |
Jesse Barnes | 79e5394 | 2008-11-07 14:24:08 -0800 | [diff] [blame] | 144 | #endif /* _INTEL_DVO_H */ |