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> |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 32 | #include <linux/hdmi.h> |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 33 | #include <drm/drmP.h> |
Matt Roper | c6f95f2 | 2015-01-22 16:50:32 -0800 | [diff] [blame] | 34 | #include <drm/drm_atomic_helper.h> |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 35 | #include <drm/drm_crtc.h> |
| 36 | #include <drm/drm_edid.h> |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 37 | #include "intel_drv.h" |
David Howells | 760285e | 2012-10-02 18:01:07 +0100 | [diff] [blame] | 38 | #include <drm/i915_drm.h> |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 39 | #include "i915_drv.h" |
| 40 | |
Paulo Zanoni | 30add22 | 2012-10-26 19:05:45 -0200 | [diff] [blame] | 41 | static struct drm_device *intel_hdmi_to_dev(struct intel_hdmi *intel_hdmi) |
| 42 | { |
Paulo Zanoni | da63a9f | 2012-10-26 19:05:46 -0200 | [diff] [blame] | 43 | return hdmi_to_dig_port(intel_hdmi)->base.base.dev; |
Paulo Zanoni | 30add22 | 2012-10-26 19:05:45 -0200 | [diff] [blame] | 44 | } |
| 45 | |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 46 | static void |
| 47 | assert_hdmi_port_disabled(struct intel_hdmi *intel_hdmi) |
| 48 | { |
Paulo Zanoni | 30add22 | 2012-10-26 19:05:45 -0200 | [diff] [blame] | 49 | struct drm_device *dev = intel_hdmi_to_dev(intel_hdmi); |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 50 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 51 | uint32_t enabled_bits; |
| 52 | |
Paulo Zanoni | affa935 | 2012-11-23 15:30:39 -0200 | [diff] [blame] | 53 | enabled_bits = HAS_DDI(dev) ? DDI_BUF_CTL_ENABLE : SDVO_ENABLE; |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 54 | |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 55 | WARN(I915_READ(intel_hdmi->hdmi_reg) & enabled_bits, |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 56 | "HDMI port enabled, expecting disabled\n"); |
| 57 | } |
| 58 | |
Eugeni Dodonov | f5bbfca | 2012-05-09 15:37:30 -0300 | [diff] [blame] | 59 | struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder) |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 60 | { |
Paulo Zanoni | da63a9f | 2012-10-26 19:05:46 -0200 | [diff] [blame] | 61 | struct intel_digital_port *intel_dig_port = |
| 62 | container_of(encoder, struct intel_digital_port, base.base); |
| 63 | return &intel_dig_port->hdmi; |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 64 | } |
| 65 | |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 66 | static struct intel_hdmi *intel_attached_hdmi(struct drm_connector *connector) |
| 67 | { |
Paulo Zanoni | da63a9f | 2012-10-26 19:05:46 -0200 | [diff] [blame] | 68 | return enc_to_intel_hdmi(&intel_attached_encoder(connector)->base); |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 69 | } |
| 70 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 71 | static u32 g4x_infoframe_index(enum hdmi_infoframe_type type) |
David Härdeman | 3c17fe4 | 2010-09-24 21:44:32 +0200 | [diff] [blame] | 72 | { |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 73 | switch (type) { |
| 74 | case HDMI_INFOFRAME_TYPE_AVI: |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 75 | return VIDEO_DIP_SELECT_AVI; |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 76 | case HDMI_INFOFRAME_TYPE_SPD: |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 77 | return VIDEO_DIP_SELECT_SPD; |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 78 | case HDMI_INFOFRAME_TYPE_VENDOR: |
| 79 | return VIDEO_DIP_SELECT_VENDOR; |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 80 | default: |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 81 | DRM_DEBUG_DRIVER("unknown info frame type %d\n", type); |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 82 | return 0; |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 83 | } |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 84 | } |
| 85 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 86 | static u32 g4x_infoframe_enable(enum hdmi_infoframe_type type) |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 87 | { |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 88 | switch (type) { |
| 89 | case HDMI_INFOFRAME_TYPE_AVI: |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 90 | return VIDEO_DIP_ENABLE_AVI; |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 91 | case HDMI_INFOFRAME_TYPE_SPD: |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 92 | return VIDEO_DIP_ENABLE_SPD; |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 93 | case HDMI_INFOFRAME_TYPE_VENDOR: |
| 94 | return VIDEO_DIP_ENABLE_VENDOR; |
Paulo Zanoni | fa193ff | 2012-05-04 17:18:20 -0300 | [diff] [blame] | 95 | default: |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 96 | DRM_DEBUG_DRIVER("unknown info frame type %d\n", type); |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 97 | return 0; |
Paulo Zanoni | fa193ff | 2012-05-04 17:18:20 -0300 | [diff] [blame] | 98 | } |
Paulo Zanoni | fa193ff | 2012-05-04 17:18:20 -0300 | [diff] [blame] | 99 | } |
| 100 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 101 | static u32 hsw_infoframe_enable(enum hdmi_infoframe_type type) |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 102 | { |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 103 | switch (type) { |
| 104 | case HDMI_INFOFRAME_TYPE_AVI: |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 105 | return VIDEO_DIP_ENABLE_AVI_HSW; |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 106 | case HDMI_INFOFRAME_TYPE_SPD: |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 107 | return VIDEO_DIP_ENABLE_SPD_HSW; |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 108 | case HDMI_INFOFRAME_TYPE_VENDOR: |
| 109 | return VIDEO_DIP_ENABLE_VS_HSW; |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 110 | default: |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 111 | DRM_DEBUG_DRIVER("unknown info frame type %d\n", type); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 112 | return 0; |
| 113 | } |
| 114 | } |
| 115 | |
Ville Syrjälä | 436c6d4 | 2015-09-18 20:03:37 +0300 | [diff] [blame^] | 116 | static u32 hsw_dip_data_reg(struct drm_i915_private *dev_priv, |
| 117 | enum transcoder cpu_transcoder, |
| 118 | enum hdmi_infoframe_type type, |
| 119 | int i) |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 120 | { |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 121 | switch (type) { |
| 122 | case HDMI_INFOFRAME_TYPE_AVI: |
Ville Syrjälä | 436c6d4 | 2015-09-18 20:03:37 +0300 | [diff] [blame^] | 123 | return HSW_TVIDEO_DIP_AVI_DATA(cpu_transcoder, i); |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 124 | case HDMI_INFOFRAME_TYPE_SPD: |
Ville Syrjälä | 436c6d4 | 2015-09-18 20:03:37 +0300 | [diff] [blame^] | 125 | return HSW_TVIDEO_DIP_SPD_DATA(cpu_transcoder, i); |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 126 | case HDMI_INFOFRAME_TYPE_VENDOR: |
Ville Syrjälä | 436c6d4 | 2015-09-18 20:03:37 +0300 | [diff] [blame^] | 127 | return HSW_TVIDEO_DIP_VS_DATA(cpu_transcoder, i); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 128 | default: |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 129 | DRM_DEBUG_DRIVER("unknown info frame type %d\n", type); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 130 | return 0; |
| 131 | } |
| 132 | } |
| 133 | |
Daniel Vetter | a3da1df | 2012-05-08 15:19:06 +0200 | [diff] [blame] | 134 | static void g4x_write_infoframe(struct drm_encoder *encoder, |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 135 | enum hdmi_infoframe_type type, |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 136 | const void *frame, ssize_t len) |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 137 | { |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 138 | const uint32_t *data = frame; |
David Härdeman | 3c17fe4 | 2010-09-24 21:44:32 +0200 | [diff] [blame] | 139 | struct drm_device *dev = encoder->dev; |
| 140 | struct drm_i915_private *dev_priv = dev->dev_private; |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 141 | u32 val = I915_READ(VIDEO_DIP_CTL); |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 142 | int i; |
David Härdeman | 3c17fe4 | 2010-09-24 21:44:32 +0200 | [diff] [blame] | 143 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 144 | WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n"); |
| 145 | |
Paulo Zanoni | 1d4f85a | 2012-05-04 17:18:18 -0300 | [diff] [blame] | 146 | val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 147 | val |= g4x_infoframe_index(type); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 148 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 149 | val &= ~g4x_infoframe_enable(type); |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 150 | |
| 151 | I915_WRITE(VIDEO_DIP_CTL, val); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 152 | |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 153 | mmiowb(); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 154 | for (i = 0; i < len; i += 4) { |
David Härdeman | 3c17fe4 | 2010-09-24 21:44:32 +0200 | [diff] [blame] | 155 | I915_WRITE(VIDEO_DIP_DATA, *data); |
| 156 | data++; |
| 157 | } |
Paulo Zanoni | adf00b2 | 2012-09-25 13:23:34 -0300 | [diff] [blame] | 158 | /* Write every possible data byte to force correct ECC calculation. */ |
| 159 | for (; i < VIDEO_DIP_DATA_SIZE; i += 4) |
| 160 | I915_WRITE(VIDEO_DIP_DATA, 0); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 161 | mmiowb(); |
David Härdeman | 3c17fe4 | 2010-09-24 21:44:32 +0200 | [diff] [blame] | 162 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 163 | val |= g4x_infoframe_enable(type); |
Paulo Zanoni | 60c5ea2 | 2012-05-04 17:18:22 -0300 | [diff] [blame] | 164 | val &= ~VIDEO_DIP_FREQ_MASK; |
Daniel Vetter | 4b24c93 | 2012-05-08 14:41:00 +0200 | [diff] [blame] | 165 | val |= VIDEO_DIP_FREQ_VSYNC; |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 166 | |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 167 | I915_WRITE(VIDEO_DIP_CTL, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 168 | POSTING_READ(VIDEO_DIP_CTL); |
David Härdeman | 3c17fe4 | 2010-09-24 21:44:32 +0200 | [diff] [blame] | 169 | } |
| 170 | |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 171 | static bool g4x_infoframe_enabled(struct drm_encoder *encoder) |
| 172 | { |
| 173 | struct drm_device *dev = encoder->dev; |
| 174 | struct drm_i915_private *dev_priv = dev->dev_private; |
Jesse Barnes | 89a35ec | 2014-11-20 13:24:13 -0800 | [diff] [blame] | 175 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 176 | u32 val = I915_READ(VIDEO_DIP_CTL); |
| 177 | |
Ville Syrjälä | ec1dc60 | 2015-05-05 17:06:25 +0300 | [diff] [blame] | 178 | if ((val & VIDEO_DIP_ENABLE) == 0) |
| 179 | return false; |
Jesse Barnes | 89a35ec | 2014-11-20 13:24:13 -0800 | [diff] [blame] | 180 | |
Ville Syrjälä | ec1dc60 | 2015-05-05 17:06:25 +0300 | [diff] [blame] | 181 | if ((val & VIDEO_DIP_PORT_MASK) != VIDEO_DIP_PORT(intel_dig_port->port)) |
| 182 | return false; |
| 183 | |
| 184 | return val & (VIDEO_DIP_ENABLE_AVI | |
| 185 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_SPD); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 186 | } |
| 187 | |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 188 | static void ibx_write_infoframe(struct drm_encoder *encoder, |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 189 | enum hdmi_infoframe_type type, |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 190 | const void *frame, ssize_t len) |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 191 | { |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 192 | const uint32_t *data = frame; |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 193 | struct drm_device *dev = encoder->dev; |
| 194 | struct drm_i915_private *dev_priv = dev->dev_private; |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 195 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 196 | int i, reg = TVIDEO_DIP_CTL(intel_crtc->pipe); |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 197 | u32 val = I915_READ(reg); |
| 198 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 199 | WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n"); |
| 200 | |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 201 | val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 202 | val |= g4x_infoframe_index(type); |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 203 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 204 | val &= ~g4x_infoframe_enable(type); |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 205 | |
| 206 | I915_WRITE(reg, val); |
| 207 | |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 208 | mmiowb(); |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 209 | for (i = 0; i < len; i += 4) { |
| 210 | I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data); |
| 211 | data++; |
| 212 | } |
Paulo Zanoni | adf00b2 | 2012-09-25 13:23:34 -0300 | [diff] [blame] | 213 | /* Write every possible data byte to force correct ECC calculation. */ |
| 214 | for (; i < VIDEO_DIP_DATA_SIZE; i += 4) |
| 215 | I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 216 | mmiowb(); |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 217 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 218 | val |= g4x_infoframe_enable(type); |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 219 | val &= ~VIDEO_DIP_FREQ_MASK; |
Daniel Vetter | 4b24c93 | 2012-05-08 14:41:00 +0200 | [diff] [blame] | 220 | val |= VIDEO_DIP_FREQ_VSYNC; |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 221 | |
| 222 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 223 | POSTING_READ(reg); |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 224 | } |
| 225 | |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 226 | static bool ibx_infoframe_enabled(struct drm_encoder *encoder) |
| 227 | { |
| 228 | struct drm_device *dev = encoder->dev; |
| 229 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 230 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Jani Nikula | 052f62f | 2015-04-29 15:30:07 +0300 | [diff] [blame] | 231 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 232 | int reg = TVIDEO_DIP_CTL(intel_crtc->pipe); |
| 233 | u32 val = I915_READ(reg); |
| 234 | |
Ville Syrjälä | ec1dc60 | 2015-05-05 17:06:25 +0300 | [diff] [blame] | 235 | if ((val & VIDEO_DIP_ENABLE) == 0) |
| 236 | return false; |
Jani Nikula | 052f62f | 2015-04-29 15:30:07 +0300 | [diff] [blame] | 237 | |
Ville Syrjälä | ec1dc60 | 2015-05-05 17:06:25 +0300 | [diff] [blame] | 238 | if ((val & VIDEO_DIP_PORT_MASK) != VIDEO_DIP_PORT(intel_dig_port->port)) |
| 239 | return false; |
| 240 | |
| 241 | return val & (VIDEO_DIP_ENABLE_AVI | |
| 242 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
| 243 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 244 | } |
| 245 | |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 246 | static void cpt_write_infoframe(struct drm_encoder *encoder, |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 247 | enum hdmi_infoframe_type type, |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 248 | const void *frame, ssize_t len) |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 249 | { |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 250 | const uint32_t *data = frame; |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 251 | struct drm_device *dev = encoder->dev; |
| 252 | struct drm_i915_private *dev_priv = dev->dev_private; |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 253 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 254 | int i, reg = TVIDEO_DIP_CTL(intel_crtc->pipe); |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 255 | u32 val = I915_READ(reg); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 256 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 257 | WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n"); |
| 258 | |
Jesse Barnes | 64a8fc0 | 2011-09-22 11:16:00 +0530 | [diff] [blame] | 259 | val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 260 | val |= g4x_infoframe_index(type); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 261 | |
Paulo Zanoni | ecb9785 | 2012-05-04 17:18:21 -0300 | [diff] [blame] | 262 | /* The DIP control register spec says that we need to update the AVI |
| 263 | * infoframe without clearing its enable bit */ |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 264 | if (type != HDMI_INFOFRAME_TYPE_AVI) |
| 265 | val &= ~g4x_infoframe_enable(type); |
Paulo Zanoni | ecb9785 | 2012-05-04 17:18:21 -0300 | [diff] [blame] | 266 | |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 267 | I915_WRITE(reg, val); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 268 | |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 269 | mmiowb(); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 270 | for (i = 0; i < len; i += 4) { |
| 271 | I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data); |
| 272 | data++; |
| 273 | } |
Paulo Zanoni | adf00b2 | 2012-09-25 13:23:34 -0300 | [diff] [blame] | 274 | /* Write every possible data byte to force correct ECC calculation. */ |
| 275 | for (; i < VIDEO_DIP_DATA_SIZE; i += 4) |
| 276 | I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 277 | mmiowb(); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 278 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 279 | val |= g4x_infoframe_enable(type); |
Paulo Zanoni | 60c5ea2 | 2012-05-04 17:18:22 -0300 | [diff] [blame] | 280 | val &= ~VIDEO_DIP_FREQ_MASK; |
Daniel Vetter | 4b24c93 | 2012-05-08 14:41:00 +0200 | [diff] [blame] | 281 | val |= VIDEO_DIP_FREQ_VSYNC; |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 282 | |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 283 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 284 | POSTING_READ(reg); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 285 | } |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 286 | |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 287 | static bool cpt_infoframe_enabled(struct drm_encoder *encoder) |
| 288 | { |
| 289 | struct drm_device *dev = encoder->dev; |
| 290 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 291 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
| 292 | int reg = TVIDEO_DIP_CTL(intel_crtc->pipe); |
| 293 | u32 val = I915_READ(reg); |
| 294 | |
Ville Syrjälä | ec1dc60 | 2015-05-05 17:06:25 +0300 | [diff] [blame] | 295 | if ((val & VIDEO_DIP_ENABLE) == 0) |
| 296 | return false; |
| 297 | |
| 298 | return val & (VIDEO_DIP_ENABLE_AVI | |
| 299 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
| 300 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 301 | } |
| 302 | |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 303 | static void vlv_write_infoframe(struct drm_encoder *encoder, |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 304 | enum hdmi_infoframe_type type, |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 305 | const void *frame, ssize_t len) |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 306 | { |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 307 | const uint32_t *data = frame; |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 308 | struct drm_device *dev = encoder->dev; |
| 309 | struct drm_i915_private *dev_priv = dev->dev_private; |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 310 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 311 | int i, reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe); |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 312 | u32 val = I915_READ(reg); |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 313 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 314 | WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n"); |
| 315 | |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 316 | val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 317 | val |= g4x_infoframe_index(type); |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 318 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 319 | val &= ~g4x_infoframe_enable(type); |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 320 | |
| 321 | I915_WRITE(reg, val); |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 322 | |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 323 | mmiowb(); |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 324 | for (i = 0; i < len; i += 4) { |
| 325 | I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), *data); |
| 326 | data++; |
| 327 | } |
Paulo Zanoni | adf00b2 | 2012-09-25 13:23:34 -0300 | [diff] [blame] | 328 | /* Write every possible data byte to force correct ECC calculation. */ |
| 329 | for (; i < VIDEO_DIP_DATA_SIZE; i += 4) |
| 330 | I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), 0); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 331 | mmiowb(); |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 332 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 333 | val |= g4x_infoframe_enable(type); |
Paulo Zanoni | 60c5ea2 | 2012-05-04 17:18:22 -0300 | [diff] [blame] | 334 | val &= ~VIDEO_DIP_FREQ_MASK; |
Daniel Vetter | 4b24c93 | 2012-05-08 14:41:00 +0200 | [diff] [blame] | 335 | val |= VIDEO_DIP_FREQ_VSYNC; |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 336 | |
Paulo Zanoni | 22509ec | 2012-05-04 17:18:17 -0300 | [diff] [blame] | 337 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 338 | POSTING_READ(reg); |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 339 | } |
| 340 | |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 341 | static bool vlv_infoframe_enabled(struct drm_encoder *encoder) |
| 342 | { |
| 343 | struct drm_device *dev = encoder->dev; |
| 344 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 345 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Jesse Barnes | 535afa2 | 2015-04-15 16:52:29 -0700 | [diff] [blame] | 346 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 347 | int reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe); |
| 348 | u32 val = I915_READ(reg); |
| 349 | |
Ville Syrjälä | ec1dc60 | 2015-05-05 17:06:25 +0300 | [diff] [blame] | 350 | if ((val & VIDEO_DIP_ENABLE) == 0) |
| 351 | return false; |
Jesse Barnes | 535afa2 | 2015-04-15 16:52:29 -0700 | [diff] [blame] | 352 | |
Ville Syrjälä | ec1dc60 | 2015-05-05 17:06:25 +0300 | [diff] [blame] | 353 | if ((val & VIDEO_DIP_PORT_MASK) != VIDEO_DIP_PORT(intel_dig_port->port)) |
| 354 | return false; |
| 355 | |
| 356 | return val & (VIDEO_DIP_ENABLE_AVI | |
| 357 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
| 358 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 359 | } |
| 360 | |
Eugeni Dodonov | 8c5f5f7 | 2012-05-10 10:18:02 -0300 | [diff] [blame] | 361 | static void hsw_write_infoframe(struct drm_encoder *encoder, |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 362 | enum hdmi_infoframe_type type, |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 363 | const void *frame, ssize_t len) |
Eugeni Dodonov | 8c5f5f7 | 2012-05-10 10:18:02 -0300 | [diff] [blame] | 364 | { |
Ville Syrjälä | fff6386 | 2013-12-10 15:19:08 +0200 | [diff] [blame] | 365 | const uint32_t *data = frame; |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 366 | struct drm_device *dev = encoder->dev; |
| 367 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 368 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Ville Syrjälä | 436c6d4 | 2015-09-18 20:03:37 +0300 | [diff] [blame^] | 369 | enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder; |
| 370 | u32 ctl_reg = HSW_TVIDEO_DIP_CTL(cpu_transcoder); |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 371 | u32 data_reg; |
| 372 | int i; |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 373 | u32 val = I915_READ(ctl_reg); |
Eugeni Dodonov | 8c5f5f7 | 2012-05-10 10:18:02 -0300 | [diff] [blame] | 374 | |
Ville Syrjälä | 436c6d4 | 2015-09-18 20:03:37 +0300 | [diff] [blame^] | 375 | data_reg = hsw_dip_data_reg(dev_priv, cpu_transcoder, type, 0); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 376 | if (data_reg == 0) |
| 377 | return; |
Eugeni Dodonov | 8c5f5f7 | 2012-05-10 10:18:02 -0300 | [diff] [blame] | 378 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 379 | val &= ~hsw_infoframe_enable(type); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 380 | I915_WRITE(ctl_reg, val); |
| 381 | |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 382 | mmiowb(); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 383 | for (i = 0; i < len; i += 4) { |
Ville Syrjälä | 436c6d4 | 2015-09-18 20:03:37 +0300 | [diff] [blame^] | 384 | I915_WRITE(hsw_dip_data_reg(dev_priv, cpu_transcoder, |
| 385 | type, i >> 2), *data); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 386 | data++; |
| 387 | } |
Paulo Zanoni | adf00b2 | 2012-09-25 13:23:34 -0300 | [diff] [blame] | 388 | /* Write every possible data byte to force correct ECC calculation. */ |
| 389 | for (; i < VIDEO_DIP_DATA_SIZE; i += 4) |
Ville Syrjälä | 436c6d4 | 2015-09-18 20:03:37 +0300 | [diff] [blame^] | 390 | I915_WRITE(hsw_dip_data_reg(dev_priv, cpu_transcoder, |
| 391 | type, i >> 2), 0); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 392 | mmiowb(); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 393 | |
Damien Lespiau | 178f736 | 2013-08-06 20:32:18 +0100 | [diff] [blame] | 394 | val |= hsw_infoframe_enable(type); |
Paulo Zanoni | 2da8af5 | 2012-05-14 17:12:51 -0300 | [diff] [blame] | 395 | I915_WRITE(ctl_reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 396 | POSTING_READ(ctl_reg); |
Eugeni Dodonov | 8c5f5f7 | 2012-05-10 10:18:02 -0300 | [diff] [blame] | 397 | } |
| 398 | |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 399 | static bool hsw_infoframe_enabled(struct drm_encoder *encoder) |
| 400 | { |
| 401 | struct drm_device *dev = encoder->dev; |
| 402 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 403 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Ander Conselvan de Oliveira | 6e3c971 | 2015-01-15 14:55:25 +0200 | [diff] [blame] | 404 | u32 ctl_reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 405 | u32 val = I915_READ(ctl_reg); |
| 406 | |
Ville Syrjälä | ec1dc60 | 2015-05-05 17:06:25 +0300 | [diff] [blame] | 407 | return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW | |
| 408 | VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW | |
| 409 | VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW); |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 410 | } |
| 411 | |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 412 | /* |
| 413 | * The data we write to the DIP data buffer registers is 1 byte bigger than the |
| 414 | * HDMI infoframe size because of an ECC/reserved byte at position 3 (starting |
| 415 | * at 0). It's also a byte used by DisplayPort so the same DIP registers can be |
| 416 | * used for both technologies. |
| 417 | * |
| 418 | * DW0: Reserved/ECC/DP | HB2 | HB1 | HB0 |
| 419 | * DW1: DB3 | DB2 | DB1 | DB0 |
| 420 | * DW2: DB7 | DB6 | DB5 | DB4 |
| 421 | * DW3: ... |
| 422 | * |
| 423 | * (HB is Header Byte, DB is Data Byte) |
| 424 | * |
| 425 | * The hdmi pack() functions don't know about that hardware specific hole so we |
| 426 | * trick them by giving an offset into the buffer and moving back the header |
| 427 | * bytes by one. |
| 428 | */ |
Damien Lespiau | 9198ee5 | 2013-08-06 20:32:24 +0100 | [diff] [blame] | 429 | static void intel_write_infoframe(struct drm_encoder *encoder, |
| 430 | union hdmi_infoframe *frame) |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 431 | { |
| 432 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 433 | uint8_t buffer[VIDEO_DIP_DATA_SIZE]; |
| 434 | ssize_t len; |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 435 | |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 436 | /* see comment above for the reason for this offset */ |
| 437 | len = hdmi_infoframe_pack(frame, buffer + 1, sizeof(buffer) - 1); |
| 438 | if (len < 0) |
| 439 | return; |
| 440 | |
| 441 | /* Insert the 'hole' (see big comment above) at position 3 */ |
| 442 | buffer[0] = buffer[1]; |
| 443 | buffer[1] = buffer[2]; |
| 444 | buffer[2] = buffer[3]; |
| 445 | buffer[3] = 0; |
| 446 | len++; |
| 447 | |
| 448 | intel_hdmi->write_infoframe(encoder, frame->any.type, buffer, len); |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 449 | } |
| 450 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 451 | static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 452 | const struct drm_display_mode *adjusted_mode) |
Jesse Barnes | b055c8f | 2011-07-08 11:31:57 -0700 | [diff] [blame] | 453 | { |
Ville Syrjälä | abedc07 | 2013-01-17 16:31:31 +0200 | [diff] [blame] | 454 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
Daniel Vetter | 50f3b01 | 2013-03-27 00:44:56 +0100 | [diff] [blame] | 455 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 456 | union hdmi_infoframe frame; |
| 457 | int ret; |
Jesse Barnes | b055c8f | 2011-07-08 11:31:57 -0700 | [diff] [blame] | 458 | |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 459 | ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, |
| 460 | adjusted_mode); |
| 461 | if (ret < 0) { |
| 462 | DRM_ERROR("couldn't fill AVI infoframe\n"); |
| 463 | return; |
| 464 | } |
Paulo Zanoni | c846b61 | 2012-04-13 16:31:41 -0300 | [diff] [blame] | 465 | |
Ville Syrjälä | abedc07 | 2013-01-17 16:31:31 +0200 | [diff] [blame] | 466 | if (intel_hdmi->rgb_quant_range_selectable) { |
Ander Conselvan de Oliveira | 6e3c971 | 2015-01-15 14:55:25 +0200 | [diff] [blame] | 467 | if (intel_crtc->config->limited_color_range) |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 468 | frame.avi.quantization_range = |
| 469 | HDMI_QUANTIZATION_RANGE_LIMITED; |
Ville Syrjälä | abedc07 | 2013-01-17 16:31:31 +0200 | [diff] [blame] | 470 | else |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 471 | frame.avi.quantization_range = |
| 472 | HDMI_QUANTIZATION_RANGE_FULL; |
Ville Syrjälä | abedc07 | 2013-01-17 16:31:31 +0200 | [diff] [blame] | 473 | } |
| 474 | |
Damien Lespiau | 9198ee5 | 2013-08-06 20:32:24 +0100 | [diff] [blame] | 475 | intel_write_infoframe(encoder, &frame); |
Jesse Barnes | b055c8f | 2011-07-08 11:31:57 -0700 | [diff] [blame] | 476 | } |
| 477 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 478 | static void intel_hdmi_set_spd_infoframe(struct drm_encoder *encoder) |
Jesse Barnes | c0864cb | 2011-08-03 09:22:56 -0700 | [diff] [blame] | 479 | { |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 480 | union hdmi_infoframe frame; |
| 481 | int ret; |
Jesse Barnes | c0864cb | 2011-08-03 09:22:56 -0700 | [diff] [blame] | 482 | |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 483 | ret = hdmi_spd_infoframe_init(&frame.spd, "Intel", "Integrated gfx"); |
| 484 | if (ret < 0) { |
| 485 | DRM_ERROR("couldn't fill SPD infoframe\n"); |
| 486 | return; |
| 487 | } |
Jesse Barnes | c0864cb | 2011-08-03 09:22:56 -0700 | [diff] [blame] | 488 | |
Damien Lespiau | 5adaea7 | 2013-08-06 20:32:19 +0100 | [diff] [blame] | 489 | frame.spd.sdi = HDMI_SPD_SDI_PC; |
| 490 | |
Damien Lespiau | 9198ee5 | 2013-08-06 20:32:24 +0100 | [diff] [blame] | 491 | intel_write_infoframe(encoder, &frame); |
Jesse Barnes | c0864cb | 2011-08-03 09:22:56 -0700 | [diff] [blame] | 492 | } |
| 493 | |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 494 | static void |
| 495 | intel_hdmi_set_hdmi_infoframe(struct drm_encoder *encoder, |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 496 | const struct drm_display_mode *adjusted_mode) |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 497 | { |
| 498 | union hdmi_infoframe frame; |
| 499 | int ret; |
| 500 | |
| 501 | ret = drm_hdmi_vendor_infoframe_from_display_mode(&frame.vendor.hdmi, |
| 502 | adjusted_mode); |
| 503 | if (ret < 0) |
| 504 | return; |
| 505 | |
| 506 | intel_write_infoframe(encoder, &frame); |
| 507 | } |
| 508 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 509 | static void g4x_set_infoframes(struct drm_encoder *encoder, |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 510 | bool enable, |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 511 | const struct drm_display_mode *adjusted_mode) |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 512 | { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 513 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
Ville Syrjälä | 69fde0a | 2013-01-24 15:29:26 +0200 | [diff] [blame] | 514 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
| 515 | struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi; |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 516 | u32 reg = VIDEO_DIP_CTL; |
| 517 | u32 val = I915_READ(reg); |
Ville Syrjälä | 822cdc5 | 2014-01-23 23:15:34 +0200 | [diff] [blame] | 518 | u32 port = VIDEO_DIP_PORT(intel_dig_port->port); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 519 | |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 520 | assert_hdmi_port_disabled(intel_hdmi); |
| 521 | |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 522 | /* If the registers were not initialized yet, they might be zeroes, |
| 523 | * which means we're selecting the AVI DIP and we're setting its |
| 524 | * frequency to once. This seems to really confuse the HW and make |
| 525 | * things stop working (the register spec says the AVI always needs to |
| 526 | * be sent every VSync). So here we avoid writing to the register more |
| 527 | * than we need and also explicitly select the AVI DIP and explicitly |
| 528 | * set its frequency to every VSync. Avoiding to write it twice seems to |
| 529 | * be enough to solve the problem, but being defensive shouldn't hurt us |
| 530 | * either. */ |
| 531 | val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC; |
| 532 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 533 | if (!enable) { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 534 | if (!(val & VIDEO_DIP_ENABLE)) |
| 535 | return; |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 536 | if (port != (val & VIDEO_DIP_PORT_MASK)) { |
| 537 | DRM_DEBUG_KMS("video DIP still enabled on port %c\n", |
| 538 | (val & VIDEO_DIP_PORT_MASK) >> 29); |
| 539 | return; |
| 540 | } |
| 541 | val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI | |
| 542 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_SPD); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 543 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 544 | POSTING_READ(reg); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 545 | return; |
| 546 | } |
| 547 | |
Paulo Zanoni | 72b78c9 | 2012-05-28 16:42:54 -0300 | [diff] [blame] | 548 | if (port != (val & VIDEO_DIP_PORT_MASK)) { |
| 549 | if (val & VIDEO_DIP_ENABLE) { |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 550 | DRM_DEBUG_KMS("video DIP already enabled on port %c\n", |
| 551 | (val & VIDEO_DIP_PORT_MASK) >> 29); |
| 552 | return; |
Paulo Zanoni | 72b78c9 | 2012-05-28 16:42:54 -0300 | [diff] [blame] | 553 | } |
| 554 | val &= ~VIDEO_DIP_PORT_MASK; |
| 555 | val |= port; |
| 556 | } |
| 557 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 558 | val |= VIDEO_DIP_ENABLE; |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 559 | val &= ~(VIDEO_DIP_ENABLE_AVI | |
| 560 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_SPD); |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 561 | |
Paulo Zanoni | f278d97 | 2012-05-28 16:42:50 -0300 | [diff] [blame] | 562 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 563 | POSTING_READ(reg); |
Paulo Zanoni | f278d97 | 2012-05-28 16:42:50 -0300 | [diff] [blame] | 564 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 565 | intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); |
| 566 | intel_hdmi_set_spd_infoframe(encoder); |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 567 | intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode); |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 568 | } |
| 569 | |
Ville Syrjälä | 6d67415 | 2015-05-05 17:06:20 +0300 | [diff] [blame] | 570 | static bool hdmi_sink_is_deep_color(struct drm_encoder *encoder) |
| 571 | { |
| 572 | struct drm_device *dev = encoder->dev; |
| 573 | struct drm_connector *connector; |
| 574 | |
| 575 | WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); |
| 576 | |
| 577 | /* |
| 578 | * HDMI cloning is only supported on g4x which doesn't |
| 579 | * support deep color or GCP infoframes anyway so no |
| 580 | * need to worry about multiple HDMI sinks here. |
| 581 | */ |
| 582 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
| 583 | if (connector->encoder == encoder) |
| 584 | return connector->display_info.bpc > 8; |
| 585 | |
| 586 | return false; |
| 587 | } |
| 588 | |
Ville Syrjälä | 12aa329 | 2015-05-05 17:06:21 +0300 | [diff] [blame] | 589 | /* |
| 590 | * Determine if default_phase=1 can be indicated in the GCP infoframe. |
| 591 | * |
| 592 | * From HDMI specification 1.4a: |
| 593 | * - The first pixel of each Video Data Period shall always have a pixel packing phase of 0 |
| 594 | * - The first pixel following each Video Data Period shall have a pixel packing phase of 0 |
| 595 | * - The PP bits shall be constant for all GCPs and will be equal to the last packing phase |
| 596 | * - The first pixel following every transition of HSYNC or VSYNC shall have a pixel packing |
| 597 | * phase of 0 |
| 598 | */ |
| 599 | static bool gcp_default_phase_possible(int pipe_bpp, |
| 600 | const struct drm_display_mode *mode) |
| 601 | { |
| 602 | unsigned int pixels_per_group; |
| 603 | |
| 604 | switch (pipe_bpp) { |
| 605 | case 30: |
| 606 | /* 4 pixels in 5 clocks */ |
| 607 | pixels_per_group = 4; |
| 608 | break; |
| 609 | case 36: |
| 610 | /* 2 pixels in 3 clocks */ |
| 611 | pixels_per_group = 2; |
| 612 | break; |
| 613 | case 48: |
| 614 | /* 1 pixel in 2 clocks */ |
| 615 | pixels_per_group = 1; |
| 616 | break; |
| 617 | default: |
| 618 | /* phase information not relevant for 8bpc */ |
| 619 | return false; |
| 620 | } |
| 621 | |
| 622 | return mode->crtc_hdisplay % pixels_per_group == 0 && |
| 623 | mode->crtc_htotal % pixels_per_group == 0 && |
| 624 | mode->crtc_hblank_start % pixels_per_group == 0 && |
| 625 | mode->crtc_hblank_end % pixels_per_group == 0 && |
| 626 | mode->crtc_hsync_start % pixels_per_group == 0 && |
| 627 | mode->crtc_hsync_end % pixels_per_group == 0 && |
| 628 | ((mode->flags & DRM_MODE_FLAG_INTERLACE) == 0 || |
| 629 | mode->crtc_htotal/2 % pixels_per_group == 0); |
| 630 | } |
| 631 | |
Ville Syrjälä | 6d67415 | 2015-05-05 17:06:20 +0300 | [diff] [blame] | 632 | static bool intel_hdmi_set_gcp_infoframe(struct drm_encoder *encoder) |
| 633 | { |
| 634 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
| 635 | struct intel_crtc *crtc = to_intel_crtc(encoder->crtc); |
| 636 | u32 reg, val = 0; |
| 637 | |
| 638 | if (HAS_DDI(dev_priv)) |
| 639 | reg = HSW_TVIDEO_DIP_GCP(crtc->config->cpu_transcoder); |
| 640 | else if (IS_VALLEYVIEW(dev_priv)) |
| 641 | reg = VLV_TVIDEO_DIP_GCP(crtc->pipe); |
| 642 | else if (HAS_PCH_SPLIT(dev_priv->dev)) |
| 643 | reg = TVIDEO_DIP_GCP(crtc->pipe); |
| 644 | else |
| 645 | return false; |
| 646 | |
| 647 | /* Indicate color depth whenever the sink supports deep color */ |
| 648 | if (hdmi_sink_is_deep_color(encoder)) |
| 649 | val |= GCP_COLOR_INDICATION; |
| 650 | |
Ville Syrjälä | 12aa329 | 2015-05-05 17:06:21 +0300 | [diff] [blame] | 651 | /* Enable default_phase whenever the display mode is suitably aligned */ |
| 652 | if (gcp_default_phase_possible(crtc->config->pipe_bpp, |
| 653 | &crtc->config->base.adjusted_mode)) |
| 654 | val |= GCP_DEFAULT_PHASE_ENABLE; |
| 655 | |
Ville Syrjälä | 6d67415 | 2015-05-05 17:06:20 +0300 | [diff] [blame] | 656 | I915_WRITE(reg, val); |
| 657 | |
| 658 | return val != 0; |
| 659 | } |
| 660 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 661 | static void ibx_set_infoframes(struct drm_encoder *encoder, |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 662 | bool enable, |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 663 | const struct drm_display_mode *adjusted_mode) |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 664 | { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 665 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
| 666 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
Ville Syrjälä | 69fde0a | 2013-01-24 15:29:26 +0200 | [diff] [blame] | 667 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
| 668 | struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi; |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 669 | u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe); |
| 670 | u32 val = I915_READ(reg); |
Ville Syrjälä | 822cdc5 | 2014-01-23 23:15:34 +0200 | [diff] [blame] | 671 | u32 port = VIDEO_DIP_PORT(intel_dig_port->port); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 672 | |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 673 | assert_hdmi_port_disabled(intel_hdmi); |
| 674 | |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 675 | /* See the big comment in g4x_set_infoframes() */ |
| 676 | val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC; |
| 677 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 678 | if (!enable) { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 679 | if (!(val & VIDEO_DIP_ENABLE)) |
| 680 | return; |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 681 | val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI | |
| 682 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
| 683 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 684 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 685 | POSTING_READ(reg); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 686 | return; |
| 687 | } |
| 688 | |
Paulo Zanoni | 72b78c9 | 2012-05-28 16:42:54 -0300 | [diff] [blame] | 689 | if (port != (val & VIDEO_DIP_PORT_MASK)) { |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 690 | WARN(val & VIDEO_DIP_ENABLE, |
| 691 | "DIP already enabled on port %c\n", |
| 692 | (val & VIDEO_DIP_PORT_MASK) >> 29); |
Paulo Zanoni | 72b78c9 | 2012-05-28 16:42:54 -0300 | [diff] [blame] | 693 | val &= ~VIDEO_DIP_PORT_MASK; |
| 694 | val |= port; |
| 695 | } |
| 696 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 697 | val |= VIDEO_DIP_ENABLE; |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 698 | val &= ~(VIDEO_DIP_ENABLE_AVI | |
| 699 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
| 700 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 701 | |
Ville Syrjälä | 6d67415 | 2015-05-05 17:06:20 +0300 | [diff] [blame] | 702 | if (intel_hdmi_set_gcp_infoframe(encoder)) |
| 703 | val |= VIDEO_DIP_ENABLE_GCP; |
| 704 | |
Paulo Zanoni | f278d97 | 2012-05-28 16:42:50 -0300 | [diff] [blame] | 705 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 706 | POSTING_READ(reg); |
Paulo Zanoni | f278d97 | 2012-05-28 16:42:50 -0300 | [diff] [blame] | 707 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 708 | intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); |
| 709 | intel_hdmi_set_spd_infoframe(encoder); |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 710 | intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode); |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 711 | } |
| 712 | |
| 713 | static void cpt_set_infoframes(struct drm_encoder *encoder, |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 714 | bool enable, |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 715 | const struct drm_display_mode *adjusted_mode) |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 716 | { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 717 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
| 718 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
| 719 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
| 720 | u32 reg = TVIDEO_DIP_CTL(intel_crtc->pipe); |
| 721 | u32 val = I915_READ(reg); |
| 722 | |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 723 | assert_hdmi_port_disabled(intel_hdmi); |
| 724 | |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 725 | /* See the big comment in g4x_set_infoframes() */ |
| 726 | val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC; |
| 727 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 728 | if (!enable) { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 729 | if (!(val & VIDEO_DIP_ENABLE)) |
| 730 | return; |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 731 | val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI | |
| 732 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
| 733 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 734 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 735 | POSTING_READ(reg); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 736 | return; |
| 737 | } |
| 738 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 739 | /* Set both together, unset both together: see the spec. */ |
| 740 | val |= VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI; |
Paulo Zanoni | 0dd87d2 | 2012-05-28 16:42:53 -0300 | [diff] [blame] | 741 | val &= ~(VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 742 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 743 | |
Ville Syrjälä | 6d67415 | 2015-05-05 17:06:20 +0300 | [diff] [blame] | 744 | if (intel_hdmi_set_gcp_infoframe(encoder)) |
| 745 | val |= VIDEO_DIP_ENABLE_GCP; |
| 746 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 747 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 748 | POSTING_READ(reg); |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 749 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 750 | intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); |
| 751 | intel_hdmi_set_spd_infoframe(encoder); |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 752 | intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode); |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 753 | } |
| 754 | |
| 755 | static void vlv_set_infoframes(struct drm_encoder *encoder, |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 756 | bool enable, |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 757 | const struct drm_display_mode *adjusted_mode) |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 758 | { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 759 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
Jesse Barnes | 6a2b802 | 2014-04-02 10:08:51 -0700 | [diff] [blame] | 760 | struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 761 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
| 762 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
| 763 | u32 reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe); |
| 764 | u32 val = I915_READ(reg); |
Jesse Barnes | 6a2b802 | 2014-04-02 10:08:51 -0700 | [diff] [blame] | 765 | u32 port = VIDEO_DIP_PORT(intel_dig_port->port); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 766 | |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 767 | assert_hdmi_port_disabled(intel_hdmi); |
| 768 | |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 769 | /* See the big comment in g4x_set_infoframes() */ |
| 770 | val |= VIDEO_DIP_SELECT_AVI | VIDEO_DIP_FREQ_VSYNC; |
| 771 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 772 | if (!enable) { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 773 | if (!(val & VIDEO_DIP_ENABLE)) |
| 774 | return; |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 775 | val &= ~(VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI | |
| 776 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
| 777 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 778 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 779 | POSTING_READ(reg); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 780 | return; |
| 781 | } |
| 782 | |
Jesse Barnes | 6a2b802 | 2014-04-02 10:08:51 -0700 | [diff] [blame] | 783 | if (port != (val & VIDEO_DIP_PORT_MASK)) { |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 784 | WARN(val & VIDEO_DIP_ENABLE, |
| 785 | "DIP already enabled on port %c\n", |
| 786 | (val & VIDEO_DIP_PORT_MASK) >> 29); |
Jesse Barnes | 6a2b802 | 2014-04-02 10:08:51 -0700 | [diff] [blame] | 787 | val &= ~VIDEO_DIP_PORT_MASK; |
| 788 | val |= port; |
| 789 | } |
| 790 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 791 | val |= VIDEO_DIP_ENABLE; |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 792 | val &= ~(VIDEO_DIP_ENABLE_AVI | |
| 793 | VIDEO_DIP_ENABLE_VENDOR | VIDEO_DIP_ENABLE_GAMUT | |
| 794 | VIDEO_DIP_ENABLE_SPD | VIDEO_DIP_ENABLE_GCP); |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 795 | |
Ville Syrjälä | 6d67415 | 2015-05-05 17:06:20 +0300 | [diff] [blame] | 796 | if (intel_hdmi_set_gcp_infoframe(encoder)) |
| 797 | val |= VIDEO_DIP_ENABLE_GCP; |
| 798 | |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 799 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 800 | POSTING_READ(reg); |
Paulo Zanoni | 822974a | 2012-05-28 16:42:51 -0300 | [diff] [blame] | 801 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 802 | intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); |
| 803 | intel_hdmi_set_spd_infoframe(encoder); |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 804 | intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode); |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 805 | } |
| 806 | |
| 807 | static void hsw_set_infoframes(struct drm_encoder *encoder, |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 808 | bool enable, |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 809 | const struct drm_display_mode *adjusted_mode) |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 810 | { |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 811 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
| 812 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
| 813 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
Ander Conselvan de Oliveira | 6e3c971 | 2015-01-15 14:55:25 +0200 | [diff] [blame] | 814 | u32 reg = HSW_TVIDEO_DIP_CTL(intel_crtc->config->cpu_transcoder); |
Paulo Zanoni | 0dd87d2 | 2012-05-28 16:42:53 -0300 | [diff] [blame] | 815 | u32 val = I915_READ(reg); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 816 | |
Daniel Vetter | afba018 | 2012-06-12 16:36:45 +0200 | [diff] [blame] | 817 | assert_hdmi_port_disabled(intel_hdmi); |
| 818 | |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 819 | val &= ~(VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW | |
| 820 | VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW | |
| 821 | VIDEO_DIP_ENABLE_GMP_HSW | VIDEO_DIP_ENABLE_SPD_HSW); |
| 822 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 823 | if (!enable) { |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 824 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 825 | POSTING_READ(reg); |
Paulo Zanoni | 0c14c7f | 2012-05-28 16:42:49 -0300 | [diff] [blame] | 826 | return; |
| 827 | } |
| 828 | |
Ville Syrjälä | 6d67415 | 2015-05-05 17:06:20 +0300 | [diff] [blame] | 829 | if (intel_hdmi_set_gcp_infoframe(encoder)) |
| 830 | val |= VIDEO_DIP_ENABLE_GCP_HSW; |
| 831 | |
Paulo Zanoni | 0dd87d2 | 2012-05-28 16:42:53 -0300 | [diff] [blame] | 832 | I915_WRITE(reg, val); |
Paulo Zanoni | 9d9740f | 2012-05-28 16:43:00 -0300 | [diff] [blame] | 833 | POSTING_READ(reg); |
Paulo Zanoni | 0dd87d2 | 2012-05-28 16:42:53 -0300 | [diff] [blame] | 834 | |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 835 | intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); |
| 836 | intel_hdmi_set_spd_infoframe(encoder); |
Lespiau, Damien | c8bb75a | 2013-08-19 16:59:04 +0100 | [diff] [blame] | 837 | intel_hdmi_set_hdmi_infoframe(encoder, adjusted_mode); |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 838 | } |
| 839 | |
Daniel Vetter | 4cde8a2 | 2014-04-24 23:54:56 +0200 | [diff] [blame] | 840 | static void intel_hdmi_prepare(struct intel_encoder *encoder) |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 841 | { |
Daniel Vetter | c59423a | 2013-07-21 21:37:04 +0200 | [diff] [blame] | 842 | struct drm_device *dev = encoder->base.dev; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 843 | struct drm_i915_private *dev_priv = dev->dev_private; |
Daniel Vetter | c59423a | 2013-07-21 21:37:04 +0200 | [diff] [blame] | 844 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
| 845 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 846 | const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode; |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 847 | u32 hdmi_val; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 848 | |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 849 | hdmi_val = SDVO_ENCODING_HDMI; |
Ville Syrjälä | 0f2a2a7 | 2015-07-06 15:10:00 +0300 | [diff] [blame] | 850 | if (!HAS_PCH_SPLIT(dev) && crtc->config->limited_color_range) |
| 851 | hdmi_val |= HDMI_COLOR_RANGE_16_235; |
Adam Jackson | b599c0b | 2010-07-16 14:46:31 -0400 | [diff] [blame] | 852 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 853 | hdmi_val |= SDVO_VSYNC_ACTIVE_HIGH; |
Adam Jackson | b599c0b | 2010-07-16 14:46:31 -0400 | [diff] [blame] | 854 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 855 | hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 856 | |
Ander Conselvan de Oliveira | 6e3c971 | 2015-01-15 14:55:25 +0200 | [diff] [blame] | 857 | if (crtc->config->pipe_bpp > 24) |
Paulo Zanoni | 4f3a8bc | 2013-02-19 16:21:47 -0300 | [diff] [blame] | 858 | hdmi_val |= HDMI_COLOR_FORMAT_12bpc; |
Jesse Barnes | 020f670 | 2011-06-24 12:19:25 -0700 | [diff] [blame] | 859 | else |
Paulo Zanoni | 4f3a8bc | 2013-02-19 16:21:47 -0300 | [diff] [blame] | 860 | hdmi_val |= SDVO_COLOR_FORMAT_8bpc; |
Jesse Barnes | 020f670 | 2011-06-24 12:19:25 -0700 | [diff] [blame] | 861 | |
Ander Conselvan de Oliveira | 6e3c971 | 2015-01-15 14:55:25 +0200 | [diff] [blame] | 862 | if (crtc->config->has_hdmi_sink) |
Paulo Zanoni | dc0fa71 | 2013-02-19 16:21:46 -0300 | [diff] [blame] | 863 | hdmi_val |= HDMI_MODE_SELECT_HDMI; |
Zhenyu Wang | 2e3d600 | 2010-09-10 10:39:40 +0800 | [diff] [blame] | 864 | |
Jesse Barnes | 7577056 | 2011-10-12 09:01:58 -0700 | [diff] [blame] | 865 | if (HAS_PCH_CPT(dev)) |
Daniel Vetter | c59423a | 2013-07-21 21:37:04 +0200 | [diff] [blame] | 866 | hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe); |
Chon Ming Lee | 44f37d1 | 2014-04-09 13:28:21 +0300 | [diff] [blame] | 867 | else if (IS_CHERRYVIEW(dev)) |
| 868 | hdmi_val |= SDVO_PIPE_SEL_CHV(crtc->pipe); |
Paulo Zanoni | dc0fa71 | 2013-02-19 16:21:46 -0300 | [diff] [blame] | 869 | else |
Daniel Vetter | c59423a | 2013-07-21 21:37:04 +0200 | [diff] [blame] | 870 | hdmi_val |= SDVO_PIPE_SEL(crtc->pipe); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 871 | |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 872 | I915_WRITE(intel_hdmi->hdmi_reg, hdmi_val); |
| 873 | POSTING_READ(intel_hdmi->hdmi_reg); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 874 | } |
| 875 | |
Daniel Vetter | 85234cd | 2012-07-02 13:27:29 +0200 | [diff] [blame] | 876 | static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder, |
| 877 | enum pipe *pipe) |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 878 | { |
Daniel Vetter | 85234cd | 2012-07-02 13:27:29 +0200 | [diff] [blame] | 879 | struct drm_device *dev = encoder->base.dev; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 880 | struct drm_i915_private *dev_priv = dev->dev_private; |
Daniel Vetter | 85234cd | 2012-07-02 13:27:29 +0200 | [diff] [blame] | 881 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
Imre Deak | 6d129be | 2014-03-05 16:20:54 +0200 | [diff] [blame] | 882 | enum intel_display_power_domain power_domain; |
Daniel Vetter | 85234cd | 2012-07-02 13:27:29 +0200 | [diff] [blame] | 883 | u32 tmp; |
| 884 | |
Imre Deak | 6d129be | 2014-03-05 16:20:54 +0200 | [diff] [blame] | 885 | power_domain = intel_display_port_power_domain(encoder); |
Daniel Vetter | f458ebb | 2014-09-30 10:56:39 +0200 | [diff] [blame] | 886 | if (!intel_display_power_is_enabled(dev_priv, power_domain)) |
Imre Deak | 6d129be | 2014-03-05 16:20:54 +0200 | [diff] [blame] | 887 | return false; |
| 888 | |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 889 | tmp = I915_READ(intel_hdmi->hdmi_reg); |
Daniel Vetter | 85234cd | 2012-07-02 13:27:29 +0200 | [diff] [blame] | 890 | |
| 891 | if (!(tmp & SDVO_ENABLE)) |
| 892 | return false; |
| 893 | |
| 894 | if (HAS_PCH_CPT(dev)) |
| 895 | *pipe = PORT_TO_PIPE_CPT(tmp); |
Ville Syrjälä | 71485e0 | 2014-04-09 13:28:55 +0300 | [diff] [blame] | 896 | else if (IS_CHERRYVIEW(dev)) |
| 897 | *pipe = SDVO_PORT_TO_PIPE_CHV(tmp); |
Daniel Vetter | 85234cd | 2012-07-02 13:27:29 +0200 | [diff] [blame] | 898 | else |
| 899 | *pipe = PORT_TO_PIPE(tmp); |
| 900 | |
| 901 | return true; |
| 902 | } |
| 903 | |
Jesse Barnes | 045ac3b | 2013-05-14 17:08:26 -0700 | [diff] [blame] | 904 | static void intel_hdmi_get_config(struct intel_encoder *encoder, |
Ander Conselvan de Oliveira | 5cec258 | 2015-01-15 14:55:21 +0200 | [diff] [blame] | 905 | struct intel_crtc_state *pipe_config) |
Jesse Barnes | 045ac3b | 2013-05-14 17:08:26 -0700 | [diff] [blame] | 906 | { |
| 907 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
Ville Syrjälä | 8c875fc | 2014-09-12 15:46:29 +0300 | [diff] [blame] | 908 | struct drm_device *dev = encoder->base.dev; |
| 909 | struct drm_i915_private *dev_priv = dev->dev_private; |
Jesse Barnes | 045ac3b | 2013-05-14 17:08:26 -0700 | [diff] [blame] | 910 | u32 tmp, flags = 0; |
Ville Syrjälä | 18442d0 | 2013-09-13 16:00:08 +0300 | [diff] [blame] | 911 | int dotclock; |
Jesse Barnes | 045ac3b | 2013-05-14 17:08:26 -0700 | [diff] [blame] | 912 | |
| 913 | tmp = I915_READ(intel_hdmi->hdmi_reg); |
| 914 | |
| 915 | if (tmp & SDVO_HSYNC_ACTIVE_HIGH) |
| 916 | flags |= DRM_MODE_FLAG_PHSYNC; |
| 917 | else |
| 918 | flags |= DRM_MODE_FLAG_NHSYNC; |
| 919 | |
| 920 | if (tmp & SDVO_VSYNC_ACTIVE_HIGH) |
| 921 | flags |= DRM_MODE_FLAG_PVSYNC; |
| 922 | else |
| 923 | flags |= DRM_MODE_FLAG_NVSYNC; |
| 924 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 925 | if (tmp & HDMI_MODE_SELECT_HDMI) |
| 926 | pipe_config->has_hdmi_sink = true; |
| 927 | |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 928 | if (intel_hdmi->infoframe_enabled(&encoder->base)) |
| 929 | pipe_config->has_infoframe = true; |
| 930 | |
Jani Nikula | c84db77 | 2014-09-17 15:34:58 +0300 | [diff] [blame] | 931 | if (tmp & SDVO_AUDIO_ENABLE) |
Daniel Vetter | 9ed109a | 2014-04-24 23:54:52 +0200 | [diff] [blame] | 932 | pipe_config->has_audio = true; |
| 933 | |
Ville Syrjälä | 8c875fc | 2014-09-12 15:46:29 +0300 | [diff] [blame] | 934 | if (!HAS_PCH_SPLIT(dev) && |
| 935 | tmp & HDMI_COLOR_RANGE_16_235) |
| 936 | pipe_config->limited_color_range = true; |
| 937 | |
Ander Conselvan de Oliveira | 2d112de | 2015-01-15 14:55:22 +0200 | [diff] [blame] | 938 | pipe_config->base.adjusted_mode.flags |= flags; |
Ville Syrjälä | 18442d0 | 2013-09-13 16:00:08 +0300 | [diff] [blame] | 939 | |
| 940 | if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) |
| 941 | dotclock = pipe_config->port_clock * 2 / 3; |
| 942 | else |
| 943 | dotclock = pipe_config->port_clock; |
| 944 | |
Ville Syrjälä | be69a13 | 2015-05-05 17:06:26 +0300 | [diff] [blame] | 945 | if (pipe_config->pixel_multiplier) |
| 946 | dotclock /= pipe_config->pixel_multiplier; |
| 947 | |
Ville Syrjälä | 18442d0 | 2013-09-13 16:00:08 +0300 | [diff] [blame] | 948 | if (HAS_PCH_SPLIT(dev_priv->dev)) |
| 949 | ironlake_check_encoder_dotclock(pipe_config, dotclock); |
| 950 | |
Ander Conselvan de Oliveira | 2d112de | 2015-01-15 14:55:22 +0200 | [diff] [blame] | 951 | pipe_config->base.adjusted_mode.crtc_clock = dotclock; |
Jesse Barnes | 045ac3b | 2013-05-14 17:08:26 -0700 | [diff] [blame] | 952 | } |
| 953 | |
Ville Syrjälä | d1b1589 | 2015-05-05 17:06:19 +0300 | [diff] [blame] | 954 | static void intel_enable_hdmi_audio(struct intel_encoder *encoder) |
| 955 | { |
| 956 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
| 957 | |
| 958 | WARN_ON(!crtc->config->has_hdmi_sink); |
| 959 | DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n", |
| 960 | pipe_name(crtc->pipe)); |
| 961 | intel_audio_codec_enable(encoder); |
| 962 | } |
| 963 | |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 964 | static void g4x_enable_hdmi(struct intel_encoder *encoder) |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 965 | { |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 966 | struct drm_device *dev = encoder->base.dev; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 967 | struct drm_i915_private *dev_priv = dev->dev_private; |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 968 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 969 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 970 | u32 temp; |
| 971 | |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 972 | temp = I915_READ(intel_hdmi->hdmi_reg); |
Zhenyu Wang | d8a2d0e | 2009-11-02 07:52:30 +0000 | [diff] [blame] | 973 | |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 974 | temp |= SDVO_ENABLE; |
| 975 | if (crtc->config->has_audio) |
| 976 | temp |= SDVO_AUDIO_ENABLE; |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 977 | |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 978 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 979 | POSTING_READ(intel_hdmi->hdmi_reg); |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 980 | |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 981 | if (crtc->config->has_audio) |
| 982 | intel_enable_hdmi_audio(encoder); |
| 983 | } |
| 984 | |
| 985 | static void ibx_enable_hdmi(struct intel_encoder *encoder) |
| 986 | { |
| 987 | struct drm_device *dev = encoder->base.dev; |
| 988 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 989 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
| 990 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
| 991 | u32 temp; |
| 992 | |
| 993 | temp = I915_READ(intel_hdmi->hdmi_reg); |
| 994 | |
| 995 | temp |= SDVO_ENABLE; |
| 996 | if (crtc->config->has_audio) |
| 997 | temp |= SDVO_AUDIO_ENABLE; |
| 998 | |
| 999 | /* |
| 1000 | * HW workaround, need to write this twice for issue |
| 1001 | * that may result in first write getting masked. |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 1002 | */ |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 1003 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1004 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 1005 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1006 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 1007 | |
| 1008 | /* |
| 1009 | * HW workaround, need to toggle enable bit off and on |
| 1010 | * for 12bpc with pixel repeat. |
| 1011 | * |
| 1012 | * FIXME: BSpec says this should be done at the end of |
| 1013 | * of the modeset sequence, so not sure if this isn't too soon. |
| 1014 | */ |
| 1015 | if (crtc->config->pipe_bpp > 24 && |
| 1016 | crtc->config->pixel_multiplier > 1) { |
| 1017 | I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE); |
| 1018 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 1019 | |
| 1020 | /* |
| 1021 | * HW workaround, need to write this twice for issue |
| 1022 | * that may result in first write getting masked. |
| 1023 | */ |
| 1024 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1025 | POSTING_READ(intel_hdmi->hdmi_reg); |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 1026 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1027 | POSTING_READ(intel_hdmi->hdmi_reg); |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 1028 | } |
Jani Nikula | c1dec79 | 2014-10-27 16:26:56 +0200 | [diff] [blame] | 1029 | |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 1030 | if (crtc->config->has_audio) |
Ville Syrjälä | d1b1589 | 2015-05-05 17:06:19 +0300 | [diff] [blame] | 1031 | intel_enable_hdmi_audio(encoder); |
| 1032 | } |
| 1033 | |
| 1034 | static void cpt_enable_hdmi(struct intel_encoder *encoder) |
| 1035 | { |
| 1036 | struct drm_device *dev = encoder->base.dev; |
| 1037 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1038 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
| 1039 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
| 1040 | enum pipe pipe = crtc->pipe; |
| 1041 | u32 temp; |
| 1042 | |
| 1043 | temp = I915_READ(intel_hdmi->hdmi_reg); |
| 1044 | |
| 1045 | temp |= SDVO_ENABLE; |
| 1046 | if (crtc->config->has_audio) |
| 1047 | temp |= SDVO_AUDIO_ENABLE; |
| 1048 | |
| 1049 | /* |
| 1050 | * WaEnableHDMI8bpcBefore12bpc:snb,ivb |
| 1051 | * |
| 1052 | * The procedure for 12bpc is as follows: |
| 1053 | * 1. disable HDMI clock gating |
| 1054 | * 2. enable HDMI with 8bpc |
| 1055 | * 3. enable HDMI with 12bpc |
| 1056 | * 4. enable HDMI clock gating |
| 1057 | */ |
| 1058 | |
| 1059 | if (crtc->config->pipe_bpp > 24) { |
| 1060 | I915_WRITE(TRANS_CHICKEN1(pipe), |
| 1061 | I915_READ(TRANS_CHICKEN1(pipe)) | |
| 1062 | TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE); |
| 1063 | |
| 1064 | temp &= ~SDVO_COLOR_FORMAT_MASK; |
| 1065 | temp |= SDVO_COLOR_FORMAT_8bpc; |
Jani Nikula | c1dec79 | 2014-10-27 16:26:56 +0200 | [diff] [blame] | 1066 | } |
Ville Syrjälä | d1b1589 | 2015-05-05 17:06:19 +0300 | [diff] [blame] | 1067 | |
| 1068 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1069 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 1070 | |
| 1071 | if (crtc->config->pipe_bpp > 24) { |
| 1072 | temp &= ~SDVO_COLOR_FORMAT_MASK; |
| 1073 | temp |= HDMI_COLOR_FORMAT_12bpc; |
| 1074 | |
| 1075 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1076 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 1077 | |
| 1078 | I915_WRITE(TRANS_CHICKEN1(pipe), |
| 1079 | I915_READ(TRANS_CHICKEN1(pipe)) & |
| 1080 | ~TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE); |
| 1081 | } |
| 1082 | |
| 1083 | if (crtc->config->has_audio) |
| 1084 | intel_enable_hdmi_audio(encoder); |
Jani Nikula | b76cf76 | 2013-07-30 12:20:31 +0300 | [diff] [blame] | 1085 | } |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1086 | |
Jani Nikula | b76cf76 | 2013-07-30 12:20:31 +0300 | [diff] [blame] | 1087 | static void vlv_enable_hdmi(struct intel_encoder *encoder) |
| 1088 | { |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 1089 | } |
| 1090 | |
| 1091 | static void intel_disable_hdmi(struct intel_encoder *encoder) |
| 1092 | { |
| 1093 | struct drm_device *dev = encoder->base.dev; |
| 1094 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1095 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
Jani Nikula | 495a5bb | 2014-10-27 16:26:55 +0200 | [diff] [blame] | 1096 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 1097 | u32 temp; |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 1098 | |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 1099 | temp = I915_READ(intel_hdmi->hdmi_reg); |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 1100 | |
Ville Syrjälä | 1612c8b | 2015-05-05 17:17:34 +0300 | [diff] [blame] | 1101 | temp &= ~(SDVO_ENABLE | SDVO_AUDIO_ENABLE); |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 1102 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1103 | POSTING_READ(intel_hdmi->hdmi_reg); |
Ville Syrjälä | 1612c8b | 2015-05-05 17:17:34 +0300 | [diff] [blame] | 1104 | |
| 1105 | /* |
| 1106 | * HW workaround for IBX, we need to move the port |
| 1107 | * to transcoder A after disabling it to allow the |
| 1108 | * matching DP port to be enabled on transcoder A. |
| 1109 | */ |
| 1110 | if (HAS_PCH_IBX(dev) && crtc->pipe == PIPE_B) { |
| 1111 | temp &= ~SDVO_PIPE_B_SELECT; |
| 1112 | temp |= SDVO_ENABLE; |
| 1113 | /* |
| 1114 | * HW workaround, need to write this twice for issue |
| 1115 | * that may result in first write getting masked. |
| 1116 | */ |
| 1117 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1118 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 1119 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1120 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 1121 | |
| 1122 | temp &= ~SDVO_ENABLE; |
| 1123 | I915_WRITE(intel_hdmi->hdmi_reg, temp); |
| 1124 | POSTING_READ(intel_hdmi->hdmi_reg); |
| 1125 | } |
Ville Syrjälä | 6d67415 | 2015-05-05 17:06:20 +0300 | [diff] [blame] | 1126 | |
Ville Syrjälä | 0be6f0c | 2015-05-05 17:06:24 +0300 | [diff] [blame] | 1127 | intel_hdmi->set_infoframes(&encoder->base, false, NULL); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1128 | } |
| 1129 | |
Ville Syrjälä | a4790ce | 2015-05-05 17:17:35 +0300 | [diff] [blame] | 1130 | static void g4x_disable_hdmi(struct intel_encoder *encoder) |
| 1131 | { |
| 1132 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
| 1133 | |
| 1134 | if (crtc->config->has_audio) |
| 1135 | intel_audio_codec_disable(encoder); |
| 1136 | |
| 1137 | intel_disable_hdmi(encoder); |
| 1138 | } |
| 1139 | |
| 1140 | static void pch_disable_hdmi(struct intel_encoder *encoder) |
| 1141 | { |
| 1142 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
| 1143 | |
| 1144 | if (crtc->config->has_audio) |
| 1145 | intel_audio_codec_disable(encoder); |
| 1146 | } |
| 1147 | |
| 1148 | static void pch_post_disable_hdmi(struct intel_encoder *encoder) |
| 1149 | { |
| 1150 | intel_disable_hdmi(encoder); |
| 1151 | } |
| 1152 | |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1153 | static int hdmi_port_clock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit) |
Daniel Vetter | 7d148ef | 2013-07-22 18:02:39 +0200 | [diff] [blame] | 1154 | { |
| 1155 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
| 1156 | |
Ville Syrjälä | 4047845 | 2014-03-27 11:08:45 +0200 | [diff] [blame] | 1157 | if ((respect_dvi_limit && !hdmi->has_hdmi_sink) || IS_G4X(dev)) |
Daniel Vetter | 7d148ef | 2013-07-22 18:02:39 +0200 | [diff] [blame] | 1158 | return 165000; |
Damien Lespiau | e3c3357 | 2013-11-02 21:07:51 -0700 | [diff] [blame] | 1159 | else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) |
Daniel Vetter | 7d148ef | 2013-07-22 18:02:39 +0200 | [diff] [blame] | 1160 | return 300000; |
| 1161 | else |
| 1162 | return 225000; |
| 1163 | } |
| 1164 | |
Damien Lespiau | c19de8e | 2013-11-28 15:29:18 +0000 | [diff] [blame] | 1165 | static enum drm_mode_status |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1166 | hdmi_port_clock_valid(struct intel_hdmi *hdmi, |
| 1167 | int clock, bool respect_dvi_limit) |
| 1168 | { |
| 1169 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
| 1170 | |
| 1171 | if (clock < 25000) |
| 1172 | return MODE_CLOCK_LOW; |
| 1173 | if (clock > hdmi_port_clock_limit(hdmi, respect_dvi_limit)) |
| 1174 | return MODE_CLOCK_HIGH; |
| 1175 | |
Ville Syrjälä | 5e6ccc0 | 2015-07-06 14:44:11 +0300 | [diff] [blame] | 1176 | /* BXT DPLL can't generate 223-240 MHz */ |
| 1177 | if (IS_BROXTON(dev) && clock > 223333 && clock < 240000) |
| 1178 | return MODE_CLOCK_RANGE; |
| 1179 | |
| 1180 | /* CHV DPLL can't generate 216-240 MHz */ |
| 1181 | if (IS_CHERRYVIEW(dev) && clock > 216000 && clock < 240000) |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1182 | return MODE_CLOCK_RANGE; |
| 1183 | |
| 1184 | return MODE_OK; |
| 1185 | } |
| 1186 | |
| 1187 | static enum drm_mode_status |
Damien Lespiau | c19de8e | 2013-11-28 15:29:18 +0000 | [diff] [blame] | 1188 | intel_hdmi_mode_valid(struct drm_connector *connector, |
| 1189 | struct drm_display_mode *mode) |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1190 | { |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1191 | struct intel_hdmi *hdmi = intel_attached_hdmi(connector); |
| 1192 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
| 1193 | enum drm_mode_status status; |
| 1194 | int clock; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1195 | |
| 1196 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) |
| 1197 | return MODE_NO_DBLESCAN; |
| 1198 | |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1199 | clock = mode->clock; |
| 1200 | if (mode->flags & DRM_MODE_FLAG_DBLCLK) |
| 1201 | clock *= 2; |
| 1202 | |
| 1203 | /* check if we can do 8bpc */ |
| 1204 | status = hdmi_port_clock_valid(hdmi, clock, true); |
| 1205 | |
| 1206 | /* if we can't do 8bpc we may still be able to do 12bpc */ |
| 1207 | if (!HAS_GMCH_DISPLAY(dev) && status != MODE_OK) |
| 1208 | status = hdmi_port_clock_valid(hdmi, clock * 3 / 2, true); |
| 1209 | |
| 1210 | return status; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1211 | } |
| 1212 | |
Ander Conselvan de Oliveira | 77f06c8 | 2015-03-20 16:18:11 +0200 | [diff] [blame] | 1213 | static bool hdmi_12bpc_possible(struct intel_crtc_state *crtc_state) |
Ville Syrjälä | 7180063 | 2014-03-03 16:15:29 +0200 | [diff] [blame] | 1214 | { |
Ander Conselvan de Oliveira | 77f06c8 | 2015-03-20 16:18:11 +0200 | [diff] [blame] | 1215 | struct drm_device *dev = crtc_state->base.crtc->dev; |
| 1216 | struct drm_atomic_state *state; |
Ville Syrjälä | 7180063 | 2014-03-03 16:15:29 +0200 | [diff] [blame] | 1217 | struct intel_encoder *encoder; |
Ander Conselvan de Oliveira | da3ced298 | 2015-04-21 17:12:59 +0300 | [diff] [blame] | 1218 | struct drm_connector *connector; |
Ander Conselvan de Oliveira | 77f06c8 | 2015-03-20 16:18:11 +0200 | [diff] [blame] | 1219 | struct drm_connector_state *connector_state; |
Ville Syrjälä | 7180063 | 2014-03-03 16:15:29 +0200 | [diff] [blame] | 1220 | int count = 0, count_hdmi = 0; |
Ander Conselvan de Oliveira | 77f06c8 | 2015-03-20 16:18:11 +0200 | [diff] [blame] | 1221 | int i; |
Ville Syrjälä | 7180063 | 2014-03-03 16:15:29 +0200 | [diff] [blame] | 1222 | |
Sonika Jindal | f227ae9 | 2014-07-21 15:23:45 +0530 | [diff] [blame] | 1223 | if (HAS_GMCH_DISPLAY(dev)) |
Ville Syrjälä | 7180063 | 2014-03-03 16:15:29 +0200 | [diff] [blame] | 1224 | return false; |
| 1225 | |
Ander Conselvan de Oliveira | 77f06c8 | 2015-03-20 16:18:11 +0200 | [diff] [blame] | 1226 | state = crtc_state->base.state; |
| 1227 | |
Ander Conselvan de Oliveira | da3ced298 | 2015-04-21 17:12:59 +0300 | [diff] [blame] | 1228 | for_each_connector_in_state(state, connector, connector_state, i) { |
Ander Conselvan de Oliveira | 77f06c8 | 2015-03-20 16:18:11 +0200 | [diff] [blame] | 1229 | if (connector_state->crtc != crtc_state->base.crtc) |
| 1230 | continue; |
| 1231 | |
| 1232 | encoder = to_intel_encoder(connector_state->best_encoder); |
| 1233 | |
Ville Syrjälä | 7180063 | 2014-03-03 16:15:29 +0200 | [diff] [blame] | 1234 | count_hdmi += encoder->type == INTEL_OUTPUT_HDMI; |
| 1235 | count++; |
| 1236 | } |
| 1237 | |
| 1238 | /* |
| 1239 | * HDMI 12bpc affects the clocks, so it's only possible |
| 1240 | * when not cloning with other encoder types. |
| 1241 | */ |
| 1242 | return count_hdmi > 0 && count_hdmi == count; |
| 1243 | } |
| 1244 | |
Daniel Vetter | 5bfe2ac | 2013-03-27 00:44:55 +0100 | [diff] [blame] | 1245 | bool intel_hdmi_compute_config(struct intel_encoder *encoder, |
Ander Conselvan de Oliveira | 5cec258 | 2015-01-15 14:55:21 +0200 | [diff] [blame] | 1246 | struct intel_crtc_state *pipe_config) |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1247 | { |
Daniel Vetter | 5bfe2ac | 2013-03-27 00:44:55 +0100 | [diff] [blame] | 1248 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
| 1249 | struct drm_device *dev = encoder->base.dev; |
Ander Conselvan de Oliveira | 2d112de | 2015-01-15 14:55:22 +0200 | [diff] [blame] | 1250 | struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1251 | int clock_8bpc = pipe_config->base.adjusted_mode.crtc_clock; |
| 1252 | int clock_12bpc = clock_8bpc * 3 / 2; |
Daniel Vetter | e29c22c | 2013-02-21 00:00:16 +0100 | [diff] [blame] | 1253 | int desired_bpp; |
Ville Syrjälä | 3685a8f | 2013-01-17 16:31:28 +0200 | [diff] [blame] | 1254 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 1255 | pipe_config->has_hdmi_sink = intel_hdmi->has_hdmi_sink; |
| 1256 | |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 1257 | if (pipe_config->has_hdmi_sink) |
| 1258 | pipe_config->has_infoframe = true; |
| 1259 | |
Ville Syrjälä | 55bc60d | 2013-01-17 16:31:29 +0200 | [diff] [blame] | 1260 | if (intel_hdmi->color_range_auto) { |
| 1261 | /* See CEA-861-E - 5.1 Default Encoding Parameters */ |
Ville Syrjälä | 0f2a2a7 | 2015-07-06 15:10:00 +0300 | [diff] [blame] | 1262 | pipe_config->limited_color_range = |
| 1263 | pipe_config->has_hdmi_sink && |
| 1264 | drm_match_cea_mode(adjusted_mode) > 1; |
| 1265 | } else { |
| 1266 | pipe_config->limited_color_range = |
| 1267 | intel_hdmi->limited_color_range; |
Ville Syrjälä | 55bc60d | 2013-01-17 16:31:29 +0200 | [diff] [blame] | 1268 | } |
| 1269 | |
Clint Taylor | 697c407 | 2014-09-02 17:03:36 -0700 | [diff] [blame] | 1270 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) { |
| 1271 | pipe_config->pixel_multiplier = 2; |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1272 | clock_8bpc *= 2; |
Ville Syrjälä | 3320e37 | 2015-05-05 17:06:27 +0300 | [diff] [blame] | 1273 | clock_12bpc *= 2; |
Clint Taylor | 697c407 | 2014-09-02 17:03:36 -0700 | [diff] [blame] | 1274 | } |
| 1275 | |
Daniel Vetter | 5bfe2ac | 2013-03-27 00:44:55 +0100 | [diff] [blame] | 1276 | if (HAS_PCH_SPLIT(dev) && !HAS_DDI(dev)) |
| 1277 | pipe_config->has_pch_encoder = true; |
| 1278 | |
Daniel Vetter | 9ed109a | 2014-04-24 23:54:52 +0200 | [diff] [blame] | 1279 | if (pipe_config->has_hdmi_sink && intel_hdmi->has_audio) |
| 1280 | pipe_config->has_audio = true; |
| 1281 | |
Daniel Vetter | 4e53c2e | 2013-03-27 00:44:58 +0100 | [diff] [blame] | 1282 | /* |
| 1283 | * HDMI is either 12 or 8, so if the display lets 10bpc sneak |
| 1284 | * through, clamp it down. Note that g4x/vlv don't support 12bpc hdmi |
Daniel Vetter | 325b9d0 | 2013-04-19 11:24:33 +0200 | [diff] [blame] | 1285 | * outputs. We also need to check that the higher clock still fits |
| 1286 | * within limits. |
Daniel Vetter | 4e53c2e | 2013-03-27 00:44:58 +0100 | [diff] [blame] | 1287 | */ |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 1288 | if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink && |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1289 | hdmi_port_clock_valid(intel_hdmi, clock_12bpc, false) == MODE_OK && |
Ville Syrjälä | 7a0baa6 | 2015-06-30 15:33:54 +0300 | [diff] [blame] | 1290 | hdmi_12bpc_possible(pipe_config)) { |
Daniel Vetter | e29c22c | 2013-02-21 00:00:16 +0100 | [diff] [blame] | 1291 | DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n"); |
| 1292 | desired_bpp = 12*3; |
Daniel Vetter | 325b9d0 | 2013-04-19 11:24:33 +0200 | [diff] [blame] | 1293 | |
| 1294 | /* Need to adjust the port link by 1.5x for 12bpc. */ |
Daniel Vetter | ff9a675 | 2013-06-01 17:16:21 +0200 | [diff] [blame] | 1295 | pipe_config->port_clock = clock_12bpc; |
Daniel Vetter | 4e53c2e | 2013-03-27 00:44:58 +0100 | [diff] [blame] | 1296 | } else { |
Daniel Vetter | e29c22c | 2013-02-21 00:00:16 +0100 | [diff] [blame] | 1297 | DRM_DEBUG_KMS("picking bpc to 8 for HDMI output\n"); |
| 1298 | desired_bpp = 8*3; |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1299 | |
| 1300 | pipe_config->port_clock = clock_8bpc; |
Daniel Vetter | e29c22c | 2013-02-21 00:00:16 +0100 | [diff] [blame] | 1301 | } |
| 1302 | |
| 1303 | if (!pipe_config->bw_constrained) { |
| 1304 | DRM_DEBUG_KMS("forcing pipe bpc to %i for HDMI\n", desired_bpp); |
| 1305 | pipe_config->pipe_bpp = desired_bpp; |
Daniel Vetter | 4e53c2e | 2013-03-27 00:44:58 +0100 | [diff] [blame] | 1306 | } |
| 1307 | |
Ville Syrjälä | e64e739 | 2015-06-30 19:23:59 +0300 | [diff] [blame] | 1308 | if (hdmi_port_clock_valid(intel_hdmi, pipe_config->port_clock, |
| 1309 | false) != MODE_OK) { |
| 1310 | DRM_DEBUG_KMS("unsupported HDMI clock, rejecting mode\n"); |
Daniel Vetter | 325b9d0 | 2013-04-19 11:24:33 +0200 | [diff] [blame] | 1311 | return false; |
| 1312 | } |
| 1313 | |
Ville Syrjälä | 28b468a | 2015-09-08 13:40:48 +0300 | [diff] [blame] | 1314 | /* Set user selected PAR to incoming mode's member */ |
| 1315 | adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio; |
| 1316 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1317 | return true; |
| 1318 | } |
| 1319 | |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1320 | static void |
| 1321 | intel_hdmi_unset_edid(struct drm_connector *connector) |
Ma Ling | 9dff6af | 2009-04-02 13:13:26 +0800 | [diff] [blame] | 1322 | { |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 1323 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
Imre Deak | 671dedd | 2014-03-05 16:20:53 +0200 | [diff] [blame] | 1324 | |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 1325 | intel_hdmi->has_hdmi_sink = false; |
Zhenyu Wang | 2e3d600 | 2010-09-10 10:39:40 +0800 | [diff] [blame] | 1326 | intel_hdmi->has_audio = false; |
Ville Syrjälä | abedc07 | 2013-01-17 16:31:31 +0200 | [diff] [blame] | 1327 | intel_hdmi->rgb_quant_range_selectable = false; |
ling.ma@intel.com | 2ded9e274 | 2009-07-16 17:23:09 +0800 | [diff] [blame] | 1328 | |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1329 | kfree(to_intel_connector(connector)->detect_edid); |
| 1330 | to_intel_connector(connector)->detect_edid = NULL; |
Ma Ling | 9dff6af | 2009-04-02 13:13:26 +0800 | [diff] [blame] | 1331 | } |
| 1332 | |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1333 | static bool |
Sonika Jindal | 237ed86 | 2015-09-15 09:44:20 +0530 | [diff] [blame] | 1334 | intel_hdmi_set_edid(struct drm_connector *connector, bool force) |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1335 | { |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1336 | struct drm_i915_private *dev_priv = to_i915(connector->dev); |
| 1337 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
| 1338 | struct intel_encoder *intel_encoder = |
| 1339 | &hdmi_to_dig_port(intel_hdmi)->base; |
Imre Deak | 671dedd | 2014-03-05 16:20:53 +0200 | [diff] [blame] | 1340 | enum intel_display_power_domain power_domain; |
Sonika Jindal | 237ed86 | 2015-09-15 09:44:20 +0530 | [diff] [blame] | 1341 | struct edid *edid = NULL; |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1342 | bool connected = false; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1343 | |
Imre Deak | 671dedd | 2014-03-05 16:20:53 +0200 | [diff] [blame] | 1344 | power_domain = intel_display_port_power_domain(intel_encoder); |
| 1345 | intel_display_power_get(dev_priv, power_domain); |
| 1346 | |
Sonika Jindal | 237ed86 | 2015-09-15 09:44:20 +0530 | [diff] [blame] | 1347 | if (force) |
| 1348 | edid = drm_get_edid(connector, |
| 1349 | intel_gmbus_get_adapter(dev_priv, |
| 1350 | intel_hdmi->ddc_bus)); |
Imre Deak | 671dedd | 2014-03-05 16:20:53 +0200 | [diff] [blame] | 1351 | |
| 1352 | intel_display_power_put(dev_priv, power_domain); |
| 1353 | |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1354 | to_intel_connector(connector)->detect_edid = edid; |
| 1355 | if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) { |
| 1356 | intel_hdmi->rgb_quant_range_selectable = |
| 1357 | drm_rgb_quant_range_selectable(edid); |
| 1358 | |
| 1359 | intel_hdmi->has_audio = drm_detect_monitor_audio(edid); |
| 1360 | if (intel_hdmi->force_audio != HDMI_AUDIO_AUTO) |
| 1361 | intel_hdmi->has_audio = |
| 1362 | intel_hdmi->force_audio == HDMI_AUDIO_ON; |
| 1363 | |
| 1364 | if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI) |
| 1365 | intel_hdmi->has_hdmi_sink = |
| 1366 | drm_detect_hdmi_monitor(edid); |
| 1367 | |
| 1368 | connected = true; |
| 1369 | } |
| 1370 | |
| 1371 | return connected; |
| 1372 | } |
| 1373 | |
Daniel Vetter | 8166fce | 2015-10-08 21:50:57 +0200 | [diff] [blame] | 1374 | static enum drm_connector_status |
| 1375 | intel_hdmi_detect(struct drm_connector *connector, bool force) |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1376 | { |
Daniel Vetter | 8166fce | 2015-10-08 21:50:57 +0200 | [diff] [blame] | 1377 | enum drm_connector_status status; |
| 1378 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
| 1379 | struct drm_i915_private *dev_priv = to_i915(connector->dev); |
Sonika Jindal | 237ed86 | 2015-09-15 09:44:20 +0530 | [diff] [blame] | 1380 | bool live_status = false; |
| 1381 | unsigned int retry = 3; |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1382 | |
Daniel Vetter | 8166fce | 2015-10-08 21:50:57 +0200 | [diff] [blame] | 1383 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", |
| 1384 | connector->base.id, connector->name); |
| 1385 | |
Sonika Jindal | 237ed86 | 2015-09-15 09:44:20 +0530 | [diff] [blame] | 1386 | while (!live_status && --retry) { |
| 1387 | live_status = intel_digital_port_connected(dev_priv, |
| 1388 | hdmi_to_dig_port(intel_hdmi)); |
| 1389 | mdelay(10); |
| 1390 | } |
| 1391 | |
| 1392 | if (!live_status) |
| 1393 | DRM_DEBUG_KMS("Live status not up!"); |
| 1394 | |
Daniel Vetter | 8166fce | 2015-10-08 21:50:57 +0200 | [diff] [blame] | 1395 | intel_hdmi_unset_edid(connector); |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1396 | |
Daniel Vetter | 8166fce | 2015-10-08 21:50:57 +0200 | [diff] [blame] | 1397 | if (intel_hdmi_set_edid(connector, live_status)) { |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1398 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
| 1399 | |
| 1400 | hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI; |
| 1401 | status = connector_status_connected; |
Daniel Vetter | 8166fce | 2015-10-08 21:50:57 +0200 | [diff] [blame] | 1402 | } else |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1403 | status = connector_status_disconnected; |
| 1404 | |
| 1405 | return status; |
| 1406 | } |
| 1407 | |
| 1408 | static void |
| 1409 | intel_hdmi_force(struct drm_connector *connector) |
| 1410 | { |
| 1411 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
| 1412 | |
| 1413 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", |
| 1414 | connector->base.id, connector->name); |
| 1415 | |
| 1416 | intel_hdmi_unset_edid(connector); |
| 1417 | |
| 1418 | if (connector->status != connector_status_connected) |
| 1419 | return; |
| 1420 | |
Sonika Jindal | 237ed86 | 2015-09-15 09:44:20 +0530 | [diff] [blame] | 1421 | intel_hdmi_set_edid(connector, true); |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1422 | hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI; |
| 1423 | } |
| 1424 | |
| 1425 | static int intel_hdmi_get_modes(struct drm_connector *connector) |
| 1426 | { |
| 1427 | struct edid *edid; |
| 1428 | |
| 1429 | edid = to_intel_connector(connector)->detect_edid; |
| 1430 | if (edid == NULL) |
| 1431 | return 0; |
| 1432 | |
| 1433 | return intel_connector_update_modes(connector, edid); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1434 | } |
| 1435 | |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1436 | static bool |
| 1437 | intel_hdmi_detect_audio(struct drm_connector *connector) |
| 1438 | { |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1439 | bool has_audio = false; |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1440 | struct edid *edid; |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1441 | |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1442 | edid = to_intel_connector(connector)->detect_edid; |
| 1443 | if (edid && edid->input & DRM_EDID_INPUT_DIGITAL) |
| 1444 | has_audio = drm_detect_monitor_audio(edid); |
Imre Deak | 671dedd | 2014-03-05 16:20:53 +0200 | [diff] [blame] | 1445 | |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1446 | return has_audio; |
| 1447 | } |
| 1448 | |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1449 | static int |
| 1450 | intel_hdmi_set_property(struct drm_connector *connector, |
Paulo Zanoni | ed517fb | 2012-05-14 17:12:50 -0300 | [diff] [blame] | 1451 | struct drm_property *property, |
| 1452 | uint64_t val) |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1453 | { |
| 1454 | struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); |
Paulo Zanoni | da63a9f | 2012-10-26 19:05:46 -0200 | [diff] [blame] | 1455 | struct intel_digital_port *intel_dig_port = |
| 1456 | hdmi_to_dig_port(intel_hdmi); |
Chris Wilson | e953fd7 | 2011-02-21 22:23:52 +0000 | [diff] [blame] | 1457 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1458 | int ret; |
| 1459 | |
Rob Clark | 662595d | 2012-10-11 20:36:04 -0500 | [diff] [blame] | 1460 | ret = drm_object_property_set_value(&connector->base, property, val); |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1461 | if (ret) |
| 1462 | return ret; |
| 1463 | |
Chris Wilson | 3f43c48 | 2011-05-12 22:17:24 +0100 | [diff] [blame] | 1464 | if (property == dev_priv->force_audio_property) { |
Wu Fengguang | b1d7e4b | 2012-02-14 11:45:36 +0800 | [diff] [blame] | 1465 | enum hdmi_force_audio i = val; |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1466 | bool has_audio; |
| 1467 | |
| 1468 | if (i == intel_hdmi->force_audio) |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1469 | return 0; |
| 1470 | |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1471 | intel_hdmi->force_audio = i; |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1472 | |
Wu Fengguang | b1d7e4b | 2012-02-14 11:45:36 +0800 | [diff] [blame] | 1473 | if (i == HDMI_AUDIO_AUTO) |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1474 | has_audio = intel_hdmi_detect_audio(connector); |
| 1475 | else |
Wu Fengguang | b1d7e4b | 2012-02-14 11:45:36 +0800 | [diff] [blame] | 1476 | has_audio = (i == HDMI_AUDIO_ON); |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1477 | |
Wu Fengguang | b1d7e4b | 2012-02-14 11:45:36 +0800 | [diff] [blame] | 1478 | if (i == HDMI_AUDIO_OFF_DVI) |
| 1479 | intel_hdmi->has_hdmi_sink = 0; |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1480 | |
Chris Wilson | 1aad7ac | 2011-02-09 18:46:58 +0000 | [diff] [blame] | 1481 | intel_hdmi->has_audio = has_audio; |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1482 | goto done; |
| 1483 | } |
| 1484 | |
Chris Wilson | e953fd7 | 2011-02-21 22:23:52 +0000 | [diff] [blame] | 1485 | if (property == dev_priv->broadcast_rgb_property) { |
Daniel Vetter | ae4edb8 | 2013-04-22 17:07:23 +0200 | [diff] [blame] | 1486 | bool old_auto = intel_hdmi->color_range_auto; |
Ville Syrjälä | 0f2a2a7 | 2015-07-06 15:10:00 +0300 | [diff] [blame] | 1487 | bool old_range = intel_hdmi->limited_color_range; |
Daniel Vetter | ae4edb8 | 2013-04-22 17:07:23 +0200 | [diff] [blame] | 1488 | |
Ville Syrjälä | 55bc60d | 2013-01-17 16:31:29 +0200 | [diff] [blame] | 1489 | switch (val) { |
| 1490 | case INTEL_BROADCAST_RGB_AUTO: |
| 1491 | intel_hdmi->color_range_auto = true; |
| 1492 | break; |
| 1493 | case INTEL_BROADCAST_RGB_FULL: |
| 1494 | intel_hdmi->color_range_auto = false; |
Ville Syrjälä | 0f2a2a7 | 2015-07-06 15:10:00 +0300 | [diff] [blame] | 1495 | intel_hdmi->limited_color_range = false; |
Ville Syrjälä | 55bc60d | 2013-01-17 16:31:29 +0200 | [diff] [blame] | 1496 | break; |
| 1497 | case INTEL_BROADCAST_RGB_LIMITED: |
| 1498 | intel_hdmi->color_range_auto = false; |
Ville Syrjälä | 0f2a2a7 | 2015-07-06 15:10:00 +0300 | [diff] [blame] | 1499 | intel_hdmi->limited_color_range = true; |
Ville Syrjälä | 55bc60d | 2013-01-17 16:31:29 +0200 | [diff] [blame] | 1500 | break; |
| 1501 | default: |
| 1502 | return -EINVAL; |
| 1503 | } |
Daniel Vetter | ae4edb8 | 2013-04-22 17:07:23 +0200 | [diff] [blame] | 1504 | |
| 1505 | if (old_auto == intel_hdmi->color_range_auto && |
Ville Syrjälä | 0f2a2a7 | 2015-07-06 15:10:00 +0300 | [diff] [blame] | 1506 | old_range == intel_hdmi->limited_color_range) |
Daniel Vetter | ae4edb8 | 2013-04-22 17:07:23 +0200 | [diff] [blame] | 1507 | return 0; |
| 1508 | |
Chris Wilson | e953fd7 | 2011-02-21 22:23:52 +0000 | [diff] [blame] | 1509 | goto done; |
| 1510 | } |
| 1511 | |
Vandana Kannan | 94a11dd | 2014-06-11 11:06:01 +0530 | [diff] [blame] | 1512 | if (property == connector->dev->mode_config.aspect_ratio_property) { |
| 1513 | switch (val) { |
| 1514 | case DRM_MODE_PICTURE_ASPECT_NONE: |
| 1515 | intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE; |
| 1516 | break; |
| 1517 | case DRM_MODE_PICTURE_ASPECT_4_3: |
| 1518 | intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_4_3; |
| 1519 | break; |
| 1520 | case DRM_MODE_PICTURE_ASPECT_16_9: |
| 1521 | intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_16_9; |
| 1522 | break; |
| 1523 | default: |
| 1524 | return -EINVAL; |
| 1525 | } |
| 1526 | goto done; |
| 1527 | } |
| 1528 | |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1529 | return -EINVAL; |
| 1530 | |
| 1531 | done: |
Chris Wilson | c0c36b94 | 2012-12-19 16:08:43 +0000 | [diff] [blame] | 1532 | if (intel_dig_port->base.base.crtc) |
| 1533 | intel_crtc_restore_mode(intel_dig_port->base.base.crtc); |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1534 | |
| 1535 | return 0; |
| 1536 | } |
| 1537 | |
Jesse Barnes | 13732ba | 2014-04-05 11:51:35 -0700 | [diff] [blame] | 1538 | static void intel_hdmi_pre_enable(struct intel_encoder *encoder) |
| 1539 | { |
| 1540 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
| 1541 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 1542 | const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode; |
Jesse Barnes | 13732ba | 2014-04-05 11:51:35 -0700 | [diff] [blame] | 1543 | |
Daniel Vetter | 4cde8a2 | 2014-04-24 23:54:56 +0200 | [diff] [blame] | 1544 | intel_hdmi_prepare(encoder); |
| 1545 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 1546 | intel_hdmi->set_infoframes(&encoder->base, |
Ander Conselvan de Oliveira | 6e3c971 | 2015-01-15 14:55:25 +0200 | [diff] [blame] | 1547 | intel_crtc->config->has_hdmi_sink, |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 1548 | adjusted_mode); |
Jesse Barnes | 13732ba | 2014-04-05 11:51:35 -0700 | [diff] [blame] | 1549 | } |
| 1550 | |
Chon Ming Lee | 9514ac6 | 2013-10-16 17:07:41 +0800 | [diff] [blame] | 1551 | static void vlv_hdmi_pre_enable(struct intel_encoder *encoder) |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1552 | { |
| 1553 | struct intel_digital_port *dport = enc_to_dig_port(&encoder->base); |
Jesse Barnes | 13732ba | 2014-04-05 11:51:35 -0700 | [diff] [blame] | 1554 | struct intel_hdmi *intel_hdmi = &dport->hdmi; |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1555 | struct drm_device *dev = encoder->base.dev; |
| 1556 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1557 | struct intel_crtc *intel_crtc = |
| 1558 | to_intel_crtc(encoder->base.crtc); |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 1559 | const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode; |
Chon Ming Lee | e4607fc | 2013-11-06 14:36:35 +0800 | [diff] [blame] | 1560 | enum dpio_channel port = vlv_dport_to_channel(dport); |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1561 | int pipe = intel_crtc->pipe; |
| 1562 | u32 val; |
| 1563 | |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1564 | /* Enable clock channels for this port */ |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1565 | mutex_lock(&dev_priv->sb_lock); |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1566 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW8(port)); |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1567 | val = 0; |
| 1568 | if (pipe) |
| 1569 | val |= (1<<21); |
| 1570 | else |
| 1571 | val &= ~(1<<21); |
| 1572 | val |= 0x001000c4; |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1573 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW8(port), val); |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1574 | |
| 1575 | /* HDMI 1.0V-2dB */ |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1576 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW5(port), 0); |
| 1577 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW4(port), 0x2b245f5f); |
| 1578 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW2(port), 0x5578b83a); |
| 1579 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW3(port), 0x0c782040); |
| 1580 | vlv_dpio_write(dev_priv, pipe, VLV_TX3_DW4(port), 0x2b247878); |
| 1581 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW11(port), 0x00030000); |
| 1582 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW9(port), 0x00002000); |
| 1583 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW5(port), DPIO_TX_OCALINIT_EN); |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1584 | |
| 1585 | /* Program lane clock */ |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1586 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW14(port), 0x00760018); |
| 1587 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW23(port), 0x00400888); |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1588 | mutex_unlock(&dev_priv->sb_lock); |
Jani Nikula | b76cf76 | 2013-07-30 12:20:31 +0300 | [diff] [blame] | 1589 | |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 1590 | intel_hdmi->set_infoframes(&encoder->base, |
Ander Conselvan de Oliveira | 6e3c971 | 2015-01-15 14:55:25 +0200 | [diff] [blame] | 1591 | intel_crtc->config->has_hdmi_sink, |
Daniel Vetter | 6897b4b5 | 2014-04-24 23:54:47 +0200 | [diff] [blame] | 1592 | adjusted_mode); |
Jesse Barnes | 13732ba | 2014-04-05 11:51:35 -0700 | [diff] [blame] | 1593 | |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 1594 | g4x_enable_hdmi(encoder); |
Jani Nikula | b76cf76 | 2013-07-30 12:20:31 +0300 | [diff] [blame] | 1595 | |
Ville Syrjälä | 9b6de0a | 2015-04-10 18:21:31 +0300 | [diff] [blame] | 1596 | vlv_wait_port_ready(dev_priv, dport, 0x0); |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1597 | } |
| 1598 | |
Chon Ming Lee | 9514ac6 | 2013-10-16 17:07:41 +0800 | [diff] [blame] | 1599 | static void vlv_hdmi_pre_pll_enable(struct intel_encoder *encoder) |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1600 | { |
| 1601 | struct intel_digital_port *dport = enc_to_dig_port(&encoder->base); |
| 1602 | struct drm_device *dev = encoder->base.dev; |
| 1603 | struct drm_i915_private *dev_priv = dev->dev_private; |
Chon Ming Lee | 5e69f97 | 2013-09-05 20:41:49 +0800 | [diff] [blame] | 1604 | struct intel_crtc *intel_crtc = |
| 1605 | to_intel_crtc(encoder->base.crtc); |
Chon Ming Lee | e4607fc | 2013-11-06 14:36:35 +0800 | [diff] [blame] | 1606 | enum dpio_channel port = vlv_dport_to_channel(dport); |
Chon Ming Lee | 5e69f97 | 2013-09-05 20:41:49 +0800 | [diff] [blame] | 1607 | int pipe = intel_crtc->pipe; |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1608 | |
Daniel Vetter | 4cde8a2 | 2014-04-24 23:54:56 +0200 | [diff] [blame] | 1609 | intel_hdmi_prepare(encoder); |
| 1610 | |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1611 | /* Program Tx lane resets to default */ |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1612 | mutex_lock(&dev_priv->sb_lock); |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1613 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW0(port), |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1614 | DPIO_PCS_TX_LANE2_RESET | |
| 1615 | DPIO_PCS_TX_LANE1_RESET); |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1616 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW1(port), |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1617 | DPIO_PCS_CLK_CRI_RXEB_EIOS_EN | |
| 1618 | DPIO_PCS_CLK_CRI_RXDIGFILTSG_EN | |
| 1619 | (1<<DPIO_PCS_CLK_DATAWIDTH_SHIFT) | |
| 1620 | DPIO_PCS_CLK_SOFT_RESET); |
| 1621 | |
| 1622 | /* Fix up inter-pair skew failure */ |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1623 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW12(port), 0x00750f00); |
| 1624 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW11(port), 0x00001500); |
| 1625 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW14(port), 0x40400000); |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1626 | |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1627 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW9(port), 0x00002000); |
| 1628 | vlv_dpio_write(dev_priv, pipe, VLV_TX_DW5(port), DPIO_TX_OCALINIT_EN); |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1629 | mutex_unlock(&dev_priv->sb_lock); |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1630 | } |
| 1631 | |
Ville Syrjälä | a8f327f | 2015-07-09 20:14:11 +0300 | [diff] [blame] | 1632 | static void chv_data_lane_soft_reset(struct intel_encoder *encoder, |
| 1633 | bool reset) |
| 1634 | { |
| 1635 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 1636 | enum dpio_channel ch = vlv_dport_to_channel(enc_to_dig_port(&encoder->base)); |
| 1637 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
| 1638 | enum pipe pipe = crtc->pipe; |
| 1639 | uint32_t val; |
| 1640 | |
| 1641 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW0(ch)); |
| 1642 | if (reset) |
| 1643 | val &= ~(DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET); |
| 1644 | else |
| 1645 | val |= DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET; |
| 1646 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW0(ch), val); |
| 1647 | |
| 1648 | if (crtc->config->lane_count > 2) { |
| 1649 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW0(ch)); |
| 1650 | if (reset) |
| 1651 | val &= ~(DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET); |
| 1652 | else |
| 1653 | val |= DPIO_PCS_TX_LANE2_RESET | DPIO_PCS_TX_LANE1_RESET; |
| 1654 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW0(ch), val); |
| 1655 | } |
| 1656 | |
| 1657 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW1(ch)); |
| 1658 | val |= CHV_PCS_REQ_SOFTRESET_EN; |
| 1659 | if (reset) |
| 1660 | val &= ~DPIO_PCS_CLK_SOFT_RESET; |
| 1661 | else |
| 1662 | val |= DPIO_PCS_CLK_SOFT_RESET; |
| 1663 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW1(ch), val); |
| 1664 | |
| 1665 | if (crtc->config->lane_count > 2) { |
| 1666 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW1(ch)); |
| 1667 | val |= CHV_PCS_REQ_SOFTRESET_EN; |
| 1668 | if (reset) |
| 1669 | val &= ~DPIO_PCS_CLK_SOFT_RESET; |
| 1670 | else |
| 1671 | val |= DPIO_PCS_CLK_SOFT_RESET; |
| 1672 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW1(ch), val); |
| 1673 | } |
| 1674 | } |
| 1675 | |
Ville Syrjälä | 9197c88 | 2014-04-09 13:29:05 +0300 | [diff] [blame] | 1676 | static void chv_hdmi_pre_pll_enable(struct intel_encoder *encoder) |
| 1677 | { |
| 1678 | struct intel_digital_port *dport = enc_to_dig_port(&encoder->base); |
| 1679 | struct drm_device *dev = encoder->base.dev; |
| 1680 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1681 | struct intel_crtc *intel_crtc = |
| 1682 | to_intel_crtc(encoder->base.crtc); |
| 1683 | enum dpio_channel ch = vlv_dport_to_channel(dport); |
| 1684 | enum pipe pipe = intel_crtc->pipe; |
| 1685 | u32 val; |
| 1686 | |
Ville Syrjälä | 625695f | 2014-06-28 02:04:02 +0300 | [diff] [blame] | 1687 | intel_hdmi_prepare(encoder); |
| 1688 | |
Ville Syrjälä | b0b3384 | 2015-07-08 23:45:55 +0300 | [diff] [blame] | 1689 | /* |
| 1690 | * Must trick the second common lane into life. |
| 1691 | * Otherwise we can't even access the PLL. |
| 1692 | */ |
| 1693 | if (ch == DPIO_CH0 && pipe == PIPE_B) |
| 1694 | dport->release_cl2_override = |
| 1695 | !chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, true); |
| 1696 | |
Ville Syrjälä | e0fce78 | 2015-07-08 23:45:54 +0300 | [diff] [blame] | 1697 | chv_phy_powergate_lanes(encoder, true, 0x0); |
| 1698 | |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1699 | mutex_lock(&dev_priv->sb_lock); |
Ville Syrjälä | 9197c88 | 2014-04-09 13:29:05 +0300 | [diff] [blame] | 1700 | |
Ville Syrjälä | a8f327f | 2015-07-09 20:14:11 +0300 | [diff] [blame] | 1701 | /* Assert data lane reset */ |
| 1702 | chv_data_lane_soft_reset(encoder, true); |
| 1703 | |
Ville Syrjälä | b9e5ac3 | 2014-05-27 16:30:18 +0300 | [diff] [blame] | 1704 | /* program left/right clock distribution */ |
| 1705 | if (pipe != PIPE_B) { |
| 1706 | val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW5_CH0); |
| 1707 | val &= ~(CHV_BUFLEFTENA1_MASK | CHV_BUFRIGHTENA1_MASK); |
| 1708 | if (ch == DPIO_CH0) |
| 1709 | val |= CHV_BUFLEFTENA1_FORCE; |
| 1710 | if (ch == DPIO_CH1) |
| 1711 | val |= CHV_BUFRIGHTENA1_FORCE; |
| 1712 | vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW5_CH0, val); |
| 1713 | } else { |
| 1714 | val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW1_CH1); |
| 1715 | val &= ~(CHV_BUFLEFTENA2_MASK | CHV_BUFRIGHTENA2_MASK); |
| 1716 | if (ch == DPIO_CH0) |
| 1717 | val |= CHV_BUFLEFTENA2_FORCE; |
| 1718 | if (ch == DPIO_CH1) |
| 1719 | val |= CHV_BUFRIGHTENA2_FORCE; |
| 1720 | vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW1_CH1, val); |
| 1721 | } |
| 1722 | |
Ville Syrjälä | 9197c88 | 2014-04-09 13:29:05 +0300 | [diff] [blame] | 1723 | /* program clock channel usage */ |
| 1724 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW8(ch)); |
| 1725 | val |= CHV_PCS_USEDCLKCHANNEL_OVRRIDE; |
| 1726 | if (pipe != PIPE_B) |
| 1727 | val &= ~CHV_PCS_USEDCLKCHANNEL; |
| 1728 | else |
| 1729 | val |= CHV_PCS_USEDCLKCHANNEL; |
| 1730 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW8(ch), val); |
| 1731 | |
| 1732 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW8(ch)); |
| 1733 | val |= CHV_PCS_USEDCLKCHANNEL_OVRRIDE; |
| 1734 | if (pipe != PIPE_B) |
| 1735 | val &= ~CHV_PCS_USEDCLKCHANNEL; |
| 1736 | else |
| 1737 | val |= CHV_PCS_USEDCLKCHANNEL; |
| 1738 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW8(ch), val); |
| 1739 | |
| 1740 | /* |
| 1741 | * This a a bit weird since generally CL |
| 1742 | * matches the pipe, but here we need to |
| 1743 | * pick the CL based on the port. |
| 1744 | */ |
| 1745 | val = vlv_dpio_read(dev_priv, pipe, CHV_CMN_DW19(ch)); |
| 1746 | if (pipe != PIPE_B) |
| 1747 | val &= ~CHV_CMN_USEDCLKCHANNEL; |
| 1748 | else |
| 1749 | val |= CHV_CMN_USEDCLKCHANNEL; |
| 1750 | vlv_dpio_write(dev_priv, pipe, CHV_CMN_DW19(ch), val); |
| 1751 | |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1752 | mutex_unlock(&dev_priv->sb_lock); |
Ville Syrjälä | 9197c88 | 2014-04-09 13:29:05 +0300 | [diff] [blame] | 1753 | } |
| 1754 | |
Ville Syrjälä | d6db995 | 2015-07-08 23:45:49 +0300 | [diff] [blame] | 1755 | static void chv_hdmi_post_pll_disable(struct intel_encoder *encoder) |
| 1756 | { |
| 1757 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
| 1758 | enum pipe pipe = to_intel_crtc(encoder->base.crtc)->pipe; |
| 1759 | u32 val; |
| 1760 | |
| 1761 | mutex_lock(&dev_priv->sb_lock); |
| 1762 | |
| 1763 | /* disable left/right clock distribution */ |
| 1764 | if (pipe != PIPE_B) { |
| 1765 | val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW5_CH0); |
| 1766 | val &= ~(CHV_BUFLEFTENA1_MASK | CHV_BUFRIGHTENA1_MASK); |
| 1767 | vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW5_CH0, val); |
| 1768 | } else { |
| 1769 | val = vlv_dpio_read(dev_priv, pipe, _CHV_CMN_DW1_CH1); |
| 1770 | val &= ~(CHV_BUFLEFTENA2_MASK | CHV_BUFRIGHTENA2_MASK); |
| 1771 | vlv_dpio_write(dev_priv, pipe, _CHV_CMN_DW1_CH1, val); |
| 1772 | } |
| 1773 | |
| 1774 | mutex_unlock(&dev_priv->sb_lock); |
Ville Syrjälä | e0fce78 | 2015-07-08 23:45:54 +0300 | [diff] [blame] | 1775 | |
Ville Syrjälä | b0b3384 | 2015-07-08 23:45:55 +0300 | [diff] [blame] | 1776 | /* |
| 1777 | * Leave the power down bit cleared for at least one |
| 1778 | * lane so that chv_powergate_phy_ch() will power |
| 1779 | * on something when the channel is otherwise unused. |
| 1780 | * When the port is off and the override is removed |
| 1781 | * the lanes power down anyway, so otherwise it doesn't |
| 1782 | * really matter what the state of power down bits is |
| 1783 | * after this. |
| 1784 | */ |
Ville Syrjälä | e0fce78 | 2015-07-08 23:45:54 +0300 | [diff] [blame] | 1785 | chv_phy_powergate_lanes(encoder, false, 0x0); |
Ville Syrjälä | d6db995 | 2015-07-08 23:45:49 +0300 | [diff] [blame] | 1786 | } |
| 1787 | |
Chon Ming Lee | 9514ac6 | 2013-10-16 17:07:41 +0800 | [diff] [blame] | 1788 | static void vlv_hdmi_post_disable(struct intel_encoder *encoder) |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1789 | { |
| 1790 | struct intel_digital_port *dport = enc_to_dig_port(&encoder->base); |
| 1791 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
Chon Ming Lee | 5e69f97 | 2013-09-05 20:41:49 +0800 | [diff] [blame] | 1792 | struct intel_crtc *intel_crtc = |
| 1793 | to_intel_crtc(encoder->base.crtc); |
Chon Ming Lee | e4607fc | 2013-11-06 14:36:35 +0800 | [diff] [blame] | 1794 | enum dpio_channel port = vlv_dport_to_channel(dport); |
Chon Ming Lee | 5e69f97 | 2013-09-05 20:41:49 +0800 | [diff] [blame] | 1795 | int pipe = intel_crtc->pipe; |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1796 | |
| 1797 | /* Reset lanes to avoid HDMI flicker (VLV w/a) */ |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1798 | mutex_lock(&dev_priv->sb_lock); |
Chon Ming Lee | ab3c759 | 2013-11-07 10:43:30 +0800 | [diff] [blame] | 1799 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW0(port), 0x00000000); |
| 1800 | vlv_dpio_write(dev_priv, pipe, VLV_PCS_DW1(port), 0x00e00060); |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1801 | mutex_unlock(&dev_priv->sb_lock); |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 1802 | } |
| 1803 | |
Ville Syrjälä | 580d381 | 2014-04-09 13:29:00 +0300 | [diff] [blame] | 1804 | static void chv_hdmi_post_disable(struct intel_encoder *encoder) |
| 1805 | { |
Ville Syrjälä | 580d381 | 2014-04-09 13:29:00 +0300 | [diff] [blame] | 1806 | struct drm_device *dev = encoder->base.dev; |
| 1807 | struct drm_i915_private *dev_priv = dev->dev_private; |
Ville Syrjälä | 580d381 | 2014-04-09 13:29:00 +0300 | [diff] [blame] | 1808 | |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1809 | mutex_lock(&dev_priv->sb_lock); |
Ville Syrjälä | 580d381 | 2014-04-09 13:29:00 +0300 | [diff] [blame] | 1810 | |
Ville Syrjälä | a8f327f | 2015-07-09 20:14:11 +0300 | [diff] [blame] | 1811 | /* Assert data lane reset */ |
| 1812 | chv_data_lane_soft_reset(encoder, true); |
Ville Syrjälä | 580d381 | 2014-04-09 13:29:00 +0300 | [diff] [blame] | 1813 | |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1814 | mutex_unlock(&dev_priv->sb_lock); |
Ville Syrjälä | 580d381 | 2014-04-09 13:29:00 +0300 | [diff] [blame] | 1815 | } |
| 1816 | |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1817 | static void chv_hdmi_pre_enable(struct intel_encoder *encoder) |
| 1818 | { |
| 1819 | struct intel_digital_port *dport = enc_to_dig_port(&encoder->base); |
Clint Taylor | b4eb156 | 2014-11-21 11:13:02 -0800 | [diff] [blame] | 1820 | struct intel_hdmi *intel_hdmi = &dport->hdmi; |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1821 | struct drm_device *dev = encoder->base.dev; |
| 1822 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 1823 | struct intel_crtc *intel_crtc = |
| 1824 | to_intel_crtc(encoder->base.crtc); |
Ville Syrjälä | 7c5f93b | 2015-09-08 13:40:49 +0300 | [diff] [blame] | 1825 | const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode; |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1826 | enum dpio_channel ch = vlv_dport_to_channel(dport); |
| 1827 | int pipe = intel_crtc->pipe; |
Ville Syrjälä | 2e523e9 | 2015-04-10 18:21:27 +0300 | [diff] [blame] | 1828 | int data, i, stagger; |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1829 | u32 val; |
| 1830 | |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1831 | mutex_lock(&dev_priv->sb_lock); |
Ville Syrjälä | 949c1d4 | 2014-04-09 13:28:58 +0300 | [diff] [blame] | 1832 | |
Ville Syrjälä | 570e2a7 | 2014-08-18 14:42:46 +0300 | [diff] [blame] | 1833 | /* allow hardware to manage TX FIFO reset source */ |
| 1834 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW11(ch)); |
| 1835 | val &= ~DPIO_LANEDESKEW_STRAP_OVRD; |
| 1836 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW11(ch), val); |
| 1837 | |
| 1838 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW11(ch)); |
| 1839 | val &= ~DPIO_LANEDESKEW_STRAP_OVRD; |
| 1840 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW11(ch), val); |
| 1841 | |
Ville Syrjälä | 949c1d4 | 2014-04-09 13:28:58 +0300 | [diff] [blame] | 1842 | /* Program Tx latency optimal setting */ |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1843 | for (i = 0; i < 4; i++) { |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1844 | /* Set the upar bit */ |
| 1845 | data = (i == 1) ? 0x0 : 0x1; |
| 1846 | vlv_dpio_write(dev_priv, pipe, CHV_TX_DW14(ch, i), |
| 1847 | data << DPIO_UPAR_SHIFT); |
| 1848 | } |
| 1849 | |
| 1850 | /* Data lane stagger programming */ |
Ville Syrjälä | 2e523e9 | 2015-04-10 18:21:27 +0300 | [diff] [blame] | 1851 | if (intel_crtc->config->port_clock > 270000) |
| 1852 | stagger = 0x18; |
| 1853 | else if (intel_crtc->config->port_clock > 135000) |
| 1854 | stagger = 0xd; |
| 1855 | else if (intel_crtc->config->port_clock > 67500) |
| 1856 | stagger = 0x7; |
| 1857 | else if (intel_crtc->config->port_clock > 33750) |
| 1858 | stagger = 0x4; |
| 1859 | else |
| 1860 | stagger = 0x2; |
| 1861 | |
| 1862 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW11(ch)); |
| 1863 | val |= DPIO_TX2_STAGGER_MASK(0x1f); |
| 1864 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW11(ch), val); |
| 1865 | |
| 1866 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW11(ch)); |
| 1867 | val |= DPIO_TX2_STAGGER_MASK(0x1f); |
| 1868 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW11(ch), val); |
| 1869 | |
| 1870 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW12(ch), |
| 1871 | DPIO_LANESTAGGER_STRAP(stagger) | |
| 1872 | DPIO_LANESTAGGER_STRAP_OVRD | |
| 1873 | DPIO_TX1_STAGGER_MASK(0x1f) | |
| 1874 | DPIO_TX1_STAGGER_MULT(6) | |
| 1875 | DPIO_TX2_STAGGER_MULT(0)); |
| 1876 | |
| 1877 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW12(ch), |
| 1878 | DPIO_LANESTAGGER_STRAP(stagger) | |
| 1879 | DPIO_LANESTAGGER_STRAP_OVRD | |
| 1880 | DPIO_TX1_STAGGER_MASK(0x1f) | |
| 1881 | DPIO_TX1_STAGGER_MULT(7) | |
| 1882 | DPIO_TX2_STAGGER_MULT(5)); |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1883 | |
Ville Syrjälä | a8f327f | 2015-07-09 20:14:11 +0300 | [diff] [blame] | 1884 | /* Deassert data lane reset */ |
| 1885 | chv_data_lane_soft_reset(encoder, false); |
| 1886 | |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1887 | /* Clear calc init */ |
Ville Syrjälä | 1966e59 | 2014-04-09 13:29:04 +0300 | [diff] [blame] | 1888 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW10(ch)); |
| 1889 | val &= ~(DPIO_PCS_SWING_CALC_TX0_TX2 | DPIO_PCS_SWING_CALC_TX1_TX3); |
Ville Syrjälä | a02ef3c | 2014-08-18 14:42:45 +0300 | [diff] [blame] | 1890 | val &= ~(DPIO_PCS_TX1DEEMP_MASK | DPIO_PCS_TX2DEEMP_MASK); |
| 1891 | val |= DPIO_PCS_TX1DEEMP_9P5 | DPIO_PCS_TX2DEEMP_9P5; |
Ville Syrjälä | 1966e59 | 2014-04-09 13:29:04 +0300 | [diff] [blame] | 1892 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW10(ch), val); |
| 1893 | |
| 1894 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW10(ch)); |
| 1895 | val &= ~(DPIO_PCS_SWING_CALC_TX0_TX2 | DPIO_PCS_SWING_CALC_TX1_TX3); |
Ville Syrjälä | a02ef3c | 2014-08-18 14:42:45 +0300 | [diff] [blame] | 1896 | val &= ~(DPIO_PCS_TX1DEEMP_MASK | DPIO_PCS_TX2DEEMP_MASK); |
| 1897 | val |= DPIO_PCS_TX1DEEMP_9P5 | DPIO_PCS_TX2DEEMP_9P5; |
Ville Syrjälä | 1966e59 | 2014-04-09 13:29:04 +0300 | [diff] [blame] | 1898 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW10(ch), val); |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1899 | |
Ville Syrjälä | a02ef3c | 2014-08-18 14:42:45 +0300 | [diff] [blame] | 1900 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW9(ch)); |
| 1901 | val &= ~(DPIO_PCS_TX1MARGIN_MASK | DPIO_PCS_TX2MARGIN_MASK); |
| 1902 | val |= DPIO_PCS_TX1MARGIN_000 | DPIO_PCS_TX2MARGIN_000; |
| 1903 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW9(ch), val); |
| 1904 | |
| 1905 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW9(ch)); |
| 1906 | val &= ~(DPIO_PCS_TX1MARGIN_MASK | DPIO_PCS_TX2MARGIN_MASK); |
| 1907 | val |= DPIO_PCS_TX1MARGIN_000 | DPIO_PCS_TX2MARGIN_000; |
| 1908 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW9(ch), val); |
| 1909 | |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1910 | /* FIXME: Program the support xxx V-dB */ |
| 1911 | /* Use 800mV-0dB */ |
Ville Syrjälä | f72df8d | 2014-04-09 13:29:03 +0300 | [diff] [blame] | 1912 | for (i = 0; i < 4; i++) { |
| 1913 | val = vlv_dpio_read(dev_priv, pipe, CHV_TX_DW4(ch, i)); |
| 1914 | val &= ~DPIO_SWING_DEEMPH9P5_MASK; |
| 1915 | val |= 128 << DPIO_SWING_DEEMPH9P5_SHIFT; |
| 1916 | vlv_dpio_write(dev_priv, pipe, CHV_TX_DW4(ch, i), val); |
| 1917 | } |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1918 | |
Ville Syrjälä | f72df8d | 2014-04-09 13:29:03 +0300 | [diff] [blame] | 1919 | for (i = 0; i < 4; i++) { |
| 1920 | val = vlv_dpio_read(dev_priv, pipe, CHV_TX_DW2(ch, i)); |
Ville Syrjälä | 67fa24b | 2015-07-08 23:45:48 +0300 | [diff] [blame] | 1921 | |
Ville Syrjälä | 1fb4450 | 2014-06-28 02:04:03 +0300 | [diff] [blame] | 1922 | val &= ~DPIO_SWING_MARGIN000_MASK; |
| 1923 | val |= 102 << DPIO_SWING_MARGIN000_SHIFT; |
Ville Syrjälä | 67fa24b | 2015-07-08 23:45:48 +0300 | [diff] [blame] | 1924 | |
| 1925 | /* |
| 1926 | * Supposedly this value shouldn't matter when unique transition |
| 1927 | * scale is disabled, but in fact it does matter. Let's just |
| 1928 | * always program the same value and hope it's OK. |
| 1929 | */ |
| 1930 | val &= ~(0xff << DPIO_UNIQ_TRANS_SCALE_SHIFT); |
| 1931 | val |= 0x9a << DPIO_UNIQ_TRANS_SCALE_SHIFT; |
| 1932 | |
Ville Syrjälä | f72df8d | 2014-04-09 13:29:03 +0300 | [diff] [blame] | 1933 | vlv_dpio_write(dev_priv, pipe, CHV_TX_DW2(ch, i), val); |
| 1934 | } |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1935 | |
Ville Syrjälä | 67fa24b | 2015-07-08 23:45:48 +0300 | [diff] [blame] | 1936 | /* |
| 1937 | * The document said it needs to set bit 27 for ch0 and bit 26 |
| 1938 | * for ch1. Might be a typo in the doc. |
| 1939 | * For now, for this unique transition scale selection, set bit |
| 1940 | * 27 for ch0 and ch1. |
| 1941 | */ |
Ville Syrjälä | f72df8d | 2014-04-09 13:29:03 +0300 | [diff] [blame] | 1942 | for (i = 0; i < 4; i++) { |
| 1943 | val = vlv_dpio_read(dev_priv, pipe, CHV_TX_DW3(ch, i)); |
| 1944 | val &= ~DPIO_TX_UNIQ_TRANS_SCALE_EN; |
| 1945 | vlv_dpio_write(dev_priv, pipe, CHV_TX_DW3(ch, i), val); |
| 1946 | } |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1947 | |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1948 | /* Start swing calculation */ |
Ville Syrjälä | 1966e59 | 2014-04-09 13:29:04 +0300 | [diff] [blame] | 1949 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS01_DW10(ch)); |
| 1950 | val |= DPIO_PCS_SWING_CALC_TX0_TX2 | DPIO_PCS_SWING_CALC_TX1_TX3; |
| 1951 | vlv_dpio_write(dev_priv, pipe, VLV_PCS01_DW10(ch), val); |
| 1952 | |
| 1953 | val = vlv_dpio_read(dev_priv, pipe, VLV_PCS23_DW10(ch)); |
| 1954 | val |= DPIO_PCS_SWING_CALC_TX0_TX2 | DPIO_PCS_SWING_CALC_TX1_TX3; |
| 1955 | vlv_dpio_write(dev_priv, pipe, VLV_PCS23_DW10(ch), val); |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1956 | |
Ville Syrjälä | a580516 | 2015-05-26 20:42:30 +0300 | [diff] [blame] | 1957 | mutex_unlock(&dev_priv->sb_lock); |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1958 | |
Clint Taylor | b4eb156 | 2014-11-21 11:13:02 -0800 | [diff] [blame] | 1959 | intel_hdmi->set_infoframes(&encoder->base, |
Ander Conselvan de Oliveira | 6e3c971 | 2015-01-15 14:55:25 +0200 | [diff] [blame] | 1960 | intel_crtc->config->has_hdmi_sink, |
Clint Taylor | b4eb156 | 2014-11-21 11:13:02 -0800 | [diff] [blame] | 1961 | adjusted_mode); |
| 1962 | |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 1963 | g4x_enable_hdmi(encoder); |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1964 | |
Ville Syrjälä | 9b6de0a | 2015-04-10 18:21:31 +0300 | [diff] [blame] | 1965 | vlv_wait_port_ready(dev_priv, dport, 0x0); |
Ville Syrjälä | b0b3384 | 2015-07-08 23:45:55 +0300 | [diff] [blame] | 1966 | |
| 1967 | /* Second common lane will stay alive on its own now */ |
| 1968 | if (dport->release_cl2_override) { |
| 1969 | chv_phy_powergate_ch(dev_priv, DPIO_PHY0, DPIO_CH1, false); |
| 1970 | dport->release_cl2_override = false; |
| 1971 | } |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 1972 | } |
| 1973 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1974 | static void intel_hdmi_destroy(struct drm_connector *connector) |
| 1975 | { |
Chris Wilson | 10e972d | 2014-09-04 21:43:45 +0100 | [diff] [blame] | 1976 | kfree(to_intel_connector(connector)->detect_edid); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1977 | drm_connector_cleanup(connector); |
Zhenyu Wang | 674e2d0 | 2010-03-29 15:57:42 +0800 | [diff] [blame] | 1978 | kfree(connector); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1979 | } |
| 1980 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1981 | static const struct drm_connector_funcs intel_hdmi_connector_funcs = { |
Maarten Lankhorst | 4d688a2 | 2015-08-05 12:37:06 +0200 | [diff] [blame] | 1982 | .dpms = drm_atomic_helper_connector_dpms, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1983 | .detect = intel_hdmi_detect, |
Chris Wilson | 953ece697 | 2014-09-02 20:04:01 +0100 | [diff] [blame] | 1984 | .force = intel_hdmi_force, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1985 | .fill_modes = drm_helper_probe_single_connector_modes, |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 1986 | .set_property = intel_hdmi_set_property, |
Matt Roper | 2545e4a | 2015-01-22 16:51:27 -0800 | [diff] [blame] | 1987 | .atomic_get_property = intel_connector_atomic_get_property, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1988 | .destroy = intel_hdmi_destroy, |
Matt Roper | c6f95f2 | 2015-01-22 16:50:32 -0800 | [diff] [blame] | 1989 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, |
Ander Conselvan de Oliveira | 9896972 | 2015-03-20 16:18:06 +0200 | [diff] [blame] | 1990 | .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1991 | }; |
| 1992 | |
| 1993 | static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = { |
| 1994 | .get_modes = intel_hdmi_get_modes, |
| 1995 | .mode_valid = intel_hdmi_mode_valid, |
Chris Wilson | df0e924 | 2010-09-09 16:20:55 +0100 | [diff] [blame] | 1996 | .best_encoder = intel_best_encoder, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1997 | }; |
| 1998 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 1999 | static const struct drm_encoder_funcs intel_hdmi_enc_funcs = { |
Chris Wilson | ea5b213 | 2010-08-04 13:50:23 +0100 | [diff] [blame] | 2000 | .destroy = intel_encoder_destroy, |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2001 | }; |
| 2002 | |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 2003 | static void |
| 2004 | intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector) |
| 2005 | { |
Chris Wilson | 3f43c48 | 2011-05-12 22:17:24 +0100 | [diff] [blame] | 2006 | intel_attach_force_audio_property(connector); |
Chris Wilson | e953fd7 | 2011-02-21 22:23:52 +0000 | [diff] [blame] | 2007 | intel_attach_broadcast_rgb_property(connector); |
Ville Syrjälä | 55bc60d | 2013-01-17 16:31:29 +0200 | [diff] [blame] | 2008 | intel_hdmi->color_range_auto = true; |
Vandana Kannan | 94a11dd | 2014-06-11 11:06:01 +0530 | [diff] [blame] | 2009 | intel_attach_aspect_ratio_property(connector); |
| 2010 | intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE; |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 2011 | } |
| 2012 | |
Paulo Zanoni | 00c09d7 | 2012-10-26 19:05:52 -0200 | [diff] [blame] | 2013 | void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, |
| 2014 | struct intel_connector *intel_connector) |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2015 | { |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2016 | struct drm_connector *connector = &intel_connector->base; |
| 2017 | struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi; |
| 2018 | struct intel_encoder *intel_encoder = &intel_dig_port->base; |
| 2019 | struct drm_device *dev = intel_encoder->base.dev; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2020 | struct drm_i915_private *dev_priv = dev->dev_private; |
Paulo Zanoni | 174edf1 | 2012-10-26 19:05:50 -0200 | [diff] [blame] | 2021 | enum port port = intel_dig_port->port; |
Xiong Zhang | 11c1b65 | 2015-08-17 16:04:04 +0800 | [diff] [blame] | 2022 | uint8_t alternate_ddc_pin; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2023 | |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2024 | drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, |
Adam Jackson | 8d91104 | 2009-09-23 15:08:29 -0400 | [diff] [blame] | 2025 | DRM_MODE_CONNECTOR_HDMIA); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2026 | drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs); |
| 2027 | |
Peter Ross | c3febcc | 2012-01-28 14:49:26 +0100 | [diff] [blame] | 2028 | connector->interlace_allowed = 1; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2029 | connector->doublescan_allowed = 0; |
Damien Lespiau | 573e74a | 2013-09-25 16:45:40 +0100 | [diff] [blame] | 2030 | connector->stereo_allowed = 1; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2031 | |
Daniel Vetter | 08d644a | 2012-07-12 20:19:59 +0200 | [diff] [blame] | 2032 | switch (port) { |
| 2033 | case PORT_B: |
Jani Nikula | 4c27283 | 2015-04-01 10:58:05 +0300 | [diff] [blame] | 2034 | if (IS_BROXTON(dev_priv)) |
| 2035 | intel_hdmi->ddc_bus = GMBUS_PIN_1_BXT; |
| 2036 | else |
| 2037 | intel_hdmi->ddc_bus = GMBUS_PIN_DPB; |
Sonika Jindal | cf1d588 | 2015-08-10 10:35:36 +0530 | [diff] [blame] | 2038 | /* |
| 2039 | * On BXT A0/A1, sw needs to activate DDIA HPD logic and |
| 2040 | * interrupts to check the external panel connection. |
| 2041 | */ |
| 2042 | if (IS_BROXTON(dev_priv) && (INTEL_REVID(dev) < BXT_REVID_B0)) |
| 2043 | intel_encoder->hpd_pin = HPD_PORT_A; |
| 2044 | else |
| 2045 | intel_encoder->hpd_pin = HPD_PORT_B; |
Daniel Vetter | 08d644a | 2012-07-12 20:19:59 +0200 | [diff] [blame] | 2046 | break; |
| 2047 | case PORT_C: |
Jani Nikula | 4c27283 | 2015-04-01 10:58:05 +0300 | [diff] [blame] | 2048 | if (IS_BROXTON(dev_priv)) |
| 2049 | intel_hdmi->ddc_bus = GMBUS_PIN_2_BXT; |
| 2050 | else |
| 2051 | intel_hdmi->ddc_bus = GMBUS_PIN_DPC; |
Egbert Eich | 1d843f9 | 2013-02-25 12:06:49 -0500 | [diff] [blame] | 2052 | intel_encoder->hpd_pin = HPD_PORT_C; |
Daniel Vetter | 08d644a | 2012-07-12 20:19:59 +0200 | [diff] [blame] | 2053 | break; |
| 2054 | case PORT_D: |
Jani Nikula | 4c27283 | 2015-04-01 10:58:05 +0300 | [diff] [blame] | 2055 | if (WARN_ON(IS_BROXTON(dev_priv))) |
| 2056 | intel_hdmi->ddc_bus = GMBUS_PIN_DISABLED; |
| 2057 | else if (IS_CHERRYVIEW(dev_priv)) |
Jani Nikula | 988c701 | 2015-03-27 00:20:19 +0200 | [diff] [blame] | 2058 | intel_hdmi->ddc_bus = GMBUS_PIN_DPD_CHV; |
Ville Syrjälä | c0c3532 | 2014-04-09 13:28:52 +0300 | [diff] [blame] | 2059 | else |
Jani Nikula | 988c701 | 2015-03-27 00:20:19 +0200 | [diff] [blame] | 2060 | intel_hdmi->ddc_bus = GMBUS_PIN_DPD; |
Egbert Eich | 1d843f9 | 2013-02-25 12:06:49 -0500 | [diff] [blame] | 2061 | intel_encoder->hpd_pin = HPD_PORT_D; |
Daniel Vetter | 08d644a | 2012-07-12 20:19:59 +0200 | [diff] [blame] | 2062 | break; |
Xiong Zhang | 11c1b65 | 2015-08-17 16:04:04 +0800 | [diff] [blame] | 2063 | case PORT_E: |
| 2064 | /* On SKL PORT E doesn't have seperate GMBUS pin |
| 2065 | * We rely on VBT to set a proper alternate GMBUS pin. */ |
| 2066 | alternate_ddc_pin = |
| 2067 | dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin; |
| 2068 | switch (alternate_ddc_pin) { |
| 2069 | case DDC_PIN_B: |
| 2070 | intel_hdmi->ddc_bus = GMBUS_PIN_DPB; |
| 2071 | break; |
| 2072 | case DDC_PIN_C: |
| 2073 | intel_hdmi->ddc_bus = GMBUS_PIN_DPC; |
| 2074 | break; |
| 2075 | case DDC_PIN_D: |
| 2076 | intel_hdmi->ddc_bus = GMBUS_PIN_DPD; |
| 2077 | break; |
| 2078 | default: |
| 2079 | MISSING_CASE(alternate_ddc_pin); |
| 2080 | } |
| 2081 | intel_encoder->hpd_pin = HPD_PORT_E; |
| 2082 | break; |
Daniel Vetter | 08d644a | 2012-07-12 20:19:59 +0200 | [diff] [blame] | 2083 | case PORT_A: |
Egbert Eich | 1d843f9 | 2013-02-25 12:06:49 -0500 | [diff] [blame] | 2084 | intel_encoder->hpd_pin = HPD_PORT_A; |
Daniel Vetter | 08d644a | 2012-07-12 20:19:59 +0200 | [diff] [blame] | 2085 | /* Internal port only for eDP. */ |
| 2086 | default: |
Eugeni Dodonov | 6e4c167 | 2012-05-09 15:37:13 -0300 | [diff] [blame] | 2087 | BUG(); |
Ma Ling | f8aed70 | 2009-08-24 13:50:24 +0800 | [diff] [blame] | 2088 | } |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2089 | |
Jesse Barnes | 7637bfd | 2013-03-08 10:46:01 -0800 | [diff] [blame] | 2090 | if (IS_VALLEYVIEW(dev)) { |
Shobhit Kumar | 90b107c | 2012-03-28 13:39:32 -0700 | [diff] [blame] | 2091 | intel_hdmi->write_infoframe = vlv_write_infoframe; |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 2092 | intel_hdmi->set_infoframes = vlv_set_infoframes; |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 2093 | intel_hdmi->infoframe_enabled = vlv_infoframe_enabled; |
Sonika Jindal | b98856a | 2014-07-22 11:13:46 +0530 | [diff] [blame] | 2094 | } else if (IS_G4X(dev)) { |
Jesse Barnes | 7637bfd | 2013-03-08 10:46:01 -0800 | [diff] [blame] | 2095 | intel_hdmi->write_infoframe = g4x_write_infoframe; |
| 2096 | intel_hdmi->set_infoframes = g4x_set_infoframes; |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 2097 | intel_hdmi->infoframe_enabled = g4x_infoframe_enabled; |
Paulo Zanoni | 22b8bf1 | 2013-02-18 19:00:23 -0300 | [diff] [blame] | 2098 | } else if (HAS_DDI(dev)) { |
Eugeni Dodonov | 8c5f5f7 | 2012-05-10 10:18:02 -0300 | [diff] [blame] | 2099 | intel_hdmi->write_infoframe = hsw_write_infoframe; |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 2100 | intel_hdmi->set_infoframes = hsw_set_infoframes; |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 2101 | intel_hdmi->infoframe_enabled = hsw_infoframe_enabled; |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 2102 | } else if (HAS_PCH_IBX(dev)) { |
| 2103 | intel_hdmi->write_infoframe = ibx_write_infoframe; |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 2104 | intel_hdmi->set_infoframes = ibx_set_infoframes; |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 2105 | intel_hdmi->infoframe_enabled = ibx_infoframe_enabled; |
Paulo Zanoni | fdf1250 | 2012-05-04 17:18:24 -0300 | [diff] [blame] | 2106 | } else { |
| 2107 | intel_hdmi->write_infoframe = cpt_write_infoframe; |
Paulo Zanoni | 687f4d0 | 2012-05-28 16:42:48 -0300 | [diff] [blame] | 2108 | intel_hdmi->set_infoframes = cpt_set_infoframes; |
Jesse Barnes | e43823e | 2014-11-05 14:26:08 -0800 | [diff] [blame] | 2109 | intel_hdmi->infoframe_enabled = cpt_infoframe_enabled; |
Jesse Barnes | 64a8fc0 | 2011-09-22 11:16:00 +0530 | [diff] [blame] | 2110 | } |
Jesse Barnes | 45187ac | 2011-08-03 09:22:55 -0700 | [diff] [blame] | 2111 | |
Paulo Zanoni | affa935 | 2012-11-23 15:30:39 -0200 | [diff] [blame] | 2112 | if (HAS_DDI(dev)) |
Paulo Zanoni | bcbc889 | 2012-10-26 19:05:51 -0200 | [diff] [blame] | 2113 | intel_connector->get_hw_state = intel_ddi_connector_get_hw_state; |
| 2114 | else |
| 2115 | intel_connector->get_hw_state = intel_connector_get_hw_state; |
Imre Deak | 4932e2c | 2014-02-11 17:12:48 +0200 | [diff] [blame] | 2116 | intel_connector->unregister = intel_connector_unregister; |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2117 | |
| 2118 | intel_hdmi_add_properties(intel_hdmi, connector); |
| 2119 | |
| 2120 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
Thomas Wood | 34ea3d3 | 2014-05-29 16:57:41 +0100 | [diff] [blame] | 2121 | drm_connector_register(connector); |
Shashank Sharma | d8b4c43 | 2015-09-04 18:56:11 +0530 | [diff] [blame] | 2122 | intel_hdmi->attached_connector = intel_connector; |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2123 | |
| 2124 | /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written |
| 2125 | * 0xd. Failure to do so will result in spurious interrupts being |
| 2126 | * generated on the port when a cable is not attached. |
| 2127 | */ |
| 2128 | if (IS_G4X(dev) && !IS_GM45(dev)) { |
| 2129 | u32 temp = I915_READ(PEG_BAND_GAP_DATA); |
| 2130 | I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd); |
| 2131 | } |
| 2132 | } |
| 2133 | |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 2134 | void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port) |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2135 | { |
| 2136 | struct intel_digital_port *intel_dig_port; |
| 2137 | struct intel_encoder *intel_encoder; |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2138 | struct intel_connector *intel_connector; |
| 2139 | |
Daniel Vetter | b14c567 | 2013-09-19 12:18:32 +0200 | [diff] [blame] | 2140 | intel_dig_port = kzalloc(sizeof(*intel_dig_port), GFP_KERNEL); |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2141 | if (!intel_dig_port) |
| 2142 | return; |
| 2143 | |
Ander Conselvan de Oliveira | 08d9bc9 | 2015-04-10 10:59:10 +0300 | [diff] [blame] | 2144 | intel_connector = intel_connector_alloc(); |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2145 | if (!intel_connector) { |
| 2146 | kfree(intel_dig_port); |
| 2147 | return; |
| 2148 | } |
| 2149 | |
| 2150 | intel_encoder = &intel_dig_port->base; |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2151 | |
| 2152 | drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs, |
| 2153 | DRM_MODE_ENCODER_TMDS); |
Paulo Zanoni | 00c09d7 | 2012-10-26 19:05:52 -0200 | [diff] [blame] | 2154 | |
Daniel Vetter | 5bfe2ac | 2013-03-27 00:44:55 +0100 | [diff] [blame] | 2155 | intel_encoder->compute_config = intel_hdmi_compute_config; |
Ville Syrjälä | a4790ce | 2015-05-05 17:17:35 +0300 | [diff] [blame] | 2156 | if (HAS_PCH_SPLIT(dev)) { |
| 2157 | intel_encoder->disable = pch_disable_hdmi; |
| 2158 | intel_encoder->post_disable = pch_post_disable_hdmi; |
| 2159 | } else { |
| 2160 | intel_encoder->disable = g4x_disable_hdmi; |
| 2161 | } |
Paulo Zanoni | 00c09d7 | 2012-10-26 19:05:52 -0200 | [diff] [blame] | 2162 | intel_encoder->get_hw_state = intel_hdmi_get_hw_state; |
Jesse Barnes | 045ac3b | 2013-05-14 17:08:26 -0700 | [diff] [blame] | 2163 | intel_encoder->get_config = intel_hdmi_get_config; |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 2164 | if (IS_CHERRYVIEW(dev)) { |
Ville Syrjälä | 9197c88 | 2014-04-09 13:29:05 +0300 | [diff] [blame] | 2165 | intel_encoder->pre_pll_enable = chv_hdmi_pre_pll_enable; |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 2166 | intel_encoder->pre_enable = chv_hdmi_pre_enable; |
| 2167 | intel_encoder->enable = vlv_enable_hdmi; |
Ville Syrjälä | 580d381 | 2014-04-09 13:29:00 +0300 | [diff] [blame] | 2168 | intel_encoder->post_disable = chv_hdmi_post_disable; |
Ville Syrjälä | d6db995 | 2015-07-08 23:45:49 +0300 | [diff] [blame] | 2169 | intel_encoder->post_pll_disable = chv_hdmi_post_pll_disable; |
Chon Ming Lee | e4a1d84 | 2014-04-09 13:28:20 +0300 | [diff] [blame] | 2170 | } else if (IS_VALLEYVIEW(dev)) { |
Chon Ming Lee | 9514ac6 | 2013-10-16 17:07:41 +0800 | [diff] [blame] | 2171 | intel_encoder->pre_pll_enable = vlv_hdmi_pre_pll_enable; |
| 2172 | intel_encoder->pre_enable = vlv_hdmi_pre_enable; |
Jani Nikula | b76cf76 | 2013-07-30 12:20:31 +0300 | [diff] [blame] | 2173 | intel_encoder->enable = vlv_enable_hdmi; |
Chon Ming Lee | 9514ac6 | 2013-10-16 17:07:41 +0800 | [diff] [blame] | 2174 | intel_encoder->post_disable = vlv_hdmi_post_disable; |
Jani Nikula | b76cf76 | 2013-07-30 12:20:31 +0300 | [diff] [blame] | 2175 | } else { |
Jesse Barnes | 13732ba | 2014-04-05 11:51:35 -0700 | [diff] [blame] | 2176 | intel_encoder->pre_enable = intel_hdmi_pre_enable; |
Ville Syrjälä | d1b1589 | 2015-05-05 17:06:19 +0300 | [diff] [blame] | 2177 | if (HAS_PCH_CPT(dev)) |
| 2178 | intel_encoder->enable = cpt_enable_hdmi; |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 2179 | else if (HAS_PCH_IBX(dev)) |
| 2180 | intel_encoder->enable = ibx_enable_hdmi; |
Ville Syrjälä | d1b1589 | 2015-05-05 17:06:19 +0300 | [diff] [blame] | 2181 | else |
Ville Syrjälä | bf868c7 | 2015-05-05 17:06:23 +0300 | [diff] [blame] | 2182 | intel_encoder->enable = g4x_enable_hdmi; |
Jesse Barnes | 89b667f | 2013-04-18 14:51:36 -0700 | [diff] [blame] | 2183 | } |
Daniel Vetter | 5ab432e | 2012-06-30 08:59:56 +0200 | [diff] [blame] | 2184 | |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2185 | intel_encoder->type = INTEL_OUTPUT_HDMI; |
Ville Syrjälä | 882ec38 | 2014-04-28 14:07:43 +0300 | [diff] [blame] | 2186 | if (IS_CHERRYVIEW(dev)) { |
| 2187 | if (port == PORT_D) |
| 2188 | intel_encoder->crtc_mask = 1 << 2; |
| 2189 | else |
| 2190 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); |
| 2191 | } else { |
| 2192 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); |
| 2193 | } |
Ville Syrjälä | 301ea74 | 2014-03-03 16:15:30 +0200 | [diff] [blame] | 2194 | intel_encoder->cloneable = 1 << INTEL_OUTPUT_ANALOG; |
Ville Syrjälä | c6f1495 | 2014-03-03 16:15:31 +0200 | [diff] [blame] | 2195 | /* |
| 2196 | * BSpec is unclear about HDMI+HDMI cloning on g4x, but it seems |
| 2197 | * to work on real hardware. And since g4x can send infoframes to |
| 2198 | * only one port anyway, nothing is lost by allowing it. |
| 2199 | */ |
| 2200 | if (IS_G4X(dev)) |
| 2201 | intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI; |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2202 | |
Paulo Zanoni | 174edf1 | 2012-10-26 19:05:50 -0200 | [diff] [blame] | 2203 | intel_dig_port->port = port; |
Paulo Zanoni | b242b7f | 2013-02-18 19:00:26 -0300 | [diff] [blame] | 2204 | intel_dig_port->hdmi.hdmi_reg = hdmi_reg; |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2205 | intel_dig_port->dp.output_reg = 0; |
Chris Wilson | 55b7d6e8 | 2010-09-19 09:29:33 +0100 | [diff] [blame] | 2206 | |
Paulo Zanoni | b9cb234 | 2012-10-26 19:05:47 -0200 | [diff] [blame] | 2207 | intel_hdmi_init_connector(intel_dig_port, intel_connector); |
Eric Anholt | 7d57382 | 2009-01-02 13:33:00 -0800 | [diff] [blame] | 2208 | } |