Commit 0f55db36 authored by Alex Deucher's avatar Alex Deucher

drm/radeon: only mark audio as connected if the monitor supports it (v3)

Otherwise the driver may try and send audio which may confuse the
monitor.

v2: set pin to NULL if no audio
v3: avoid crash with analog encoders
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent 362ff251
...@@ -460,34 +460,37 @@ void radeon_audio_detect(struct drm_connector *connector, ...@@ -460,34 +460,37 @@ void radeon_audio_detect(struct drm_connector *connector,
if (!connector || !connector->encoder) if (!connector || !connector->encoder)
return; return;
if (!radeon_encoder_is_digital(connector->encoder))
return;
rdev = connector->encoder->dev->dev_private; rdev = connector->encoder->dev->dev_private;
radeon_encoder = to_radeon_encoder(connector->encoder); radeon_encoder = to_radeon_encoder(connector->encoder);
dig = radeon_encoder->enc_priv; dig = radeon_encoder->enc_priv;
if (status == connector_status_connected) { if (!dig->afmt)
struct radeon_connector *radeon_connector;
int sink_type;
if (!drm_detect_monitor_audio(radeon_connector_edid(connector))) {
radeon_encoder->audio = NULL;
return; return;
}
radeon_connector = to_radeon_connector(connector); if (status == connector_status_connected) {
sink_type = radeon_dp_getsinktype(radeon_connector); struct radeon_connector *radeon_connector = to_radeon_connector(connector);
if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort &&
sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) radeon_dp_getsinktype(radeon_connector) ==
CONNECTOR_OBJECT_ID_DISPLAYPORT)
radeon_encoder->audio = rdev->audio.dp_funcs; radeon_encoder->audio = rdev->audio.dp_funcs;
else else
radeon_encoder->audio = rdev->audio.hdmi_funcs; radeon_encoder->audio = rdev->audio.hdmi_funcs;
dig->afmt->pin = radeon_audio_get_pin(connector->encoder); dig->afmt->pin = radeon_audio_get_pin(connector->encoder);
if (drm_detect_monitor_audio(radeon_connector_edid(connector))) {
radeon_audio_enable(rdev, dig->afmt->pin, 0xf); radeon_audio_enable(rdev, dig->afmt->pin, 0xf);
} else { } else {
radeon_audio_enable(rdev, dig->afmt->pin, 0); radeon_audio_enable(rdev, dig->afmt->pin, 0);
dig->afmt->pin = NULL; dig->afmt->pin = NULL;
} }
} else {
radeon_audio_enable(rdev, dig->afmt->pin, 0);
dig->afmt->pin = NULL;
}
} }
void radeon_audio_fini(struct radeon_device *rdev) void radeon_audio_fini(struct radeon_device *rdev)
......
...@@ -1379,8 +1379,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) ...@@ -1379,8 +1379,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
/* updated in get modes as well since we need to know if it's analog or digital */ /* updated in get modes as well since we need to know if it's analog or digital */
radeon_connector_update_scratch_regs(connector, ret); radeon_connector_update_scratch_regs(connector, ret);
if (radeon_audio != 0) if (radeon_audio != 0) {
radeon_connector_get_edid(connector);
radeon_audio_detect(connector, ret); radeon_audio_detect(connector, ret);
}
exit: exit:
pm_runtime_mark_last_busy(connector->dev->dev); pm_runtime_mark_last_busy(connector->dev->dev);
...@@ -1717,8 +1719,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force) ...@@ -1717,8 +1719,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
radeon_connector_update_scratch_regs(connector, ret); radeon_connector_update_scratch_regs(connector, ret);
if (radeon_audio != 0) if (radeon_audio != 0) {
radeon_connector_get_edid(connector);
radeon_audio_detect(connector, ret); radeon_audio_detect(connector, ret);
}
out: out:
pm_runtime_mark_last_busy(connector->dev->dev); pm_runtime_mark_last_busy(connector->dev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment