drm/i915/sdvo: Shut up state checker with hdmi cards on gen3
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 26 Jul 2017 19:32:51 +0000 (21:32 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 27 Jul 2017 08:06:21 +0000 (10:06 +0200)
The hdmi bits simply don't exist, so nerf them. I think audio doesn't
work on gen3 at all, and for the limited color range we should
probably use the colorimetry sdvo paramater instead of the bit in the
port.

But fixing sdvo isn't my goal, I just want to get the backtrace out of
the way, and this takes care of that.

Still, while at it fix the missing read-out of the gen4 audio bit,
maybe that part even works ...

v2: Instead of trying to plug the damage in ->compute_config() make
sure we never set intel_sdvo->is_hdmi, which stops the bad state at
the source. Suggested by Chris Wilson. Also make sure we don't break
this by accident by putting a WARN_ON in place.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170726193251.25393-1-daniel.vetter@ffwll.ch
drivers/gpu/drm/i915/intel_sdvo.c

index c14c05e..ab01f9e 100644 (file)
@@ -1359,8 +1359,10 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder,
        else
                sdvox |= SDVO_PIPE_SEL(crtc->pipe);
 
-       if (crtc_state->has_audio)
+       if (crtc_state->has_audio) {
+               WARN_ON_ONCE(INTEL_GEN(dev_priv) < 4);
                sdvox |= SDVO_AUDIO_ENABLE;
+       }
 
        if (INTEL_GEN(dev_priv) >= 4) {
                /* done in crtc_mode_set as the dpll_md reg must be written early */
@@ -1490,6 +1492,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
        if (sdvox & HDMI_COLOR_RANGE_16_235)
                pipe_config->limited_color_range = true;
 
+       if (sdvox & SDVO_AUDIO_ENABLE)
+               pipe_config->has_audio = true;
+
        if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE,
                                 &val, 1)) {
                if (val == SDVO_ENCODE_HDMI)
@@ -2465,6 +2470,7 @@ static bool
 intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
 {
        struct drm_encoder *encoder = &intel_sdvo->base.base;
+       struct drm_i915_private *dev_priv = to_i915(encoder->dev);
        struct drm_connector *connector;
        struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
        struct intel_connector *intel_connector;
@@ -2500,7 +2506,9 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
        encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
        connector->connector_type = DRM_MODE_CONNECTOR_DVID;
 
-       if (intel_sdvo_is_hdmi_connector(intel_sdvo, device)) {
+       /* gen3 doesn't do the hdmi bits in the SDVO register */
+       if (INTEL_GEN(dev_priv) >= 4 &&
+           intel_sdvo_is_hdmi_connector(intel_sdvo, device)) {
                connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
                intel_sdvo->is_hdmi = true;
        }