aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_hdmi.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-05-05 10:06:23 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-06-15 05:32:15 -0400
commitbf868c7ddaa7fd5645fbc01cf2c4ad6ddd64c142 (patch)
treed543d82f000fecf2acf434603516979248e5eda9 /drivers/gpu/drm/i915/intel_hdmi.c
parentc5de7c6f3b3185ebbb9cf81abb94580c7f2ebd5f (diff)
drm/i915: Fix 12bpc HDMI enable for IBX
Follow the procedure listed in Bspec to toggle the port enable bit off and on when enabling HDMI with 12bpc and pixel repeat on IBX. The old code didn't actually enable the port before "toggling" the bit back off, so the whole workaround was essentially a nop. Also take the opportunity to clarify the code by splitting the gmch platforms to a separate (much more straightforward) function. v2: Rebased due to crtc->config changes Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chandra Konduru <Chandra.konduru@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_hdmi.c')
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c78
1 files changed, 53 insertions, 25 deletions
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index b1e1c3d8b8cd..14a916437b24 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -944,47 +944,73 @@ static void intel_enable_hdmi_audio(struct intel_encoder *encoder)
944 intel_audio_codec_enable(encoder); 944 intel_audio_codec_enable(encoder);
945} 945}
946 946
947static void intel_enable_hdmi(struct intel_encoder *encoder) 947static void g4x_enable_hdmi(struct intel_encoder *encoder)
948{ 948{
949 struct drm_device *dev = encoder->base.dev; 949 struct drm_device *dev = encoder->base.dev;
950 struct drm_i915_private *dev_priv = dev->dev_private; 950 struct drm_i915_private *dev_priv = dev->dev_private;
951 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc); 951 struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
952 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); 952 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
953 u32 temp; 953 u32 temp;
954 u32 enable_bits = SDVO_ENABLE;
955
956 if (intel_crtc->config->has_audio)
957 enable_bits |= SDVO_AUDIO_ENABLE;
958 954
959 temp = I915_READ(intel_hdmi->hdmi_reg); 955 temp = I915_READ(intel_hdmi->hdmi_reg);
960 956
961 /* HW workaround for IBX, we need to move the port to transcoder A 957 temp |= SDVO_ENABLE;
962 * before disabling it, so restore the transcoder select bit here. */ 958 if (crtc->config->has_audio)
963 if (HAS_PCH_IBX(dev)) 959 temp |= SDVO_AUDIO_ENABLE;
964 enable_bits |= SDVO_PIPE_SEL(intel_crtc->pipe);
965 960
966 /* HW workaround, need to toggle enable bit off and on for 12bpc, but 961 I915_WRITE(intel_hdmi->hdmi_reg, temp);
967 * we do this anyway which shows more stable in testing. 962 POSTING_READ(intel_hdmi->hdmi_reg);
968 */ 963
969 if (HAS_PCH_SPLIT(dev)) { 964 if (crtc->config->has_audio)
970 I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE); 965 intel_enable_hdmi_audio(encoder);
971 POSTING_READ(intel_hdmi->hdmi_reg); 966}
972 } 967
968static void ibx_enable_hdmi(struct intel_encoder *encoder)
969{
970 struct drm_device *dev = encoder->base.dev;
971 struct drm_i915_private *dev_priv = dev->dev_private;
972 struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
973 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
974 u32 temp;
975
976 temp = I915_READ(intel_hdmi->hdmi_reg);
973 977
974 temp |= enable_bits; 978 temp |= SDVO_ENABLE;
979 if (crtc->config->has_audio)
980 temp |= SDVO_AUDIO_ENABLE;
975 981
982 /*
983 * HW workaround, need to write this twice for issue
984 * that may result in first write getting masked.
985 */
986 I915_WRITE(intel_hdmi->hdmi_reg, temp);
987 POSTING_READ(intel_hdmi->hdmi_reg);
976 I915_WRITE(intel_hdmi->hdmi_reg, temp); 988 I915_WRITE(intel_hdmi->hdmi_reg, temp);
977 POSTING_READ(intel_hdmi->hdmi_reg); 989 POSTING_READ(intel_hdmi->hdmi_reg);
978 990
979 /* HW workaround, need to write this twice for issue that may result 991 /*
980 * in first write getting masked. 992 * HW workaround, need to toggle enable bit off and on
993 * for 12bpc with pixel repeat.
994 *
995 * FIXME: BSpec says this should be done at the end of
996 * of the modeset sequence, so not sure if this isn't too soon.
981 */ 997 */
982 if (HAS_PCH_SPLIT(dev)) { 998 if (crtc->config->pipe_bpp > 24 &&
999 crtc->config->pixel_multiplier > 1) {
1000 I915_WRITE(intel_hdmi->hdmi_reg, temp & ~SDVO_ENABLE);
1001 POSTING_READ(intel_hdmi->hdmi_reg);
1002
1003 /*
1004 * HW workaround, need to write this twice for issue
1005 * that may result in first write getting masked.
1006 */
1007 I915_WRITE(intel_hdmi->hdmi_reg, temp);
1008 POSTING_READ(intel_hdmi->hdmi_reg);
983 I915_WRITE(intel_hdmi->hdmi_reg, temp); 1009 I915_WRITE(intel_hdmi->hdmi_reg, temp);
984 POSTING_READ(intel_hdmi->hdmi_reg); 1010 POSTING_READ(intel_hdmi->hdmi_reg);
985 } 1011 }
986 1012
987 if (intel_crtc->config->has_audio) 1013 if (crtc->config->has_audio)
988 intel_enable_hdmi_audio(encoder); 1014 intel_enable_hdmi_audio(encoder);
989} 1015}
990 1016
@@ -1504,7 +1530,7 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
1504 intel_crtc->config->has_hdmi_sink, 1530 intel_crtc->config->has_hdmi_sink,
1505 adjusted_mode); 1531 adjusted_mode);
1506 1532
1507 intel_enable_hdmi(encoder); 1533 g4x_enable_hdmi(encoder);
1508 1534
1509 vlv_wait_port_ready(dev_priv, dport, 0x0); 1535 vlv_wait_port_ready(dev_priv, dport, 0x0);
1510} 1536}
@@ -1821,7 +1847,7 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
1821 intel_crtc->config->has_hdmi_sink, 1847 intel_crtc->config->has_hdmi_sink,
1822 adjusted_mode); 1848 adjusted_mode);
1823 1849
1824 intel_enable_hdmi(encoder); 1850 g4x_enable_hdmi(encoder);
1825 1851
1826 vlv_wait_port_ready(dev_priv, dport, 0x0); 1852 vlv_wait_port_ready(dev_priv, dport, 0x0);
1827} 1853}
@@ -2010,8 +2036,10 @@ void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port)
2010 intel_encoder->pre_enable = intel_hdmi_pre_enable; 2036 intel_encoder->pre_enable = intel_hdmi_pre_enable;
2011 if (HAS_PCH_CPT(dev)) 2037 if (HAS_PCH_CPT(dev))
2012 intel_encoder->enable = cpt_enable_hdmi; 2038 intel_encoder->enable = cpt_enable_hdmi;
2039 else if (HAS_PCH_IBX(dev))
2040 intel_encoder->enable = ibx_enable_hdmi;
2013 else 2041 else
2014 intel_encoder->enable = intel_enable_hdmi; 2042 intel_encoder->enable = g4x_enable_hdmi;
2015 } 2043 }
2016 2044
2017 intel_encoder->type = INTEL_OUTPUT_HDMI; 2045 intel_encoder->type = INTEL_OUTPUT_HDMI;