Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2006 Dave Airlie <airlied@linux.ie> |
| 3 | * Copyright © 2006-2009 Intel Corporation |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice (including the next |
| 13 | * paragraph) shall be included in all copies or substantial portions of the |
| 14 | * Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 22 | * DEALINGS IN THE SOFTWARE. |
| 23 | * |
| 24 | * Authors: |
| 25 | * Eric Anholt <eric@anholt.net> |
| 26 | * Jesse Barnes <jesse.barnes@intel.com> |
| 27 | */ |
| 28 | |
| 29 | #include <linux/i2c.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 30 | #include <linux/slab.h> |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 31 | #include <linux/delay.h> |
| 32 | #include "drmP.h" |
| 33 | #include "drm.h" |
| 34 | #include "drm_crtc.h" |
Keith Packard | aa93d63 | 2009-05-05 09:52:46 -0700 | [diff] [blame] | 35 | #include "drm_edid.h" |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 36 | #include "intel_drv.h" |
| 37 | #include "i915_drm.h" |
| 38 | #include "i915_drv.h" |
| 39 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 40 | struct intel_hdmi { |
| 41 | struct intel_encoder base; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 42 | u32 sdvox_reg; |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 43 | int ddc_bus; |
Ma Ling | 9dff6af | 2009-04-02 13:13:26 +0800 | [diff] [blame] | 44 | bool has_hdmi_sink; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 45 | }; |
| 46 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 47 | static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) |
| 48 | { |
Chris Wilson | 4ef69c7 | 2010-09-09 15:14:28 +0100 | [diff] [blame] | 49 | return container_of(encoder, struct intel_hdmi, base.base); |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 50 | } |
| 51 | |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 52 | static struct intel_hdmi *intel_attached_hdmi(struct drm_connector *connector) |
| 53 | { |
| 54 | return container_of(intel_attached_encoder(connector), |
| 55 | struct intel_hdmi, base); |
| 56 | } |
| 57 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 58 | static void intel_hdmi_mode_set(struct drm_encoder *encoder, |
| 59 | struct drm_display_mode *mode, |
| 60 | struct drm_display_mode *adjusted_mode) |
| 61 | { |
| 62 | struct drm_device *dev = encoder->dev; |
| 63 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 64 | struct drm_crtc *crtc = encoder->crtc; |
| 65 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 66 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 67 | u32 sdvox; |
| 68 | |
Adam Jackson | b599c0b | 2010-07-16 14:46:31 -0400 | [diff] [blame] | 69 | sdvox = SDVO_ENCODING_HDMI | SDVO_BORDER_ENABLE; |
| 70 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
| 71 | sdvox |= SDVO_VSYNC_ACTIVE_HIGH; |
| 72 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
| 73 | sdvox |= SDVO_HSYNC_ACTIVE_HIGH; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 74 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 75 | if (intel_hdmi->has_hdmi_sink) { |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 76 | sdvox |= SDVO_AUDIO_ENABLE; |
Zhenyu Wang | 467b200 | 2010-05-12 11:02:14 +0800 | [diff] [blame] | 77 | if (HAS_PCH_CPT(dev)) |
| 78 | sdvox |= HDMI_MODE_SELECT; |
| 79 | } |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 80 | |
Zhenyu Wang | 0f22906 | 2010-04-07 16:15:57 +0800 | [diff] [blame] | 81 | if (intel_crtc->pipe == 1) { |
| 82 | if (HAS_PCH_CPT(dev)) |
| 83 | sdvox |= PORT_TRANS_B_SEL_CPT; |
| 84 | else |
| 85 | sdvox |= SDVO_PIPE_B_SELECT; |
| 86 | } |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 87 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 88 | I915_WRITE(intel_hdmi->sdvox_reg, sdvox); |
| 89 | POSTING_READ(intel_hdmi->sdvox_reg); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) |
| 93 | { |
| 94 | struct drm_device *dev = encoder->dev; |
| 95 | struct drm_i915_private *dev_priv = dev->dev_private; |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 96 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 97 | u32 temp; |
| 98 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 99 | temp = I915_READ(intel_hdmi->sdvox_reg); |
Zhenyu Wang | d8a2d0e | 2009-11-02 07:52:30 +0000 | [diff] [blame] | 100 | |
| 101 | /* HW workaround, need to toggle enable bit off and on for 12bpc, but |
| 102 | * we do this anyway which shows more stable in testing. |
| 103 | */ |
Eric Anholt | c619eed | 2010-01-28 16:45:52 -0800 | [diff] [blame] | 104 | if (HAS_PCH_SPLIT(dev)) { |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 105 | I915_WRITE(intel_hdmi->sdvox_reg, temp & ~SDVO_ENABLE); |
| 106 | POSTING_READ(intel_hdmi->sdvox_reg); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 107 | } |
Zhenyu Wang | d8a2d0e | 2009-11-02 07:52:30 +0000 | [diff] [blame] | 108 | |
| 109 | if (mode != DRM_MODE_DPMS_ON) { |
| 110 | temp &= ~SDVO_ENABLE; |
| 111 | } else { |
| 112 | temp |= SDVO_ENABLE; |
| 113 | } |
| 114 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 115 | I915_WRITE(intel_hdmi->sdvox_reg, temp); |
| 116 | POSTING_READ(intel_hdmi->sdvox_reg); |
Zhenyu Wang | d8a2d0e | 2009-11-02 07:52:30 +0000 | [diff] [blame] | 117 | |
| 118 | /* HW workaround, need to write this twice for issue that may result |
| 119 | * in first write getting masked. |
| 120 | */ |
Eric Anholt | c619eed | 2010-01-28 16:45:52 -0800 | [diff] [blame] | 121 | if (HAS_PCH_SPLIT(dev)) { |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 122 | I915_WRITE(intel_hdmi->sdvox_reg, temp); |
| 123 | POSTING_READ(intel_hdmi->sdvox_reg); |
Zhenyu Wang | d8a2d0e | 2009-11-02 07:52:30 +0000 | [diff] [blame] | 124 | } |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 125 | } |
| 126 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 127 | static int intel_hdmi_mode_valid(struct drm_connector *connector, |
| 128 | struct drm_display_mode *mode) |
| 129 | { |
| 130 | if (mode->clock > 165000) |
| 131 | return MODE_CLOCK_HIGH; |
| 132 | if (mode->clock < 20000) |
| 133 | return MODE_CLOCK_HIGH; |
| 134 | |
| 135 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) |
| 136 | return MODE_NO_DBLESCAN; |
| 137 | |
| 138 | return MODE_OK; |
| 139 | } |
| 140 | |
| 141 | static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder, |
| 142 | struct drm_display_mode *mode, |
| 143 | struct drm_display_mode *adjusted_mode) |
| 144 | { |
| 145 | return true; |
| 146 | } |
| 147 | |
Keith Packard | aa93d63 | 2009-05-05 09:52:46 -0700 | [diff] [blame] | 148 | static enum drm_connector_status |
ling.ma@intel.com | 2ded9e2 | 2009-07-16 17:23:09 +0800 | [diff] [blame] | 149 | intel_hdmi_detect(struct drm_connector *connector) |
Ma Ling | 9dff6af | 2009-04-02 13:13:26 +0800 | [diff] [blame] | 150 | { |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 151 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 152 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
| 153 | struct edid *edid; |
Keith Packard | aa93d63 | 2009-05-05 09:52:46 -0700 | [diff] [blame] | 154 | enum drm_connector_status status = connector_status_disconnected; |
Ma Ling | 9dff6af | 2009-04-02 13:13:26 +0800 | [diff] [blame] | 155 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 156 | intel_hdmi->has_hdmi_sink = false; |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 157 | edid = drm_get_edid(connector, |
| 158 | &dev_priv->gmbus[intel_hdmi->ddc_bus].adapter); |
ling.ma@intel.com | 2ded9e2 | 2009-07-16 17:23:09 +0800 | [diff] [blame] | 159 | |
Keith Packard | aa93d63 | 2009-05-05 09:52:46 -0700 | [diff] [blame] | 160 | if (edid) { |
Eric Anholt | be9f1c4 | 2009-06-21 22:14:55 -0700 | [diff] [blame] | 161 | if (edid->input & DRM_EDID_INPUT_DIGITAL) { |
Keith Packard | aa93d63 | 2009-05-05 09:52:46 -0700 | [diff] [blame] | 162 | status = connector_status_connected; |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 163 | intel_hdmi->has_hdmi_sink = drm_detect_hdmi_monitor(edid); |
Keith Packard | aa93d63 | 2009-05-05 09:52:46 -0700 | [diff] [blame] | 164 | } |
Zhenyu Wang | 674e2d0 | 2010-03-29 15:57:42 +0800 | [diff] [blame] | 165 | connector->display_info.raw_edid = NULL; |
Keith Packard | aa93d63 | 2009-05-05 09:52:46 -0700 | [diff] [blame] | 166 | kfree(edid); |
Ma Ling | 9dff6af | 2009-04-02 13:13:26 +0800 | [diff] [blame] | 167 | } |
ling.ma@intel.com | 2ded9e2 | 2009-07-16 17:23:09 +0800 | [diff] [blame] | 168 | |
Keith Packard | aa93d63 | 2009-05-05 09:52:46 -0700 | [diff] [blame] | 169 | return status; |
Ma Ling | 9dff6af | 2009-04-02 13:13:26 +0800 | [diff] [blame] | 170 | } |
| 171 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 172 | static int intel_hdmi_get_modes(struct drm_connector *connector) |
| 173 | { |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 174 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 175 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 176 | |
| 177 | /* We should parse the EDID data and find out if it's an HDMI sink so |
| 178 | * we can send audio to it. |
| 179 | */ |
| 180 | |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 181 | return intel_ddc_get_modes(connector, |
| 182 | &dev_priv->gmbus[intel_hdmi->ddc_bus].adapter); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | static void intel_hdmi_destroy(struct drm_connector *connector) |
| 186 | { |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 187 | drm_sysfs_connector_remove(connector); |
| 188 | drm_connector_cleanup(connector); |
Zhenyu Wang | 674e2d0 | 2010-03-29 15:57:42 +0800 | [diff] [blame] | 189 | kfree(connector); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = { |
| 193 | .dpms = intel_hdmi_dpms, |
| 194 | .mode_fixup = intel_hdmi_mode_fixup, |
| 195 | .prepare = intel_encoder_prepare, |
| 196 | .mode_set = intel_hdmi_mode_set, |
| 197 | .commit = intel_encoder_commit, |
| 198 | }; |
| 199 | |
| 200 | static const struct drm_connector_funcs intel_hdmi_connector_funcs = { |
Keith Packard | c9fb15f | 2009-05-30 20:42:28 -0700 | [diff] [blame] | 201 | .dpms = drm_helper_connector_dpms, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 202 | .detect = intel_hdmi_detect, |
| 203 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 204 | .destroy = intel_hdmi_destroy, |
| 205 | }; |
| 206 | |
| 207 | static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = { |
| 208 | .get_modes = intel_hdmi_get_modes, |
| 209 | .mode_valid = intel_hdmi_mode_valid, |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 210 | .best_encoder = intel_best_encoder, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 211 | }; |
| 212 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 213 | static const struct drm_encoder_funcs intel_hdmi_enc_funcs = { |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 214 | .destroy = intel_encoder_destroy, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 215 | }; |
| 216 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 217 | void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) |
| 218 | { |
| 219 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 220 | struct drm_connector *connector; |
Eric Anholt | 21d40d3 | 2010-03-25 11:11:14 -0700 | [diff] [blame] | 221 | struct intel_encoder *intel_encoder; |
Zhenyu Wang | 674e2d0 | 2010-03-29 15:57:42 +0800 | [diff] [blame] | 222 | struct intel_connector *intel_connector; |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 223 | struct intel_hdmi *intel_hdmi; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 224 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 225 | intel_hdmi = kzalloc(sizeof(struct intel_hdmi), GFP_KERNEL); |
| 226 | if (!intel_hdmi) |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 227 | return; |
Zhenyu Wang | 674e2d0 | 2010-03-29 15:57:42 +0800 | [diff] [blame] | 228 | |
| 229 | intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL); |
| 230 | if (!intel_connector) { |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 231 | kfree(intel_hdmi); |
Zhenyu Wang | 674e2d0 | 2010-03-29 15:57:42 +0800 | [diff] [blame] | 232 | return; |
| 233 | } |
| 234 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 235 | intel_encoder = &intel_hdmi->base; |
Chris Wilson | 373a3cf | 2010-09-15 12:03:59 +0100 | [diff] [blame] | 236 | drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs, |
| 237 | DRM_MODE_ENCODER_TMDS); |
| 238 | |
Zhenyu Wang | 674e2d0 | 2010-03-29 15:57:42 +0800 | [diff] [blame] | 239 | connector = &intel_connector->base; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 240 | drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, |
Adam Jackson | 8d91104 | 2009-09-23 15:08:29 -0400 | [diff] [blame] | 241 | DRM_MODE_CONNECTOR_HDMIA); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 242 | drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs); |
| 243 | |
Eric Anholt | 21d40d3 | 2010-03-25 11:11:14 -0700 | [diff] [blame] | 244 | intel_encoder->type = INTEL_OUTPUT_HDMI; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 245 | |
Dave Airlie | eb1f8e4 | 2010-05-07 06:42:51 +0000 | [diff] [blame] | 246 | connector->polled = DRM_CONNECTOR_POLL_HPD; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 247 | connector->interlace_allowed = 0; |
| 248 | connector->doublescan_allowed = 0; |
Eric Anholt | 21d40d3 | 2010-03-25 11:11:14 -0700 | [diff] [blame] | 249 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 250 | |
| 251 | /* Set up the DDC bus. */ |
Ma Ling | f8aed70 | 2009-08-24 13:50:24 +0800 | [diff] [blame] | 252 | if (sdvox_reg == SDVOB) { |
Eric Anholt | 21d40d3 | 2010-03-25 11:11:14 -0700 | [diff] [blame] | 253 | intel_encoder->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 254 | intel_hdmi->ddc_bus = GMBUS_PORT_DPB; |
Jesse Barnes | b01f2c3 | 2009-12-11 11:07:17 -0800 | [diff] [blame] | 255 | dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; |
Ma Ling | f8aed70 | 2009-08-24 13:50:24 +0800 | [diff] [blame] | 256 | } else if (sdvox_reg == SDVOC) { |
Eric Anholt | 21d40d3 | 2010-03-25 11:11:14 -0700 | [diff] [blame] | 257 | intel_encoder->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 258 | intel_hdmi->ddc_bus = GMBUS_PORT_DPC; |
Jesse Barnes | b01f2c3 | 2009-12-11 11:07:17 -0800 | [diff] [blame] | 259 | dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; |
Ma Ling | f8aed70 | 2009-08-24 13:50:24 +0800 | [diff] [blame] | 260 | } else if (sdvox_reg == HDMIB) { |
Eric Anholt | 21d40d3 | 2010-03-25 11:11:14 -0700 | [diff] [blame] | 261 | intel_encoder->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 262 | intel_hdmi->ddc_bus = GMBUS_PORT_DPB; |
Jesse Barnes | b01f2c3 | 2009-12-11 11:07:17 -0800 | [diff] [blame] | 263 | dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; |
Ma Ling | f8aed70 | 2009-08-24 13:50:24 +0800 | [diff] [blame] | 264 | } else if (sdvox_reg == HDMIC) { |
Eric Anholt | 21d40d3 | 2010-03-25 11:11:14 -0700 | [diff] [blame] | 265 | intel_encoder->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 266 | intel_hdmi->ddc_bus = GMBUS_PORT_DPC; |
Jesse Barnes | b01f2c3 | 2009-12-11 11:07:17 -0800 | [diff] [blame] | 267 | dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; |
Ma Ling | f8aed70 | 2009-08-24 13:50:24 +0800 | [diff] [blame] | 268 | } else if (sdvox_reg == HDMID) { |
Eric Anholt | 21d40d3 | 2010-03-25 11:11:14 -0700 | [diff] [blame] | 269 | intel_encoder->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); |
Chris Wilson | f899fc6 | 2010-07-20 15:44:45 -0700 | [diff] [blame^] | 270 | intel_hdmi->ddc_bus = GMBUS_PORT_DPD; |
Jesse Barnes | b01f2c3 | 2009-12-11 11:07:17 -0800 | [diff] [blame] | 271 | dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS; |
Ma Ling | f8aed70 | 2009-08-24 13:50:24 +0800 | [diff] [blame] | 272 | } |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 273 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 274 | intel_hdmi->sdvox_reg = sdvox_reg; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 275 | |
Chris Wilson | 4ef69c7 | 2010-09-09 15:14:28 +0100 | [diff] [blame] | 276 | drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 277 | |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 278 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 279 | drm_sysfs_connector_add(connector); |
| 280 | |
| 281 | /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written |
| 282 | * 0xd. Failure to do so will result in spurious interrupts being |
| 283 | * generated on the port when a cable is not attached. |
| 284 | */ |
| 285 | if (IS_G4X(dev) && !IS_GM45(dev)) { |
| 286 | u32 temp = I915_READ(PEG_BAND_GAP_DATA); |
| 287 | I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd); |
| 288 | } |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 289 | } |