blob: 84e57c74a8d5a53445eda932d126a079b3a0a734 [file] [log] [blame]
Eric Anholt7d573822009-01-02 13:33:00 -08001/*
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 Heo5a0e3ad2010-03-24 17:04:11 +090030#include <linux/slab.h>
Eric Anholt7d573822009-01-02 13:33:00 -080031#include <linux/delay.h>
Damien Lespiau178f7362013-08-06 20:32:18 +010032#include <linux/hdmi.h>
David Howells760285e2012-10-02 18:01:07 +010033#include <drm/drmP.h>
34#include <drm/drm_crtc.h>
35#include <drm/drm_edid.h>
Eric Anholt7d573822009-01-02 13:33:00 -080036#include "intel_drv.h"
David Howells760285e2012-10-02 18:01:07 +010037#include <drm/i915_drm.h>
Eric Anholt7d573822009-01-02 13:33:00 -080038#include "i915_drv.h"
39
Paulo Zanoni30add222012-10-26 19:05:45 -020040static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi)
41{
Paulo Zanonida63a9f2012-10-26 19:05:46 -020042 return hdmi_to_dig_port(intel_hdmi)->base.base.dev;
Paulo Zanoni30add222012-10-26 19:05:45 -020043}
44
Daniel Vetterafba0182012-06-12 16:36:45 +020045static void
46assert_hdmi_port_disabled(struct intel_hdmi *intel_hdmi)
47{
Paulo Zanoni30add222012-10-26 19:05:45 -020048 struct drm_device *dev = intel_hdmi_to_dev(intel_hdmi);
Daniel Vetterafba0182012-06-12 16:36:45 +020049 struct drm_i915_private *dev_priv = dev->dev_private;
50 uint32_t enabled_bits;
51
Paulo Zanoniaffa9352012-11-23 15:30:39 -020052 enabled_bits = HAS_DDI(dev) ? DDI_BUF_CTL_ENABLE : SDVO_ENABLE;
Daniel Vetterafba0182012-06-12 16:36:45 +020053
Paulo Zanonib242b7f2013-02-18 19:00:26 -030054 WARN(I915_READ(intel_hdmi->hdmi_reg) & enabled_bits,
Daniel Vetterafba0182012-06-12 16:36:45 +020055 "HDMI port enabled, expecting disabled\n");
56}
57
Eugeni Dodonovf5bbfca2012-05-09 15:37:30 -030058struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder)
Chris Wilsonea5b2132010-08-04 13:50:23 +010059{
Paulo Zanonida63a9f2012-10-26 19:05:46 -020060 struct intel_digital_port *intel_dig_port =
61 container_of(encoder, struct intel_digital_port, base.base);
62 return &intel_dig_port->hdmi;
Chris Wilsonea5b2132010-08-04 13:50:23 +010063}
64
Chris Wilsondf0e9242010-09-09 16:20:55 +010065static struct intel_hdmi *intel_attached_hdmi(struct drm_connector *connector)
66{
Paulo Zanonida63a9f2012-10-26 19:05:46 -020067 return enc_to_intel_hdmi(&intel_attached_encoder(connector)->base);
Chris Wilsondf0e9242010-09-09 16:20:55 +010068}
69
Jesse Barnes45187ac2011-08-03 09:22:55 -070070void intel_dip_infoframe_csum(struct dip_infoframe *frame)
David Härdeman3c17fe42010-09-24 21:44:32 +020071{
Jesse Barnes45187ac2011-08-03 09:22:55 -070072 uint8_t *data = (uint8_t *)frame;
David Härdeman3c17fe42010-09-24 21:44:32 +020073 uint8_t sum = 0;
74 unsigned i;
75
Jesse Barnes45187ac2011-08-03 09:22:55 -070076 frame->checksum = 0;
77 frame->ecc = 0;
David Härdeman3c17fe42010-09-24 21:44:32 +020078
Jesse Barnes64a8fc02011-09-22 11:16:00 +053079 for (i = 0; i < frame->len + DIP_HEADER_SIZE; i++)
David Härdeman3c17fe42010-09-24 21:44:32 +020080 sum += data[i];
81
Jesse Barnes45187ac2011-08-03 09:22:55 -070082 frame->checksum = 0x100 - sum;
David Härdeman3c17fe42010-09-24 21:44:32 +020083}
84
Damien Lespiau178f7362013-08-06 20:32:18 +010085static u32 g4x_infoframe_index(enum hdmi_infoframe_type type)
David Härdeman3c17fe42010-09-24 21:44:32 +020086{
Damien Lespiau178f7362013-08-06 20:32:18 +010087 switch (type) {
88 case HDMI_INFOFRAME_TYPE_AVI:
Paulo Zanonied517fb2012-05-14 17:12:50 -030089 return VIDEO_DIP_SELECT_AVI;
Damien Lespiau178f7362013-08-06 20:32:18 +010090 case HDMI_INFOFRAME_TYPE_SPD:
Paulo Zanonied517fb2012-05-14 17:12:50 -030091 return VIDEO_DIP_SELECT_SPD;
Jesse Barnes45187ac2011-08-03 09:22:55 -070092 default:
Damien Lespiau178f7362013-08-06 20:32:18 +010093 DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
Paulo Zanonied517fb2012-05-14 17:12:50 -030094 return 0;
Jesse Barnes45187ac2011-08-03 09:22:55 -070095 }
Jesse Barnes45187ac2011-08-03 09:22:55 -070096}
97
Damien Lespiau178f7362013-08-06 20:32:18 +010098static u32 g4x_infoframe_enable(enum hdmi_infoframe_type type)
Jesse Barnes45187ac2011-08-03 09:22:55 -070099{
Damien Lespiau178f7362013-08-06 20:32:18 +0100100 switch (type) {
101 case HDMI_INFOFRAME_TYPE_AVI:
Paulo Zanonied517fb2012-05-14 17:12:50 -0300102 return VIDEO_DIP_ENABLE_AVI;
Damien Lespiau178f7362013-08-06 20:32:18 +0100103 case HDMI_INFOFRAME_TYPE_SPD:
Paulo Zanonied517fb2012-05-14 17:12:50 -0300104 return VIDEO_DIP_ENABLE_SPD;
Paulo Zanonifa193ff2012-05-04 17:18:20 -0300105 default:
Damien Lespiau178f7362013-08-06 20:32:18 +0100106 DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
Paulo Zanonied517fb2012-05-14 17:12:50 -0300107 return 0;
Paulo Zanonifa193ff2012-05-04 17:18:20 -0300108 }
Paulo Zanonifa193ff2012-05-04 17:18:20 -0300109}
110
Damien Lespiau178f7362013-08-06 20:32:18 +0100111static u32 hsw_infoframe_enable(enum hdmi_infoframe_type type)
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300112{
Damien Lespiau178f7362013-08-06 20:32:18 +0100113 switch (type) {
114 case HDMI_INFOFRAME_TYPE_AVI:
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300115 return VIDEO_DIP_ENABLE_AVI_HSW;
Damien Lespiau178f7362013-08-06 20:32:18 +0100116 case HDMI_INFOFRAME_TYPE_SPD:
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300117 return VIDEO_DIP_ENABLE_SPD_HSW;
118 default:
Damien Lespiau178f7362013-08-06 20:32:18 +0100119 DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300120 return 0;
121 }
122}
123
Damien Lespiau178f7362013-08-06 20:32:18 +0100124static u32 hsw_infoframe_data_reg(enum hdmi_infoframe_type type,
Rodrigo Vivi7d9bceb2013-02-25 19:55:16 -0300125 enum transcoder cpu_transcoder)
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300126{
Damien Lespiau178f7362013-08-06 20:32:18 +0100127 switch (type) {
128 case HDMI_INFOFRAME_TYPE_AVI:
Rodrigo Vivi7d9bceb2013-02-25 19:55:16 -0300129 return HSW_TVIDEO_DIP_AVI_DATA(cpu_transcoder);
Damien Lespiau178f7362013-08-06 20:32:18 +0100130 case HDMI_INFOFRAME_TYPE_SPD:
Rodrigo Vivi7d9bceb2013-02-25 19:55:16 -0300131 return HSW_TVIDEO_DIP_SPD_DATA(cpu_transcoder);
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300132 default:
Damien Lespiau178f7362013-08-06 20:32:18 +0100133 DRM_DEBUG_DRIVER("unknown info frame type %d\n", type);
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300134 return 0;
135 }
136}
137
Daniel Vettera3da1df2012-05-08 15:19:06 +0200138static void g4x_write_infoframe(struct drm_encoder *encoder,
Damien Lespiau178f7362013-08-06 20:32:18 +0100139 enum hdmi_infoframe_type type,
140 const uint8_t *frame, ssize_t len)
Jesse Barnes45187ac2011-08-03 09:22:55 -0700141{
142 uint32_t *data = (uint32_t *)frame;
David Härdeman3c17fe42010-09-24 21:44:32 +0200143 struct drm_device *dev = encoder->dev;
144 struct drm_i915_private *dev_priv = dev->dev_private;
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300145 u32 val = I915_READ(VIDEO_DIP_CTL);
Damien Lespiau178f7362013-08-06 20:32:18 +0100146 int i;
David Härdeman3c17fe42010-09-24 21:44:32 +0200147
Paulo Zanoni822974a2012-05-28 16:42:51 -0300148 WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
149
Paulo Zanoni1d4f85a2012-05-04 17:18:18 -0300150 val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
Damien Lespiau178f7362013-08-06 20:32:18 +0100151 val |= g4x_infoframe_index(type);
Jesse Barnes45187ac2011-08-03 09:22:55 -0700152
Damien Lespiau178f7362013-08-06 20:32:18 +0100153 val &= ~g4x_infoframe_enable(type);
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300154
155 I915_WRITE(VIDEO_DIP_CTL, val);
Jesse Barnes45187ac2011-08-03 09:22:55 -0700156
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300157 mmiowb();
Jesse Barnes45187ac2011-08-03 09:22:55 -0700158 for (i = 0; i < len; i += 4) {
David Härdeman3c17fe42010-09-24 21:44:32 +0200159 I915_WRITE(VIDEO_DIP_DATA, *data);
160 data++;
161 }
Paulo Zanoniadf00b22012-09-25 13:23:34 -0300162 /* Write every possible data byte to force correct ECC calculation. */
163 for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
164 I915_WRITE(VIDEO_DIP_DATA, 0);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300165 mmiowb();
David Härdeman3c17fe42010-09-24 21:44:32 +0200166
Damien Lespiau178f7362013-08-06 20:32:18 +0100167 val |= g4x_infoframe_enable(type);
Paulo Zanoni60c5ea22012-05-04 17:18:22 -0300168 val &= ~VIDEO_DIP_FREQ_MASK;
Daniel Vetter4b24c932012-05-08 14:41:00 +0200169 val |= VIDEO_DIP_FREQ_VSYNC;
Jesse Barnes45187ac2011-08-03 09:22:55 -0700170
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300171 I915_WRITE(VIDEO_DIP_CTL, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300172 POSTING_READ(VIDEO_DIP_CTL);
David Härdeman3c17fe42010-09-24 21:44:32 +0200173}
174
Paulo Zanonifdf12502012-05-04 17:18:24 -0300175static void ibx_write_infoframe(struct drm_encoder *encoder,
Damien Lespiau178f7362013-08-06 20:32:18 +0100176 enum hdmi_infoframe_type type,
177 const uint8_t *frame, ssize_t len)
Paulo Zanonifdf12502012-05-04 17:18:24 -0300178{
179 uint32_t *data = (uint32_t *)frame;
180 struct drm_device *dev = encoder->dev;
181 struct drm_i915_private *dev_priv = dev->dev_private;
Paulo Zanonied517fb2012-05-14 17:12:50 -0300182 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
Damien Lespiau178f7362013-08-06 20:32:18 +0100183 int i, reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
Paulo Zanonifdf12502012-05-04 17:18:24 -0300184 u32 val = I915_READ(reg);
185
Paulo Zanoni822974a2012-05-28 16:42:51 -0300186 WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
187
Paulo Zanonifdf12502012-05-04 17:18:24 -0300188 val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
Damien Lespiau178f7362013-08-06 20:32:18 +0100189 val |= g4x_infoframe_index(type);
Paulo Zanonifdf12502012-05-04 17:18:24 -0300190
Damien Lespiau178f7362013-08-06 20:32:18 +0100191 val &= ~g4x_infoframe_enable(type);
Paulo Zanonifdf12502012-05-04 17:18:24 -0300192
193 I915_WRITE(reg, val);
194
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300195 mmiowb();
Paulo Zanonifdf12502012-05-04 17:18:24 -0300196 for (i = 0; i < len; i += 4) {
197 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
198 data++;
199 }
Paulo Zanoniadf00b22012-09-25 13:23:34 -0300200 /* Write every possible data byte to force correct ECC calculation. */
201 for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
202 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300203 mmiowb();
Paulo Zanonifdf12502012-05-04 17:18:24 -0300204
Damien Lespiau178f7362013-08-06 20:32:18 +0100205 val |= g4x_infoframe_enable(type);
Paulo Zanonifdf12502012-05-04 17:18:24 -0300206 val &= ~VIDEO_DIP_FREQ_MASK;
Daniel Vetter4b24c932012-05-08 14:41:00 +0200207 val |= VIDEO_DIP_FREQ_VSYNC;
Paulo Zanonifdf12502012-05-04 17:18:24 -0300208
209 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300210 POSTING_READ(reg);
Paulo Zanonifdf12502012-05-04 17:18:24 -0300211}
212
213static void cpt_write_infoframe(struct drm_encoder *encoder,
Damien Lespiau178f7362013-08-06 20:32:18 +0100214 enum hdmi_infoframe_type type,
215 const uint8_t *frame, ssize_t len)
Jesse Barnes45187ac2011-08-03 09:22:55 -0700216{
217 uint32_t *data = (uint32_t *)frame;
218 struct drm_device *dev = encoder->dev;
219 struct drm_i915_private *dev_priv = dev->dev_private;
Paulo Zanonied517fb2012-05-14 17:12:50 -0300220 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
Damien Lespiau178f7362013-08-06 20:32:18 +0100221 int i, reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300222 u32 val = I915_READ(reg);
Jesse Barnes45187ac2011-08-03 09:22:55 -0700223
Paulo Zanoni822974a2012-05-28 16:42:51 -0300224 WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
225
Jesse Barnes64a8fc02011-09-22 11:16:00 +0530226 val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
Damien Lespiau178f7362013-08-06 20:32:18 +0100227 val |= g4x_infoframe_index(type);
Jesse Barnes45187ac2011-08-03 09:22:55 -0700228
Paulo Zanoniecb97852012-05-04 17:18:21 -0300229 /* The DIP control register spec says that we need to update the AVI
230 * infoframe without clearing its enable bit */
Damien Lespiau178f7362013-08-06 20:32:18 +0100231 if (type != HDMI_INFOFRAME_TYPE_AVI)
232 val &= ~g4x_infoframe_enable(type);
Paulo Zanoniecb97852012-05-04 17:18:21 -0300233
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300234 I915_WRITE(reg, val);
Jesse Barnes45187ac2011-08-03 09:22:55 -0700235
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300236 mmiowb();
Jesse Barnes45187ac2011-08-03 09:22:55 -0700237 for (i = 0; i < len; i += 4) {
238 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
239 data++;
240 }
Paulo Zanoniadf00b22012-09-25 13:23:34 -0300241 /* Write every possible data byte to force correct ECC calculation. */
242 for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
243 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300244 mmiowb();
Jesse Barnes45187ac2011-08-03 09:22:55 -0700245
Damien Lespiau178f7362013-08-06 20:32:18 +0100246 val |= g4x_infoframe_enable(type);
Paulo Zanoni60c5ea22012-05-04 17:18:22 -0300247 val &= ~VIDEO_DIP_FREQ_MASK;
Daniel Vetter4b24c932012-05-08 14:41:00 +0200248 val |= VIDEO_DIP_FREQ_VSYNC;
Jesse Barnes45187ac2011-08-03 09:22:55 -0700249
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300250 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300251 POSTING_READ(reg);
Jesse Barnes45187ac2011-08-03 09:22:55 -0700252}
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700253
254static void vlv_write_infoframe(struct drm_encoder *encoder,
Damien Lespiau178f7362013-08-06 20:32:18 +0100255 enum hdmi_infoframe_type type,
256 const uint8_t *frame, ssize_t len)
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700257{
258 uint32_t *data = (uint32_t *)frame;
259 struct drm_device *dev = encoder->dev;
260 struct drm_i915_private *dev_priv = dev->dev_private;
Paulo Zanonied517fb2012-05-14 17:12:50 -0300261 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
Damien Lespiau178f7362013-08-06 20:32:18 +0100262 int i, reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300263 u32 val = I915_READ(reg);
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700264
Paulo Zanoni822974a2012-05-28 16:42:51 -0300265 WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
266
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700267 val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
Damien Lespiau178f7362013-08-06 20:32:18 +0100268 val |= g4x_infoframe_index(type);
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700269
Damien Lespiau178f7362013-08-06 20:32:18 +0100270 val &= ~g4x_infoframe_enable(type);
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300271
272 I915_WRITE(reg, val);
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700273
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300274 mmiowb();
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700275 for (i = 0; i < len; i += 4) {
276 I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
277 data++;
278 }
Paulo Zanoniadf00b22012-09-25 13:23:34 -0300279 /* Write every possible data byte to force correct ECC calculation. */
280 for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
281 I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300282 mmiowb();
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700283
Damien Lespiau178f7362013-08-06 20:32:18 +0100284 val |= g4x_infoframe_enable(type);
Paulo Zanoni60c5ea22012-05-04 17:18:22 -0300285 val &= ~VIDEO_DIP_FREQ_MASK;
Daniel Vetter4b24c932012-05-08 14:41:00 +0200286 val |= VIDEO_DIP_FREQ_VSYNC;
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700287
Paulo Zanoni22509ec2012-05-04 17:18:17 -0300288 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300289 POSTING_READ(reg);
Shobhit Kumar90b107c2012-03-28 13:39:32 -0700290}
291
Eugeni Dodonov8c5f5f72012-05-10 10:18:02 -0300292static void hsw_write_infoframe(struct drm_encoder *encoder,
Damien Lespiau178f7362013-08-06 20:32:18 +0100293 enum hdmi_infoframe_type type,
294 const uint8_t *frame, ssize_t len)
Eugeni Dodonov8c5f5f72012-05-10 10:18:02 -0300295{
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300296 uint32_t *data = (uint32_t *)frame;
297 struct drm_device *dev = encoder->dev;
298 struct drm_i915_private *dev_priv = dev->dev_private;
299 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
Daniel Vetter3b117c82013-04-17 20:15:07 +0200300 u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config.cpu_transcoder);
Damien Lespiau178f7362013-08-06 20:32:18 +0100301 u32 data_reg;
302 int i;
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300303 u32 val = I915_READ(ctl_reg);
Eugeni Dodonov8c5f5f72012-05-10 10:18:02 -0300304
Damien Lespiau178f7362013-08-06 20:32:18 +0100305 data_reg = hsw_infoframe_data_reg(type,
306 intel_crtc->config.cpu_transcoder);
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300307 if (data_reg == 0)
308 return;
Eugeni Dodonov8c5f5f72012-05-10 10:18:02 -0300309
Damien Lespiau178f7362013-08-06 20:32:18 +0100310 val &= ~hsw_infoframe_enable(type);
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300311 I915_WRITE(ctl_reg, val);
312
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300313 mmiowb();
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300314 for (i = 0; i < len; i += 4) {
315 I915_WRITE(data_reg + i, *data);
316 data++;
317 }
Paulo Zanoniadf00b22012-09-25 13:23:34 -0300318 /* Write every possible data byte to force correct ECC calculation. */
319 for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
320 I915_WRITE(data_reg + i, 0);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300321 mmiowb();
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300322
Damien Lespiau178f7362013-08-06 20:32:18 +0100323 val |= hsw_infoframe_enable(type);
Paulo Zanoni2da8af52012-05-14 17:12:51 -0300324 I915_WRITE(ctl_reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300325 POSTING_READ(ctl_reg);
Eugeni Dodonov8c5f5f72012-05-10 10:18:02 -0300326}
327
Damien Lespiau5adaea72013-08-06 20:32:19 +0100328/*
329 * The data we write to the DIP data buffer registers is 1 byte bigger than the
330 * HDMI infoframe size because of an ECC/reserved byte at position 3 (starting
331 * at 0). It's also a byte used by DisplayPort so the same DIP registers can be
332 * used for both technologies.
333 *
334 * DW0: Reserved/ECC/DP | HB2 | HB1 | HB0
335 * DW1: DB3 | DB2 | DB1 | DB0
336 * DW2: DB7 | DB6 | DB5 | DB4
337 * DW3: ...
338 *
339 * (HB is Header Byte, DB is Data Byte)
340 *
341 * The hdmi pack() functions don't know about that hardware specific hole so we
342 * trick them by giving an offset into the buffer and moving back the header
343 * bytes by one.
344 */
Jesse Barnes45187ac2011-08-03 09:22:55 -0700345static void intel_set_infoframe(struct drm_encoder *encoder,
Damien Lespiau5adaea72013-08-06 20:32:19 +0100346 union hdmi_infoframe *frame)
Jesse Barnes45187ac2011-08-03 09:22:55 -0700347{
348 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
Damien Lespiau5adaea72013-08-06 20:32:19 +0100349 uint8_t buffer[VIDEO_DIP_DATA_SIZE];
350 ssize_t len;
Jesse Barnes45187ac2011-08-03 09:22:55 -0700351
Damien Lespiau5adaea72013-08-06 20:32:19 +0100352 /* see comment above for the reason for this offset */
353 len = hdmi_infoframe_pack(frame, buffer + 1, sizeof(buffer) - 1);
354 if (len < 0)
355 return;
356
357 /* Insert the 'hole' (see big comment above) at position 3 */
358 buffer[0] = buffer[1];
359 buffer[1] = buffer[2];
360 buffer[2] = buffer[3];
361 buffer[3] = 0;
362 len++;
363
364 intel_hdmi->write_infoframe(encoder, frame->any.type, buffer, len);
Jesse Barnes45187ac2011-08-03 09:22:55 -0700365}
366
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300367static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
Paulo Zanonic846b612012-04-13 16:31:41 -0300368 struct drm_display_mode *adjusted_mode)
Jesse Barnesb055c8f2011-07-08 11:31:57 -0700369{
Ville Syrjäläabedc072013-01-17 16:31:31 +0200370 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
Daniel Vetter50f3b012013-03-27 00:44:56 +0100371 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
Damien Lespiau5adaea72013-08-06 20:32:19 +0100372 union hdmi_infoframe frame;
373 int ret;
374
375 ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
376 adjusted_mode);
377 if (ret < 0) {
378 DRM_ERROR("couldn't fill AVI infoframe\n");
379 return;
380 }
Jesse Barnesb055c8f2011-07-08 11:31:57 -0700381
Paulo Zanonic846b612012-04-13 16:31:41 -0300382 if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
Damien Lespiau5adaea72013-08-06 20:32:19 +0100383 frame.avi.pixel_repeat = 1;
Paulo Zanonic846b612012-04-13 16:31:41 -0300384
Ville Syrjäläabedc072013-01-17 16:31:31 +0200385 if (intel_hdmi->rgb_quant_range_selectable) {
Daniel Vetter50f3b012013-03-27 00:44:56 +0100386 if (intel_crtc->config.limited_color_range)
Damien Lespiau5adaea72013-08-06 20:32:19 +0100387 frame.avi.quantization_range =
388 HDMI_QUANTIZATION_RANGE_LIMITED;
Ville Syrjäläabedc072013-01-17 16:31:31 +0200389 else
Damien Lespiau5adaea72013-08-06 20:32:19 +0100390 frame.avi.quantization_range =
391 HDMI_QUANTIZATION_RANGE_FULL;
Ville Syrjäläabedc072013-01-17 16:31:31 +0200392 }
393
Damien Lespiau5adaea72013-08-06 20:32:19 +0100394 intel_set_infoframe(encoder, &frame);
Jesse Barnesb055c8f2011-07-08 11:31:57 -0700395}
396
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300397static void intel_hdmi_set_spd_infoframe(struct drm_encoder *encoder)
Jesse Barnesc0864cb2011-08-03 09:22:56 -0700398{
Damien Lespiau5adaea72013-08-06 20:32:19 +0100399 union hdmi_infoframe frame;
400 int ret;
Jesse Barnesc0864cb2011-08-03 09:22:56 -0700401
Damien Lespiau5adaea72013-08-06 20:32:19 +0100402 ret = hdmi_spd_infoframe_init(&frame.spd, "Intel", "Integrated gfx");
403 if (ret < 0) {
404 DRM_ERROR("couldn't fill SPD infoframe\n");
405 return;
406 }
Jesse Barnesc0864cb2011-08-03 09:22:56 -0700407
Damien Lespiau5adaea72013-08-06 20:32:19 +0100408 frame.spd.sdi = HDMI_SPD_SDI_PC;
409
410 intel_set_infoframe(encoder, &frame);
Jesse Barnesc0864cb2011-08-03 09:22:56 -0700411}
412
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300413static void g4x_set_infoframes(struct drm_encoder *encoder,
414 struct drm_display_mode *adjusted_mode)
415{
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300416 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
Ville Syrjälä69fde0a2013-01-24 15:29:26 +0200417 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
418 struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300419 u32 reg = VIDEO_DIP_CTL;
420 u32 val = I915_READ(reg);
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300421 u32 port;
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300422
Daniel Vetterafba0182012-06-12 16:36:45 +0200423 assert_hdmi_port_disabled(intel_hdmi);
424
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300425 /* If the registers were not initialized yet, they might be zeroes,
426 * which means we're selecting the AVI DIP and we're setting its
427 * frequency to once. This seems to really confuse the HW and make
428 * things stop working (the register spec says the AVI always needs to
429 * be sent every VSync). So here we avoid writing to the register more
430 * than we need and also explicitly select the AVI DIP and explicitly
431 * set its frequency to every VSync. Avoiding to write it twice seems to
432 * be enough to solve the problem, but being defensive shouldn't hurt us
433 * either. */
434 val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
435
436 if (!intel_hdmi->has_hdmi_sink) {
437 if (!(val & VIDEO_DIP_ENABLE))
438 return;
439 val &= ~VIDEO_DIP_ENABLE;
440 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300441 POSTING_READ(reg);
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300442 return;
443 }
444
Ville Syrjälä69fde0a2013-01-24 15:29:26 +0200445 switch (intel_dig_port->port) {
446 case PORT_B:
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300447 port = VIDEO_DIP_PORT_B;
Paulo Zanonif278d972012-05-28 16:42:50 -0300448 break;
Ville Syrjälä69fde0a2013-01-24 15:29:26 +0200449 case PORT_C:
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300450 port = VIDEO_DIP_PORT_C;
Paulo Zanonif278d972012-05-28 16:42:50 -0300451 break;
452 default:
Paulo Zanoni57df2ae2012-09-24 10:32:54 -0300453 BUG();
Paulo Zanonif278d972012-05-28 16:42:50 -0300454 return;
455 }
456
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300457 if (port != (val & VIDEO_DIP_PORT_MASK)) {
458 if (val & VIDEO_DIP_ENABLE) {
459 val &= ~VIDEO_DIP_ENABLE;
460 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300461 POSTING_READ(reg);
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300462 }
463 val &= ~VIDEO_DIP_PORT_MASK;
464 val |= port;
465 }
466
Paulo Zanoni822974a2012-05-28 16:42:51 -0300467 val |= VIDEO_DIP_ENABLE;
Paulo Zanoni0dd87d22012-05-28 16:42:53 -0300468 val &= ~VIDEO_DIP_ENABLE_VENDOR;
Paulo Zanoni822974a2012-05-28 16:42:51 -0300469
Paulo Zanonif278d972012-05-28 16:42:50 -0300470 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300471 POSTING_READ(reg);
Paulo Zanonif278d972012-05-28 16:42:50 -0300472
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300473 intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
474 intel_hdmi_set_spd_infoframe(encoder);
475}
476
477static void ibx_set_infoframes(struct drm_encoder *encoder,
478 struct drm_display_mode *adjusted_mode)
479{
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300480 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
481 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
Ville Syrjälä69fde0a2013-01-24 15:29:26 +0200482 struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder);
483 struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300484 u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
485 u32 val = I915_READ(reg);
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300486 u32 port;
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300487
Daniel Vetterafba0182012-06-12 16:36:45 +0200488 assert_hdmi_port_disabled(intel_hdmi);
489
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300490 /* See the big comment in g4x_set_infoframes() */
491 val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
492
493 if (!intel_hdmi->has_hdmi_sink) {
494 if (!(val & VIDEO_DIP_ENABLE))
495 return;
496 val &= ~VIDEO_DIP_ENABLE;
497 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300498 POSTING_READ(reg);
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300499 return;
500 }
501
Ville Syrjälä69fde0a2013-01-24 15:29:26 +0200502 switch (intel_dig_port->port) {
503 case PORT_B:
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300504 port = VIDEO_DIP_PORT_B;
Paulo Zanonif278d972012-05-28 16:42:50 -0300505 break;
Ville Syrjälä69fde0a2013-01-24 15:29:26 +0200506 case PORT_C:
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300507 port = VIDEO_DIP_PORT_C;
Paulo Zanonif278d972012-05-28 16:42:50 -0300508 break;
Ville Syrjälä69fde0a2013-01-24 15:29:26 +0200509 case PORT_D:
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300510 port = VIDEO_DIP_PORT_D;
Paulo Zanonif278d972012-05-28 16:42:50 -0300511 break;
512 default:
Paulo Zanoni57df2ae2012-09-24 10:32:54 -0300513 BUG();
Paulo Zanonif278d972012-05-28 16:42:50 -0300514 return;
515 }
516
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300517 if (port != (val & VIDEO_DIP_PORT_MASK)) {
518 if (val & VIDEO_DIP_ENABLE) {
519 val &= ~VIDEO_DIP_ENABLE;
520 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300521 POSTING_READ(reg);
Paulo Zanoni72b78c92012-05-28 16:42:54 -0300522 }
523 val &= ~VIDEO_DIP_PORT_MASK;
524 val |= port;
525 }
526
Paulo Zanoni822974a2012-05-28 16:42:51 -0300527 val |= VIDEO_DIP_ENABLE;
Paulo Zanoni0dd87d22012-05-28 16:42:53 -0300528 val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
529 VIDEO_DIP_ENABLE_GCP);
Paulo Zanoni822974a2012-05-28 16:42:51 -0300530
Paulo Zanonif278d972012-05-28 16:42:50 -0300531 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300532 POSTING_READ(reg);
Paulo Zanonif278d972012-05-28 16:42:50 -0300533
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300534 intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
535 intel_hdmi_set_spd_infoframe(encoder);
536}
537
538static void cpt_set_infoframes(struct drm_encoder *encoder,
539 struct drm_display_mode *adjusted_mode)
540{
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300541 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
542 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
543 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
544 u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
545 u32 val = I915_READ(reg);
546
Daniel Vetterafba0182012-06-12 16:36:45 +0200547 assert_hdmi_port_disabled(intel_hdmi);
548
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300549 /* See the big comment in g4x_set_infoframes() */
550 val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
551
552 if (!intel_hdmi->has_hdmi_sink) {
553 if (!(val & VIDEO_DIP_ENABLE))
554 return;
555 val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI);
556 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300557 POSTING_READ(reg);
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300558 return;
559 }
560
Paulo Zanoni822974a2012-05-28 16:42:51 -0300561 /* Set both together, unset both together: see the spec. */
562 val |= VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI;
Paulo Zanoni0dd87d22012-05-28 16:42:53 -0300563 val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
564 VIDEO_DIP_ENABLE_GCP);
Paulo Zanoni822974a2012-05-28 16:42:51 -0300565
566 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300567 POSTING_READ(reg);
Paulo Zanoni822974a2012-05-28 16:42:51 -0300568
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300569 intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
570 intel_hdmi_set_spd_infoframe(encoder);
571}
572
573static void vlv_set_infoframes(struct drm_encoder *encoder,
574 struct drm_display_mode *adjusted_mode)
575{
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300576 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
577 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
578 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
579 u32 reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
580 u32 val = I915_READ(reg);
581
Daniel Vetterafba0182012-06-12 16:36:45 +0200582 assert_hdmi_port_disabled(intel_hdmi);
583
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300584 /* See the big comment in g4x_set_infoframes() */
585 val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC;
586
587 if (!intel_hdmi->has_hdmi_sink) {
588 if (!(val & VIDEO_DIP_ENABLE))
589 return;
590 val &= ~VIDEO_DIP_ENABLE;
591 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300592 POSTING_READ(reg);
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300593 return;
594 }
595
Paulo Zanoni822974a2012-05-28 16:42:51 -0300596 val |= VIDEO_DIP_ENABLE;
Paulo Zanoni0dd87d22012-05-28 16:42:53 -0300597 val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT |
598 VIDEO_DIP_ENABLE_GCP);
Paulo Zanoni822974a2012-05-28 16:42:51 -0300599
600 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300601 POSTING_READ(reg);
Paulo Zanoni822974a2012-05-28 16:42:51 -0300602
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300603 intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
604 intel_hdmi_set_spd_infoframe(encoder);
605}
606
607static void hsw_set_infoframes(struct drm_encoder *encoder,
608 struct drm_display_mode *adjusted_mode)
609{
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300610 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
611 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
612 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
Daniel Vetter3b117c82013-04-17 20:15:07 +0200613 u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config.cpu_transcoder);
Paulo Zanoni0dd87d22012-05-28 16:42:53 -0300614 u32 val = I915_READ(reg);
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300615
Daniel Vetterafba0182012-06-12 16:36:45 +0200616 assert_hdmi_port_disabled(intel_hdmi);
617
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300618 if (!intel_hdmi->has_hdmi_sink) {
619 I915_WRITE(reg, 0);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300620 POSTING_READ(reg);
Paulo Zanoni0c14c7f2012-05-28 16:42:49 -0300621 return;
622 }
623
Paulo Zanoni0dd87d22012-05-28 16:42:53 -0300624 val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_GCP_HSW |
625 VIDEO_DIP_ENABLE_VS_HSW | VIDEO_DIP_ENABLE_GMP_HSW);
626
627 I915_WRITE(reg, val);
Paulo Zanoni9d9740f2012-05-28 16:43:00 -0300628 POSTING_READ(reg);
Paulo Zanoni0dd87d22012-05-28 16:42:53 -0300629
Paulo Zanoni687f4d02012-05-28 16:42:48 -0300630 intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
631 intel_hdmi_set_spd_infoframe(encoder);
632}
633
Daniel Vetterc59423a2013-07-21 21:37:04 +0200634static void intel_hdmi_mode_set(struct intel_encoder *encoder)
Eric Anholt7d573822009-01-02 13:33:00 -0800635{
Daniel Vetterc59423a2013-07-21 21:37:04 +0200636 struct drm_device *dev = encoder->base.dev;
Eric Anholt7d573822009-01-02 13:33:00 -0800637 struct drm_i915_private *dev_priv = dev->dev_private;
Daniel Vetterc59423a2013-07-21 21:37:04 +0200638 struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
639 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
640 struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300641 u32 hdmi_val;
Eric Anholt7d573822009-01-02 13:33:00 -0800642
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300643 hdmi_val = SDVO_ENCODING_HDMI;
Ville Syrjälä2af2c492013-06-25 14:16:34 +0300644 if (!HAS_PCH_SPLIT(dev))
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300645 hdmi_val |= intel_hdmi->color_range;
Adam Jacksonb599c0b2010-07-16 14:46:31 -0400646 if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300647 hdmi_val |= SDVO_VSYNC_ACTIVE_HIGH;
Adam Jacksonb599c0b2010-07-16 14:46:31 -0400648 if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300649 hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH;
Eric Anholt7d573822009-01-02 13:33:00 -0800650
Daniel Vetterc59423a2013-07-21 21:37:04 +0200651 if (crtc->config.pipe_bpp > 24)
Paulo Zanoni4f3a8bc2013-02-19 16:21:47 -0300652 hdmi_val |= HDMI_COLOR_FORMAT_12bpc;
Jesse Barnes020f6702011-06-24 12:19:25 -0700653 else
Paulo Zanoni4f3a8bc2013-02-19 16:21:47 -0300654 hdmi_val |= SDVO_COLOR_FORMAT_8bpc;
Jesse Barnes020f6702011-06-24 12:19:25 -0700655
Zhenyu Wang2e3d6002010-09-10 10:39:40 +0800656 /* Required on CPT */
657 if (intel_hdmi->has_hdmi_sink && HAS_PCH_CPT(dev))
Paulo Zanonidc0fa712013-02-19 16:21:46 -0300658 hdmi_val |= HDMI_MODE_SELECT_HDMI;
Zhenyu Wang2e3d6002010-09-10 10:39:40 +0800659
David Härdeman3c17fe42010-09-24 21:44:32 +0200660 if (intel_hdmi->has_audio) {
Wu Fengguange0dac652011-09-05 14:25:34 +0800661 DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
Daniel Vetterc59423a2013-07-21 21:37:04 +0200662 pipe_name(crtc->pipe));
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300663 hdmi_val |= SDVO_AUDIO_ENABLE;
Paulo Zanonidc0fa712013-02-19 16:21:46 -0300664 hdmi_val |= HDMI_MODE_SELECT_HDMI;
Daniel Vetterc59423a2013-07-21 21:37:04 +0200665 intel_write_eld(&encoder->base, adjusted_mode);
David Härdeman3c17fe42010-09-24 21:44:32 +0200666 }
Eric Anholt7d573822009-01-02 13:33:00 -0800667
Jesse Barnes75770562011-10-12 09:01:58 -0700668 if (HAS_PCH_CPT(dev))
Daniel Vetterc59423a2013-07-21 21:37:04 +0200669 hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe);
Paulo Zanonidc0fa712013-02-19 16:21:46 -0300670 else
Daniel Vetterc59423a2013-07-21 21:37:04 +0200671 hdmi_val |= SDVO_PIPE_SEL(crtc->pipe);
Eric Anholt7d573822009-01-02 13:33:00 -0800672
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300673 I915_WRITE(intel_hdmi->hdmi_reg, hdmi_val);
674 POSTING_READ(intel_hdmi->hdmi_reg);
David Härdeman3c17fe42010-09-24 21:44:32 +0200675
Daniel Vetterc59423a2013-07-21 21:37:04 +0200676 intel_hdmi->set_infoframes(&encoder->base, adjusted_mode);
Eric Anholt7d573822009-01-02 13:33:00 -0800677}
678
Daniel Vetter85234cd2012-07-02 13:27:29 +0200679static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder,
680 enum pipe *pipe)
Eric Anholt7d573822009-01-02 13:33:00 -0800681{
Daniel Vetter85234cd2012-07-02 13:27:29 +0200682 struct drm_device *dev = encoder->base.dev;
Eric Anholt7d573822009-01-02 13:33:00 -0800683 struct drm_i915_private *dev_priv = dev->dev_private;
Daniel Vetter85234cd2012-07-02 13:27:29 +0200684 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
685 u32 tmp;
686
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300687 tmp = I915_READ(intel_hdmi->hdmi_reg);
Daniel Vetter85234cd2012-07-02 13:27:29 +0200688
689 if (!(tmp & SDVO_ENABLE))
690 return false;
691
692 if (HAS_PCH_CPT(dev))
693 *pipe = PORT_TO_PIPE_CPT(tmp);
694 else
695 *pipe = PORT_TO_PIPE(tmp);
696
697 return true;
698}
699
Jesse Barnes045ac3b2013-05-14 17:08:26 -0700700static void intel_hdmi_get_config(struct intel_encoder *encoder,
701 struct intel_crtc_config *pipe_config)
702{
703 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
704 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
705 u32 tmp, flags = 0;
706
707 tmp = I915_READ(intel_hdmi->hdmi_reg);
708
709 if (tmp & SDVO_HSYNC_ACTIVE_HIGH)
710 flags |= DRM_MODE_FLAG_PHSYNC;
711 else
712 flags |= DRM_MODE_FLAG_NHSYNC;
713
714 if (tmp & SDVO_VSYNC_ACTIVE_HIGH)
715 flags |= DRM_MODE_FLAG_PVSYNC;
716 else
717 flags |= DRM_MODE_FLAG_NVSYNC;
718
719 pipe_config->adjusted_mode.flags |= flags;
720}
721
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200722static void intel_enable_hdmi(struct intel_encoder *encoder)
Eric Anholt7d573822009-01-02 13:33:00 -0800723{
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200724 struct drm_device *dev = encoder->base.dev;
Eric Anholt7d573822009-01-02 13:33:00 -0800725 struct drm_i915_private *dev_priv = dev->dev_private;
Paulo Zanonidc0fa712013-02-19 16:21:46 -0300726 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200727 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
Eric Anholt7d573822009-01-02 13:33:00 -0800728 u32 temp;
Wu Fengguang2deed762011-12-09 20:42:20 +0800729 u32 enable_bits = SDVO_ENABLE;
730
731 if (intel_hdmi->has_audio)
732 enable_bits |= SDVO_AUDIO_ENABLE;
Eric Anholt7d573822009-01-02 13:33:00 -0800733
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300734 temp = I915_READ(intel_hdmi->hdmi_reg);
Zhenyu Wangd8a2d0e2009-11-02 07:52:30 +0000735
Daniel Vetter7a87c282012-06-05 11:03:39 +0200736 /* HW workaround for IBX, we need to move the port to transcoder A
Paulo Zanonidc0fa712013-02-19 16:21:46 -0300737 * before disabling it, so restore the transcoder select bit here. */
738 if (HAS_PCH_IBX(dev))
739 enable_bits |= SDVO_PIPE_SEL(intel_crtc->pipe);
Daniel Vetter7a87c282012-06-05 11:03:39 +0200740
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200741 /* HW workaround, need to toggle enable bit off and on for 12bpc, but
742 * we do this anyway which shows more stable in testing.
743 */
744 if (HAS_PCH_SPLIT(dev)) {
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300745 I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE);
746 POSTING_READ(intel_hdmi->hdmi_reg);
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200747 }
Daniel Vetter7a87c282012-06-05 11:03:39 +0200748
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200749 temp |= enable_bits;
750
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300751 I915_WRITE(intel_hdmi->hdmi_reg, temp);
752 POSTING_READ(intel_hdmi->hdmi_reg);
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200753
754 /* HW workaround, need to write this twice for issue that may result
755 * in first write getting masked.
756 */
757 if (HAS_PCH_SPLIT(dev)) {
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300758 I915_WRITE(intel_hdmi->hdmi_reg, temp);
759 POSTING_READ(intel_hdmi->hdmi_reg);
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200760 }
Jani Nikulab76cf762013-07-30 12:20:31 +0300761}
Jesse Barnes89b667f2013-04-18 14:51:36 -0700762
Jani Nikulab76cf762013-07-30 12:20:31 +0300763static void vlv_enable_hdmi(struct intel_encoder *encoder)
764{
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200765}
766
767static void intel_disable_hdmi(struct intel_encoder *encoder)
768{
769 struct drm_device *dev = encoder->base.dev;
770 struct drm_i915_private *dev_priv = dev->dev_private;
771 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
772 u32 temp;
Wang Xingchao3cce5742012-09-13 11:19:00 +0800773 u32 enable_bits = SDVO_ENABLE | SDVO_AUDIO_ENABLE;
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200774
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300775 temp = I915_READ(intel_hdmi->hdmi_reg);
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200776
777 /* HW workaround for IBX, we need to move the port to transcoder A
778 * before disabling it. */
779 if (HAS_PCH_IBX(dev)) {
780 struct drm_crtc *crtc = encoder->base.crtc;
781 int pipe = crtc ? to_intel_crtc(crtc)->pipe : -1;
782
783 if (temp & SDVO_PIPE_B_SELECT) {
784 temp &= ~SDVO_PIPE_B_SELECT;
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300785 I915_WRITE(intel_hdmi->hdmi_reg, temp);
786 POSTING_READ(intel_hdmi->hdmi_reg);
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200787
788 /* Again we need to write this twice. */
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300789 I915_WRITE(intel_hdmi->hdmi_reg, temp);
790 POSTING_READ(intel_hdmi->hdmi_reg);
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200791
792 /* Transcoder selection bits only update
793 * effectively on vblank. */
794 if (crtc)
795 intel_wait_for_vblank(dev, pipe);
796 else
797 msleep(50);
Daniel Vetter7a87c282012-06-05 11:03:39 +0200798 }
799 }
800
Zhenyu Wangd8a2d0e2009-11-02 07:52:30 +0000801 /* HW workaround, need to toggle enable bit off and on for 12bpc, but
802 * we do this anyway which shows more stable in testing.
803 */
Eric Anholtc619eed2010-01-28 16:45:52 -0800804 if (HAS_PCH_SPLIT(dev)) {
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300805 I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE);
806 POSTING_READ(intel_hdmi->hdmi_reg);
Eric Anholt7d573822009-01-02 13:33:00 -0800807 }
Zhenyu Wangd8a2d0e2009-11-02 07:52:30 +0000808
Daniel Vetter5ab432e2012-06-30 08:59:56 +0200809 temp &= ~enable_bits;
Zhenyu Wangd8a2d0e2009-11-02 07:52:30 +0000810
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300811 I915_WRITE(intel_hdmi->hdmi_reg, temp);
812 POSTING_READ(intel_hdmi->hdmi_reg);
Zhenyu Wangd8a2d0e2009-11-02 07:52:30 +0000813
814 /* HW workaround, need to write this twice for issue that may result
815 * in first write getting masked.
816 */
Eric Anholtc619eed2010-01-28 16:45:52 -0800817 if (HAS_PCH_SPLIT(dev)) {
Paulo Zanonib242b7f2013-02-18 19:00:26 -0300818 I915_WRITE(intel_hdmi->hdmi_reg, temp);
819 POSTING_READ(intel_hdmi->hdmi_reg);
Zhenyu Wangd8a2d0e2009-11-02 07:52:30 +0000820 }
Eric Anholt7d573822009-01-02 13:33:00 -0800821}
822
Eric Anholt7d573822009-01-02 13:33:00 -0800823static int intel_hdmi_mode_valid(struct drm_connector *connector,
824 struct drm_display_mode *mode)
825{
826 if (mode->clock > 165000)
827 return MODE_CLOCK_HIGH;
828 if (mode->clock < 20000)
Nicolas Kaiser5cbba412011-05-30 12:48:26 +0200829 return MODE_CLOCK_LOW;
Eric Anholt7d573822009-01-02 13:33:00 -0800830
831 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
832 return MODE_NO_DBLESCAN;
833
834 return MODE_OK;
835}
836
Daniel Vetter5bfe2ac2013-03-27 00:44:55 +0100837bool intel_hdmi_compute_config(struct intel_encoder *encoder,
838 struct intel_crtc_config *pipe_config)
Eric Anholt7d573822009-01-02 13:33:00 -0800839{
Daniel Vetter5bfe2ac2013-03-27 00:44:55 +0100840 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
841 struct drm_device *dev = encoder->base.dev;
842 struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;
Daniel Vetter325b9d02013-04-19 11:24:33 +0200843 int clock_12bpc = pipe_config->requested_mode.clock * 3 / 2;
Daniel Vettere29c22c2013-02-21 00:00:16 +0100844 int desired_bpp;
Ville Syrjälä3685a8f2013-01-17 16:31:28 +0200845
Ville Syrjälä55bc60d2013-01-17 16:31:29 +0200846 if (intel_hdmi->color_range_auto) {
847 /* See CEA-861-E - 5.1 Default Encoding Parameters */
848 if (intel_hdmi->has_hdmi_sink &&
Thierry Reding18316c82012-12-20 15:41:44 +0100849 drm_match_cea_mode(adjusted_mode) > 1)
Paulo Zanoni4f3a8bc2013-02-19 16:21:47 -0300850 intel_hdmi->color_range = HDMI_COLOR_RANGE_16_235;
Ville Syrjälä55bc60d2013-01-17 16:31:29 +0200851 else
852 intel_hdmi->color_range = 0;
853 }
854
Ville Syrjälä3685a8f2013-01-17 16:31:28 +0200855 if (intel_hdmi->color_range)
Daniel Vetter50f3b012013-03-27 00:44:56 +0100856 pipe_config->limited_color_range = true;
Ville Syrjälä3685a8f2013-01-17 16:31:28 +0200857
Daniel Vetter5bfe2ac2013-03-27 00:44:55 +0100858 if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev))
859 pipe_config->has_pch_encoder = true;
860
Daniel Vetter4e53c2e2013-03-27 00:44:58 +0100861 /*
862 * HDMI is either 12 or 8, so if the display lets 10bpc sneak
863 * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi
Daniel Vetter325b9d02013-04-19 11:24:33 +0200864 * outputs. We also need to check that the higher clock still fits
865 * within limits.
Daniel Vetter4e53c2e2013-03-27 00:44:58 +0100866 */
Daniel Vetter325b9d02013-04-19 11:24:33 +0200867 if (pipe_config->pipe_bpp > 8*3 && clock_12bpc <= 225000
868 && HAS_PCH_SPLIT(dev)) {
Daniel Vettere29c22c2013-02-21 00:00:16 +0100869 DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
870 desired_bpp = 12*3;
Daniel Vetter325b9d02013-04-19 11:24:33 +0200871
872 /* Need to adjust the port link by 1.5x for 12bpc. */
Daniel Vetterff9a6752013-06-01 17:16:21 +0200873 pipe_config->port_clock = clock_12bpc;
Daniel Vetter4e53c2e2013-03-27 00:44:58 +0100874 } else {
Daniel Vettere29c22c2013-02-21 00:00:16 +0100875 DRM_DEBUG_KMS("picking bpc to 8 for HDMI output\n");
876 desired_bpp = 8*3;
877 }
878
879 if (!pipe_config->bw_constrained) {
880 DRM_DEBUG_KMS("forcing pipe bpc to %i for HDMI\n", desired_bpp);
881 pipe_config->pipe_bpp = desired_bpp;
Daniel Vetter4e53c2e2013-03-27 00:44:58 +0100882 }
883
Daniel Vetter325b9d02013-04-19 11:24:33 +0200884 if (adjusted_mode->clock > 225000) {
885 DRM_DEBUG_KMS("too high HDMI clock, rejecting mode\n");
886 return false;
887 }
888
Eric Anholt7d573822009-01-02 13:33:00 -0800889 return true;
890}
891
Keith Packardaa93d632009-05-05 09:52:46 -0700892static enum drm_connector_status
Chris Wilson930a9e22010-09-14 11:07:23 +0100893intel_hdmi_detect(struct drm_connector *connector, bool force)
Ma Ling9dff6af2009-04-02 13:13:26 +0800894{
Damien Lespiaub0ea7d32012-12-13 16:09:00 +0000895 struct drm_device *dev = connector->dev;
Chris Wilsondf0e9242010-09-09 16:20:55 +0100896 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
Paulo Zanonid63885d2012-10-26 19:05:49 -0200897 struct intel_digital_port *intel_dig_port =
898 hdmi_to_dig_port(intel_hdmi);
899 struct intel_encoder *intel_encoder = &intel_dig_port->base;
Damien Lespiaub0ea7d32012-12-13 16:09:00 +0000900 struct drm_i915_private *dev_priv = dev->dev_private;
Chris Wilsonf899fc62010-07-20 15:44:45 -0700901 struct edid *edid;
Keith Packardaa93d632009-05-05 09:52:46 -0700902 enum drm_connector_status status = connector_status_disconnected;
Ma Ling9dff6af2009-04-02 13:13:26 +0800903
Chris Wilson164c8592013-07-20 20:27:08 +0100904 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
905 connector->base.id, drm_get_connector_name(connector));
906
Chris Wilsonea5b2132010-08-04 13:50:23 +0100907 intel_hdmi->has_hdmi_sink = false;
Zhenyu Wang2e3d6002010-09-10 10:39:40 +0800908 intel_hdmi->has_audio = false;
Ville Syrjäläabedc072013-01-17 16:31:31 +0200909 intel_hdmi->rgb_quant_range_selectable = false;
Chris Wilsonf899fc62010-07-20 15:44:45 -0700910 edid = drm_get_edid(connector,
Daniel Kurtz3bd7d902012-03-28 02:36:14 +0800911 intel_gmbus_get_adapter(dev_priv,
912 intel_hdmi->ddc_bus));
ling.ma@intel.com2ded9e22009-07-16 17:23:09 +0800913
Keith Packardaa93d632009-05-05 09:52:46 -0700914 if (edid) {
Eric Anholtbe9f1c42009-06-21 22:14:55 -0700915 if (edid->input & DRM_EDID_INPUT_DIGITAL) {
Keith Packardaa93d632009-05-05 09:52:46 -0700916 status = connector_status_connected;
Wu Fengguangb1d7e4b2012-02-14 11:45:36 +0800917 if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI)
918 intel_hdmi->has_hdmi_sink =
919 drm_detect_hdmi_monitor(edid);
Zhenyu Wang2e3d6002010-09-10 10:39:40 +0800920 intel_hdmi->has_audio = drm_detect_monitor_audio(edid);
Ville Syrjäläabedc072013-01-17 16:31:31 +0200921 intel_hdmi->rgb_quant_range_selectable =
922 drm_rgb_quant_range_selectable(edid);
Keith Packardaa93d632009-05-05 09:52:46 -0700923 }
Keith Packardaa93d632009-05-05 09:52:46 -0700924 kfree(edid);
Ma Ling9dff6af2009-04-02 13:13:26 +0800925 }
ling.ma@intel.com2ded9e22009-07-16 17:23:09 +0800926
Chris Wilson55b7d6e82010-09-19 09:29:33 +0100927 if (status == connector_status_connected) {
Wu Fengguangb1d7e4b2012-02-14 11:45:36 +0800928 if (intel_hdmi->force_audio != HDMI_AUDIO_AUTO)
929 intel_hdmi->has_audio =
930 (intel_hdmi->force_audio == HDMI_AUDIO_ON);
Paulo Zanonid63885d2012-10-26 19:05:49 -0200931 intel_encoder->type = INTEL_OUTPUT_HDMI;
Chris Wilson55b7d6e82010-09-19 09:29:33 +0100932 }
933
Keith Packardaa93d632009-05-05 09:52:46 -0700934 return status;
Ma Ling9dff6af2009-04-02 13:13:26 +0800935}
936
Eric Anholt7d573822009-01-02 13:33:00 -0800937static int intel_hdmi_get_modes(struct drm_connector *connector)
938{
Chris Wilsondf0e9242010-09-09 16:20:55 +0100939 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
Chris Wilsonf899fc62010-07-20 15:44:45 -0700940 struct drm_i915_private *dev_priv = connector->dev->dev_private;
Eric Anholt7d573822009-01-02 13:33:00 -0800941
942 /* We should parse the EDID data and find out if it's an HDMI sink so
943 * we can send audio to it.
944 */
945
Chris Wilsonf899fc62010-07-20 15:44:45 -0700946 return intel_ddc_get_modes(connector,
Daniel Kurtz3bd7d902012-03-28 02:36:14 +0800947 intel_gmbus_get_adapter(dev_priv,
948 intel_hdmi->ddc_bus));
Eric Anholt7d573822009-01-02 13:33:00 -0800949}
950
Chris Wilson1aad7ac2011-02-09 18:46:58 +0000951static bool
952intel_hdmi_detect_audio(struct drm_connector *connector)
953{
954 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
955 struct drm_i915_private *dev_priv = connector->dev->dev_private;
956 struct edid *edid;
957 bool has_audio = false;
958
959 edid = drm_get_edid(connector,
Daniel Kurtz3bd7d902012-03-28 02:36:14 +0800960 intel_gmbus_get_adapter(dev_priv,
961 intel_hdmi->ddc_bus));
Chris Wilson1aad7ac2011-02-09 18:46:58 +0000962 if (edid) {
963 if (edid->input & DRM_EDID_INPUT_DIGITAL)
964 has_audio = drm_detect_monitor_audio(edid);
Chris Wilson1aad7ac2011-02-09 18:46:58 +0000965 kfree(edid);
966 }
967
968 return has_audio;
969}
970
Chris Wilson55b7d6e82010-09-19 09:29:33 +0100971static int
972intel_hdmi_set_property(struct drm_connector *connector,
Paulo Zanonied517fb2012-05-14 17:12:50 -0300973 struct drm_property *property,
974 uint64_t val)
Chris Wilson55b7d6e82010-09-19 09:29:33 +0100975{
976 struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
Paulo Zanonida63a9f2012-10-26 19:05:46 -0200977 struct intel_digital_port *intel_dig_port =
978 hdmi_to_dig_port(intel_hdmi);
Chris Wilsone953fd72011-02-21 22:23:52 +0000979 struct drm_i915_private *dev_priv = connector->dev->dev_private;
Chris Wilson55b7d6e82010-09-19 09:29:33 +0100980 int ret;
981
Rob Clark662595d2012-10-11 20:36:04 -0500982 ret = drm_object_property_set_value(&connector->base, property, val);
Chris Wilson55b7d6e82010-09-19 09:29:33 +0100983 if (ret)
984 return ret;
985
Chris Wilson3f43c482011-05-12 22:17:24 +0100986 if (property == dev_priv->force_audio_property) {
Wu Fengguangb1d7e4b2012-02-14 11:45:36 +0800987 enum hdmi_force_audio i = val;
Chris Wilson1aad7ac2011-02-09 18:46:58 +0000988 bool has_audio;
989
990 if (i == intel_hdmi->force_audio)
Chris Wilson55b7d6e82010-09-19 09:29:33 +0100991 return 0;
992
Chris Wilson1aad7ac2011-02-09 18:46:58 +0000993 intel_hdmi->force_audio = i;
Chris Wilson55b7d6e82010-09-19 09:29:33 +0100994
Wu Fengguangb1d7e4b2012-02-14 11:45:36 +0800995 if (i == HDMI_AUDIO_AUTO)
Chris Wilson1aad7ac2011-02-09 18:46:58 +0000996 has_audio = intel_hdmi_detect_audio(connector);
997 else
Wu Fengguangb1d7e4b2012-02-14 11:45:36 +0800998 has_audio = (i == HDMI_AUDIO_ON);
Chris Wilson1aad7ac2011-02-09 18:46:58 +0000999
Wu Fengguangb1d7e4b2012-02-14 11:45:36 +08001000 if (i == HDMI_AUDIO_OFF_DVI)
1001 intel_hdmi->has_hdmi_sink = 0;
Chris Wilson55b7d6e82010-09-19 09:29:33 +01001002
Chris Wilson1aad7ac2011-02-09 18:46:58 +00001003 intel_hdmi->has_audio = has_audio;
Chris Wilson55b7d6e82010-09-19 09:29:33 +01001004 goto done;
1005 }
1006
Chris Wilsone953fd72011-02-21 22:23:52 +00001007 if (property == dev_priv->broadcast_rgb_property) {
Daniel Vetterae4edb82013-04-22 17:07:23 +02001008 bool old_auto = intel_hdmi->color_range_auto;
1009 uint32_t old_range = intel_hdmi->color_range;
1010
Ville Syrjälä55bc60d2013-01-17 16:31:29 +02001011 switch (val) {
1012 case INTEL_BROADCAST_RGB_AUTO:
1013 intel_hdmi->color_range_auto = true;
1014 break;
1015 case INTEL_BROADCAST_RGB_FULL:
1016 intel_hdmi->color_range_auto = false;
1017 intel_hdmi->color_range = 0;
1018 break;
1019 case INTEL_BROADCAST_RGB_LIMITED:
1020 intel_hdmi->color_range_auto = false;
Paulo Zanoni4f3a8bc2013-02-19 16:21:47 -03001021 intel_hdmi->color_range = HDMI_COLOR_RANGE_16_235;
Ville Syrjälä55bc60d2013-01-17 16:31:29 +02001022 break;
1023 default:
1024 return -EINVAL;
1025 }
Daniel Vetterae4edb82013-04-22 17:07:23 +02001026
1027 if (old_auto == intel_hdmi->color_range_auto &&
1028 old_range == intel_hdmi->color_range)
1029 return 0;
1030
Chris Wilsone953fd72011-02-21 22:23:52 +00001031 goto done;
1032 }
1033
Chris Wilson55b7d6e82010-09-19 09:29:33 +01001034 return -EINVAL;
1035
1036done:
Chris Wilsonc0c36b942012-12-19 16:08:43 +00001037 if (intel_dig_port->base.base.crtc)
1038 intel_crtc_restore_mode(intel_dig_port->base.base.crtc);
Chris Wilson55b7d6e82010-09-19 09:29:33 +01001039
1040 return 0;
1041}
1042
Jesse Barnes89b667f2013-04-18 14:51:36 -07001043static void intel_hdmi_pre_enable(struct intel_encoder *encoder)
1044{
1045 struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
1046 struct drm_device *dev = encoder->base.dev;
1047 struct drm_i915_private *dev_priv = dev->dev_private;
1048 struct intel_crtc *intel_crtc =
1049 to_intel_crtc(encoder->base.crtc);
1050 int port = vlv_dport_to_channel(dport);
1051 int pipe = intel_crtc->pipe;
1052 u32 val;
1053
1054 if (!IS_VALLEYVIEW(dev))
1055 return;
1056
Jesse Barnes89b667f2013-04-18 14:51:36 -07001057 /* Enable clock channels for this port */
Chris Wilson0980a602013-07-26 19:57:35 +01001058 mutex_lock(&dev_priv->dpio_lock);
Jani Nikulaae992582013-05-22 15:36:19 +03001059 val = vlv_dpio_read(dev_priv, DPIO_DATA_LANE_A(port));
Jesse Barnes89b667f2013-04-18 14:51:36 -07001060 val = 0;
1061 if (pipe)
1062 val |= (1<<21);
1063 else
1064 val &= ~(1<<21);
1065 val |= 0x001000c4;
Jani Nikulaae992582013-05-22 15:36:19 +03001066 vlv_dpio_write(dev_priv, DPIO_DATA_CHANNEL(port), val);
Jesse Barnes89b667f2013-04-18 14:51:36 -07001067
1068 /* HDMI 1.0V-2dB */
Jani Nikulaae992582013-05-22 15:36:19 +03001069 vlv_dpio_write(dev_priv, DPIO_TX_OCALINIT(port), 0);
1070 vlv_dpio_write(dev_priv, DPIO_TX_SWING_CTL4(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001071 0x2b245f5f);
Jani Nikulaae992582013-05-22 15:36:19 +03001072 vlv_dpio_write(dev_priv, DPIO_TX_SWING_CTL2(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001073 0x5578b83a);
Jani Nikulaae992582013-05-22 15:36:19 +03001074 vlv_dpio_write(dev_priv, DPIO_TX_SWING_CTL3(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001075 0x0c782040);
Jani Nikulaae992582013-05-22 15:36:19 +03001076 vlv_dpio_write(dev_priv, DPIO_TX3_SWING_CTL4(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001077 0x2b247878);
Jani Nikulaae992582013-05-22 15:36:19 +03001078 vlv_dpio_write(dev_priv, DPIO_PCS_STAGGER0(port), 0x00030000);
1079 vlv_dpio_write(dev_priv, DPIO_PCS_CTL_OVER1(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001080 0x00002000);
Jani Nikulaae992582013-05-22 15:36:19 +03001081 vlv_dpio_write(dev_priv, DPIO_TX_OCALINIT(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001082 DPIO_TX_OCALINIT_EN);
1083
1084 /* Program lane clock */
Jani Nikulaae992582013-05-22 15:36:19 +03001085 vlv_dpio_write(dev_priv, DPIO_PCS_CLOCKBUF0(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001086 0x00760018);
Jani Nikulaae992582013-05-22 15:36:19 +03001087 vlv_dpio_write(dev_priv, DPIO_PCS_CLOCKBUF8(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001088 0x00400888);
Chris Wilson0980a602013-07-26 19:57:35 +01001089 mutex_unlock(&dev_priv->dpio_lock);
Jani Nikulab76cf762013-07-30 12:20:31 +03001090
1091 intel_enable_hdmi(encoder);
1092
1093 vlv_wait_port_ready(dev_priv, port);
Jesse Barnes89b667f2013-04-18 14:51:36 -07001094}
1095
1096static void intel_hdmi_pre_pll_enable(struct intel_encoder *encoder)
1097{
1098 struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
1099 struct drm_device *dev = encoder->base.dev;
1100 struct drm_i915_private *dev_priv = dev->dev_private;
1101 int port = vlv_dport_to_channel(dport);
1102
1103 if (!IS_VALLEYVIEW(dev))
1104 return;
1105
Jesse Barnes89b667f2013-04-18 14:51:36 -07001106 /* Program Tx lane resets to default */
Chris Wilson0980a602013-07-26 19:57:35 +01001107 mutex_lock(&dev_priv->dpio_lock);
Jani Nikulaae992582013-05-22 15:36:19 +03001108 vlv_dpio_write(dev_priv, DPIO_PCS_TX(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001109 DPIO_PCS_TX_LANE2_RESET |
1110 DPIO_PCS_TX_LANE1_RESET);
Jani Nikulaae992582013-05-22 15:36:19 +03001111 vlv_dpio_write(dev_priv, DPIO_PCS_CLK(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001112 DPIO_PCS_CLK_CRI_RXEB_EIOS_EN |
1113 DPIO_PCS_CLK_CRI_RXDIGFILTSG_EN |
1114 (1<<DPIO_PCS_CLK_DATAWIDTH_SHIFT) |
1115 DPIO_PCS_CLK_SOFT_RESET);
1116
1117 /* Fix up inter-pair skew failure */
Jani Nikulaae992582013-05-22 15:36:19 +03001118 vlv_dpio_write(dev_priv, DPIO_PCS_STAGGER1(port), 0x00750f00);
1119 vlv_dpio_write(dev_priv, DPIO_TX_CTL(port), 0x00001500);
1120 vlv_dpio_write(dev_priv, DPIO_TX_LANE(port), 0x40400000);
Jesse Barnes89b667f2013-04-18 14:51:36 -07001121
Jani Nikulaae992582013-05-22 15:36:19 +03001122 vlv_dpio_write(dev_priv, DPIO_PCS_CTL_OVER1(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001123 0x00002000);
Jani Nikulaae992582013-05-22 15:36:19 +03001124 vlv_dpio_write(dev_priv, DPIO_TX_OCALINIT(port),
Jesse Barnes89b667f2013-04-18 14:51:36 -07001125 DPIO_TX_OCALINIT_EN);
Chris Wilson0980a602013-07-26 19:57:35 +01001126 mutex_unlock(&dev_priv->dpio_lock);
Jesse Barnes89b667f2013-04-18 14:51:36 -07001127}
1128
1129static void intel_hdmi_post_disable(struct intel_encoder *encoder)
1130{
1131 struct intel_digital_port *dport = enc_to_dig_port(&encoder->base);
1132 struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
1133 int port = vlv_dport_to_channel(dport);
1134
1135 /* Reset lanes to avoid HDMI flicker (VLV w/a) */
1136 mutex_lock(&dev_priv->dpio_lock);
Jani Nikulaae992582013-05-22 15:36:19 +03001137 vlv_dpio_write(dev_priv, DPIO_PCS_TX(port), 0x00000000);
1138 vlv_dpio_write(dev_priv, DPIO_PCS_CLK(port), 0x00e00060);
Jesse Barnes89b667f2013-04-18 14:51:36 -07001139 mutex_unlock(&dev_priv->dpio_lock);
1140}
1141
Eric Anholt7d573822009-01-02 13:33:00 -08001142static void intel_hdmi_destroy(struct drm_connector *connector)
1143{
Eric Anholt7d573822009-01-02 13:33:00 -08001144 drm_sysfs_connector_remove(connector);
1145 drm_connector_cleanup(connector);
Zhenyu Wang674e2d02010-03-29 15:57:42 +08001146 kfree(connector);
Eric Anholt7d573822009-01-02 13:33:00 -08001147}
1148
Eric Anholt7d573822009-01-02 13:33:00 -08001149static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
Daniel Vetter5ab432e2012-06-30 08:59:56 +02001150 .dpms = intel_connector_dpms,
Eric Anholt7d573822009-01-02 13:33:00 -08001151 .detect = intel_hdmi_detect,
1152 .fill_modes = drm_helper_probe_single_connector_modes,
Chris Wilson55b7d6e82010-09-19 09:29:33 +01001153 .set_property = intel_hdmi_set_property,
Eric Anholt7d573822009-01-02 13:33:00 -08001154 .destroy = intel_hdmi_destroy,
1155};
1156
1157static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {
1158 .get_modes = intel_hdmi_get_modes,
1159 .mode_valid = intel_hdmi_mode_valid,
Chris Wilsondf0e9242010-09-09 16:20:55 +01001160 .best_encoder = intel_best_encoder,
Eric Anholt7d573822009-01-02 13:33:00 -08001161};
1162
Eric Anholt7d573822009-01-02 13:33:00 -08001163static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
Chris Wilsonea5b2132010-08-04 13:50:23 +01001164 .destroy = intel_encoder_destroy,
Eric Anholt7d573822009-01-02 13:33:00 -08001165};
1166
Chris Wilson55b7d6e82010-09-19 09:29:33 +01001167static void
1168intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector)
1169{
Chris Wilson3f43c482011-05-12 22:17:24 +01001170 intel_attach_force_audio_property(connector);
Chris Wilsone953fd72011-02-21 22:23:52 +00001171 intel_attach_broadcast_rgb_property(connector);
Ville Syrjälä55bc60d2013-01-17 16:31:29 +02001172 intel_hdmi->color_range_auto = true;
Chris Wilson55b7d6e82010-09-19 09:29:33 +01001173}
1174
Paulo Zanoni00c09d72012-10-26 19:05:52 -02001175void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
1176 struct intel_connector *intel_connector)
Eric Anholt7d573822009-01-02 13:33:00 -08001177{
Paulo Zanonib9cb2342012-10-26 19:05:47 -02001178 struct drm_connector *connector = &intel_connector->base;
1179 struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
1180 struct intel_encoder *intel_encoder = &intel_dig_port->base;
1181 struct drm_device *dev = intel_encoder->base.dev;
Eric Anholt7d573822009-01-02 13:33:00 -08001182 struct drm_i915_private *dev_priv = dev->dev_private;
Paulo Zanoni174edf12012-10-26 19:05:50 -02001183 enum port port = intel_dig_port->port;
Eric Anholt7d573822009-01-02 13:33:00 -08001184
Eric Anholt7d573822009-01-02 13:33:00 -08001185 drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
Adam Jackson8d911042009-09-23 15:08:29 -04001186 DRM_MODE_CONNECTOR_HDMIA);
Eric Anholt7d573822009-01-02 13:33:00 -08001187 drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
1188
Peter Rossc3febcc2012-01-28 14:49:26 +01001189 connector->interlace_allowed = 1;
Eric Anholt7d573822009-01-02 13:33:00 -08001190 connector->doublescan_allowed = 0;
1191
Daniel Vetter08d644a2012-07-12 20:19:59 +02001192 switch (port) {
1193 case PORT_B:
Chris Wilsonf899fc62010-07-20 15:44:45 -07001194 intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
Egbert Eich1d843f92013-02-25 12:06:49 -05001195 intel_encoder->hpd_pin = HPD_PORT_B;
Daniel Vetter08d644a2012-07-12 20:19:59 +02001196 break;
1197 case PORT_C:
Chris Wilsonf899fc62010-07-20 15:44:45 -07001198 intel_hdmi->ddc_bus = GMBUS_PORT_DPC;
Egbert Eich1d843f92013-02-25 12:06:49 -05001199 intel_encoder->hpd_pin = HPD_PORT_C;
Daniel Vetter08d644a2012-07-12 20:19:59 +02001200 break;
1201 case PORT_D:
Chris Wilsonf899fc62010-07-20 15:44:45 -07001202 intel_hdmi->ddc_bus = GMBUS_PORT_DPD;
Egbert Eich1d843f92013-02-25 12:06:49 -05001203 intel_encoder->hpd_pin = HPD_PORT_D;
Daniel Vetter08d644a2012-07-12 20:19:59 +02001204 break;
1205 case PORT_A:
Egbert Eich1d843f92013-02-25 12:06:49 -05001206 intel_encoder->hpd_pin = HPD_PORT_A;
Daniel Vetter08d644a2012-07-12 20:19:59 +02001207 /* Internal port only for eDP. */
1208 default:
Eugeni Dodonov6e4c1672012-05-09 15:37:13 -03001209 BUG();
Ma Lingf8aed702009-08-24 13:50:24 +08001210 }
Eric Anholt7d573822009-01-02 13:33:00 -08001211
Jesse Barnes7637bfd2013-03-08 10:46:01 -08001212 if (IS_VALLEYVIEW(dev)) {
Shobhit Kumar90b107c2012-03-28 13:39:32 -07001213 intel_hdmi->write_infoframe = vlv_write_infoframe;
Paulo Zanoni687f4d02012-05-28 16:42:48 -03001214 intel_hdmi->set_infoframes = vlv_set_infoframes;
Jesse Barnes7637bfd2013-03-08 10:46:01 -08001215 } else if (!HAS_PCH_SPLIT(dev)) {
1216 intel_hdmi->write_infoframe = g4x_write_infoframe;
1217 intel_hdmi->set_infoframes = g4x_set_infoframes;
Paulo Zanoni22b8bf12013-02-18 19:00:23 -03001218 } else if (HAS_DDI(dev)) {
Eugeni Dodonov8c5f5f72012-05-10 10:18:02 -03001219 intel_hdmi->write_infoframe = hsw_write_infoframe;
Paulo Zanoni687f4d02012-05-28 16:42:48 -03001220 intel_hdmi->set_infoframes = hsw_set_infoframes;
Paulo Zanonifdf12502012-05-04 17:18:24 -03001221 } else if (HAS_PCH_IBX(dev)) {
1222 intel_hdmi->write_infoframe = ibx_write_infoframe;
Paulo Zanoni687f4d02012-05-28 16:42:48 -03001223 intel_hdmi->set_infoframes = ibx_set_infoframes;
Paulo Zanonifdf12502012-05-04 17:18:24 -03001224 } else {
1225 intel_hdmi->write_infoframe = cpt_write_infoframe;
Paulo Zanoni687f4d02012-05-28 16:42:48 -03001226 intel_hdmi->set_infoframes = cpt_set_infoframes;
Jesse Barnes64a8fc02011-09-22 11:16:00 +05301227 }
Jesse Barnes45187ac2011-08-03 09:22:55 -07001228
Paulo Zanoniaffa9352012-11-23 15:30:39 -02001229 if (HAS_DDI(dev))
Paulo Zanonibcbc8892012-10-26 19:05:51 -02001230 intel_connector->get_hw_state = intel_ddi_connector_get_hw_state;
1231 else
1232 intel_connector->get_hw_state = intel_connector_get_hw_state;
Paulo Zanonib9cb2342012-10-26 19:05:47 -02001233
1234 intel_hdmi_add_properties(intel_hdmi, connector);
1235
1236 intel_connector_attach_encoder(intel_connector, intel_encoder);
1237 drm_sysfs_connector_add(connector);
1238
1239 /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
1240 * 0xd. Failure to do so will result in spurious interrupts being
1241 * generated on the port when a cable is not attached.
1242 */
1243 if (IS_G4X(dev) && !IS_GM45(dev)) {
1244 u32 temp = I915_READ(PEG_BAND_GAP_DATA);
1245 I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
1246 }
1247}
1248
Paulo Zanonib242b7f2013-02-18 19:00:26 -03001249void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port)
Paulo Zanonib9cb2342012-10-26 19:05:47 -02001250{
1251 struct intel_digital_port *intel_dig_port;
1252 struct intel_encoder *intel_encoder;
1253 struct drm_encoder *encoder;
1254 struct intel_connector *intel_connector;
1255
1256 intel_dig_port = kzalloc(sizeof(struct intel_digital_port), GFP_KERNEL);
1257 if (!intel_dig_port)
1258 return;
1259
1260 intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
1261 if (!intel_connector) {
1262 kfree(intel_dig_port);
1263 return;
1264 }
1265
1266 intel_encoder = &intel_dig_port->base;
1267 encoder = &intel_encoder->base;
1268
1269 drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs,
1270 DRM_MODE_ENCODER_TMDS);
Paulo Zanoni00c09d72012-10-26 19:05:52 -02001271
Daniel Vetter5bfe2ac2013-03-27 00:44:55 +01001272 intel_encoder->compute_config = intel_hdmi_compute_config;
Daniel Vetterc59423a2013-07-21 21:37:04 +02001273 intel_encoder->mode_set = intel_hdmi_mode_set;
Paulo Zanoni00c09d72012-10-26 19:05:52 -02001274 intel_encoder->disable = intel_disable_hdmi;
1275 intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
Jesse Barnes045ac3b2013-05-14 17:08:26 -07001276 intel_encoder->get_config = intel_hdmi_get_config;
Jesse Barnes89b667f2013-04-18 14:51:36 -07001277 if (IS_VALLEYVIEW(dev)) {
Jesse Barnes89b667f2013-04-18 14:51:36 -07001278 intel_encoder->pre_pll_enable = intel_hdmi_pre_pll_enable;
Jani Nikulab76cf762013-07-30 12:20:31 +03001279 intel_encoder->pre_enable = intel_hdmi_pre_enable;
1280 intel_encoder->enable = vlv_enable_hdmi;
Jesse Barnes89b667f2013-04-18 14:51:36 -07001281 intel_encoder->post_disable = intel_hdmi_post_disable;
Jani Nikulab76cf762013-07-30 12:20:31 +03001282 } else {
1283 intel_encoder->enable = intel_enable_hdmi;
Jesse Barnes89b667f2013-04-18 14:51:36 -07001284 }
Daniel Vetter5ab432e2012-06-30 08:59:56 +02001285
Paulo Zanonib9cb2342012-10-26 19:05:47 -02001286 intel_encoder->type = INTEL_OUTPUT_HDMI;
1287 intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
1288 intel_encoder->cloneable = false;
Eric Anholt7d573822009-01-02 13:33:00 -08001289
Paulo Zanoni174edf12012-10-26 19:05:50 -02001290 intel_dig_port->port = port;
Paulo Zanonib242b7f2013-02-18 19:00:26 -03001291 intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
Paulo Zanonib9cb2342012-10-26 19:05:47 -02001292 intel_dig_port->dp.output_reg = 0;
Chris Wilson55b7d6e82010-09-19 09:29:33 +01001293
Paulo Zanonib9cb2342012-10-26 19:05:47 -02001294 intel_hdmi_init_connector(intel_dig_port, intel_connector);
Eric Anholt7d573822009-01-02 13:33:00 -08001295}