Skip to content

Commit

Permalink
drm/i915: always update ELD connector type after get modes
Browse files Browse the repository at this point in the history
drm_edid_to_eld() initializes the connector ELD to zero, overwriting the
ELD connector type initialized in intel_audio_codec_enable(). If
userspace does getconnector and thus get_modes after modeset, a
subsequent audio component i915_audio_component_get_eld() call will
receive an ELD without the connector type properly set. It's fine for
HDMI, but screws up audio for DP.

Always set the ELD connector type at intel_connector_update_modes()
based on the connector type. We can drop the connector type update from
intel_audio_codec_enable().

Credits to Joseph Nuzman <[email protected]> for figuring this out.

Cc: Ville Syrjälä <[email protected]>
Cc: Joseph Nuzman <[email protected]>
Reported-by: Joseph Nuzman <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101583
Reviewed-by: Ville Syrjälä <[email protected]>
Tested-by: Joseph Nuzman <[email protected]>
Cc: [email protected] # v4.10+, maybe earlier
Signed-off-by: Jani Nikula <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit d81fb7f)
Signed-off-by: Rodrigo Vivi <[email protected]>
  • Loading branch information
jnikula authored and rodrigovivi committed Sep 26, 2017
1 parent e365806 commit 2d8f632
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 0 additions & 5 deletions drivers/gpu/drm/i915/intel_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,6 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
connector->encoder->base.id,
connector->encoder->name);

/* ELD Conn_Type */
connector->eld[5] &= ~(3 << 2);
if (intel_crtc_has_dp_encoder(crtc_state))
connector->eld[5] |= (1 << 2);

connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;

if (dev_priv->display.audio_codec_enable)
Expand Down
17 changes: 17 additions & 0 deletions drivers/gpu/drm/i915/intel_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
#include "intel_drv.h"
#include "i915_drv.h"

static void intel_connector_update_eld_conn_type(struct drm_connector *connector)
{
u8 conn_type;

if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
conn_type = DRM_ELD_CONN_TYPE_DP;
} else {
conn_type = DRM_ELD_CONN_TYPE_HDMI;
}

connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] &= ~DRM_ELD_CONN_TYPE_MASK;
connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= conn_type;
}

/**
* intel_connector_update_modes - update connector from edid
* @connector: DRM connector device to use
Expand All @@ -44,6 +59,8 @@ int intel_connector_update_modes(struct drm_connector *connector,
ret = drm_add_edid_modes(connector, edid);
drm_edid_to_eld(connector, edid);

intel_connector_update_eld_conn_type(connector);

return ret;
}

Expand Down

0 comments on commit 2d8f632

Please sign in to comment.