aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2015-04-07 10:20:49 -0400
committerAlex Deucher <alexander.deucher@amd.com>2015-04-27 09:54:56 -0400
commit38aef1549b18539eaecd804383a6ccb6588a9ce1 (patch)
tree72a406d7e107d9d9c1b3a98c7212cc3d774ee426 /drivers
parent0f55db36d49d45b80eff0c0a2a498766016f458b (diff)
drm/radeon: only enable audio streams if the monitor supports it
Selectively enable which packets we send based on monitor caps. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/radeon/atombios_encoders.c6
-rw-r--r--drivers/gpu/drm/radeon/evergreen_hdmi.c27
2 files changed, 21 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index f57c1ab617bc..dd39f434b4a7 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -1761,17 +1761,15 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode)
1761 struct drm_device *dev = encoder->dev; 1761 struct drm_device *dev = encoder->dev;
1762 struct radeon_device *rdev = dev->dev_private; 1762 struct radeon_device *rdev = dev->dev_private;
1763 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1763 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1764 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
1765 int encoder_mode = atombios_get_encoder_mode(encoder); 1764 int encoder_mode = atombios_get_encoder_mode(encoder);
1766 1765
1767 DRM_DEBUG_KMS("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n", 1766 DRM_DEBUG_KMS("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n",
1768 radeon_encoder->encoder_id, mode, radeon_encoder->devices, 1767 radeon_encoder->encoder_id, mode, radeon_encoder->devices,
1769 radeon_encoder->active_device); 1768 radeon_encoder->active_device);
1770 1769
1771 if (connector && (radeon_audio != 0) && 1770 if ((radeon_audio != 0) &&
1772 ((encoder_mode == ATOM_ENCODER_MODE_HDMI) || 1771 ((encoder_mode == ATOM_ENCODER_MODE_HDMI) ||
1773 (ENCODER_MODE_IS_DP(encoder_mode) && 1772 ENCODER_MODE_IS_DP(encoder_mode)))
1774 drm_detect_monitor_audio(radeon_connector_edid(connector)))))
1775 radeon_audio_dpms(encoder, mode); 1773 radeon_audio_dpms(encoder, mode);
1776 1774
1777 switch (radeon_encoder->encoder_id) { 1775 switch (radeon_encoder->encoder_id) {
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index 9e1cd0cfcd55..0926739c9fa7 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -398,13 +398,23 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable)
398 return; 398 return;
399 399
400 if (enable) { 400 if (enable) {
401 WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, 401 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
402 HDMI_AVI_INFO_SEND | /* enable AVI info frames */ 402
403 HDMI_AVI_INFO_CONT | /* required for audio info values to be updated */ 403 if (drm_detect_monitor_audio(radeon_connector_edid(connector))) {
404 HDMI_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */ 404 WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset,
405 HDMI_AUDIO_INFO_CONT); /* required for audio info values to be updated */ 405 HDMI_AVI_INFO_SEND | /* enable AVI info frames */
406 WREG32_OR(AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, 406 HDMI_AVI_INFO_CONT | /* required for audio info values to be updated */
407 AFMT_AUDIO_SAMPLE_SEND); 407 HDMI_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */
408 HDMI_AUDIO_INFO_CONT); /* required for audio info values to be updated */
409 WREG32_OR(AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset,
410 AFMT_AUDIO_SAMPLE_SEND);
411 } else {
412 WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset,
413 HDMI_AVI_INFO_SEND | /* enable AVI info frames */
414 HDMI_AVI_INFO_CONT); /* required for audio info values to be updated */
415 WREG32_AND(AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset,
416 ~AFMT_AUDIO_SAMPLE_SEND);
417 }
408 } else { 418 } else {
409 WREG32_AND(AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset, 419 WREG32_AND(AFMT_AUDIO_PACKET_CONTROL + dig->afmt->offset,
410 ~AFMT_AUDIO_SAMPLE_SEND); 420 ~AFMT_AUDIO_SAMPLE_SEND);
@@ -423,11 +433,12 @@ void evergreen_dp_enable(struct drm_encoder *encoder, bool enable)
423 struct radeon_device *rdev = dev->dev_private; 433 struct radeon_device *rdev = dev->dev_private;
424 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 434 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
425 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; 435 struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
436 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
426 437
427 if (!dig || !dig->afmt) 438 if (!dig || !dig->afmt)
428 return; 439 return;
429 440
430 if (enable) { 441 if (enable && drm_detect_monitor_audio(radeon_connector_edid(connector))) {
431 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); 442 struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
432 struct radeon_connector *radeon_connector = to_radeon_connector(connector); 443 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
433 struct radeon_connector_atom_dig *dig_connector; 444 struct radeon_connector_atom_dig *dig_connector;