Commit add7d759 authored by Alex Deucher's avatar Alex Deucher

drm/radeon: fix the audio dpms callbacks

Don't touch the audio enable bits as these are already
handled in display detection.  Enable the hdmi secondary
streams in hdmi enable to match dp.  Rename dp dpms
callback to be consistent with hdmi.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=89327
https://bugzilla.kernel.org/show_bug.cgi?id=93921Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ed9ed50c
...@@ -288,36 +288,26 @@ void dce6_dp_audio_set_dto(struct radeon_device *rdev, ...@@ -288,36 +288,26 @@ void dce6_dp_audio_set_dto(struct radeon_device *rdev,
WREG32(DCCG_AUDIO_DTO1_MODULE, clock); WREG32(DCCG_AUDIO_DTO1_MODULE, clock);
} }
void dce6_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable) void dce6_dp_enable(struct drm_encoder *encoder, bool enable)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct radeon_device *rdev = dev->dev_private; struct radeon_device *rdev = dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
uint32_t offset;
if (!dig || !dig->afmt) if (!dig || !dig->afmt)
return; return;
offset = dig->afmt->offset;
if (enable) { if (enable) {
if (dig->afmt->enabled) WREG32(EVERGREEN_DP_SEC_TIMESTAMP + dig->afmt->offset,
return; EVERGREEN_DP_SEC_TIMESTAMP_MODE(1));
WREG32(EVERGREEN_DP_SEC_CNTL + dig->afmt->offset,
WREG32(EVERGREEN_DP_SEC_TIMESTAMP + offset, EVERGREEN_DP_SEC_TIMESTAMP_MODE(1));
WREG32(EVERGREEN_DP_SEC_CNTL + offset,
EVERGREEN_DP_SEC_ASP_ENABLE | /* Audio packet transmission */ EVERGREEN_DP_SEC_ASP_ENABLE | /* Audio packet transmission */
EVERGREEN_DP_SEC_ATP_ENABLE | /* Audio timestamp packet transmission */ EVERGREEN_DP_SEC_ATP_ENABLE | /* Audio timestamp packet transmission */
EVERGREEN_DP_SEC_AIP_ENABLE | /* Audio infoframe packet transmission */ EVERGREEN_DP_SEC_AIP_ENABLE | /* Audio infoframe packet transmission */
EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */ EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */
radeon_audio_enable(rdev, dig->afmt->pin, true);
} else { } else {
if (!dig->afmt->enabled) WREG32(EVERGREEN_DP_SEC_CNTL + dig->afmt->offset, 0);
return;
WREG32(EVERGREEN_DP_SEC_CNTL + offset, 0);
radeon_audio_enable(rdev, dig->afmt->pin, false);
} }
dig->afmt->enabled = enable; dig->afmt->enabled = enable;
......
...@@ -350,20 +350,9 @@ void dce4_set_audio_packet(struct drm_encoder *encoder, u32 offset) ...@@ -350,20 +350,9 @@ void dce4_set_audio_packet(struct drm_encoder *encoder, u32 offset)
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct radeon_device *rdev = dev->dev_private; struct radeon_device *rdev = dev->dev_private;
WREG32(HDMI_INFOFRAME_CONTROL0 + offset,
HDMI_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */
HDMI_AUDIO_INFO_CONT); /* required for audio info values to be updated */
WREG32(AFMT_INFOFRAME_CONTROL0 + offset, WREG32(AFMT_INFOFRAME_CONTROL0 + offset,
AFMT_AUDIO_INFO_UPDATE); /* required for audio info values to be updated */ AFMT_AUDIO_INFO_UPDATE); /* required for audio info values to be updated */
WREG32(HDMI_INFOFRAME_CONTROL1 + offset,
HDMI_AUDIO_INFO_LINE(2)); /* anything other than 0 */
WREG32(HDMI_AUDIO_PACKET_CONTROL + offset,
HDMI_AUDIO_DELAY_EN(1) | /* set the default audio delay */
HDMI_AUDIO_PACKETS_PER_LINE(3)); /* should be suffient for all audio modes and small enough for all hblanks */
WREG32(AFMT_60958_0 + offset, WREG32(AFMT_60958_0 + offset,
AFMT_60958_CS_CHANNEL_NUMBER_L(1)); AFMT_60958_CS_CHANNEL_NUMBER_L(1));
...@@ -408,15 +397,19 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) ...@@ -408,15 +397,19 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable)
if (!dig || !dig->afmt) if (!dig || !dig->afmt)
return; return;
/* Silent, r600_hdmi_enable will raise WARN for us */ if (enable) {
if (enable && dig->afmt->enabled) WREG32(HDMI_INFOFRAME_CONTROL1 + dig->afmt->offset,
return; HDMI_AUDIO_INFO_LINE(2)); /* anything other than 0 */
if (!enable && !dig->afmt->enabled)
return;
if (!enable && dig->afmt->pin) { WREG32(HDMI_AUDIO_PACKET_CONTROL + dig->afmt->offset,
radeon_audio_enable(rdev, dig->afmt->pin, 0); HDMI_AUDIO_DELAY_EN(1) | /* set the default audio delay */
dig->afmt->pin = NULL; HDMI_AUDIO_PACKETS_PER_LINE(3)); /* should be suffient for all audio modes and small enough for all hblanks */
WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset,
HDMI_AUDIO_INFO_SEND | /* enable audio info frames (frames won't be set until audio is enabled) */
HDMI_AUDIO_INFO_CONT); /* required for audio info values to be updated */
} else {
WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, 0);
} }
dig->afmt->enabled = enable; dig->afmt->enabled = enable;
...@@ -425,33 +418,28 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) ...@@ -425,33 +418,28 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable)
enable ? "En" : "Dis", dig->afmt->offset, radeon_encoder->encoder_id); enable ? "En" : "Dis", dig->afmt->offset, radeon_encoder->encoder_id);
} }
void evergreen_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable) void evergreen_dp_enable(struct drm_encoder *encoder, bool enable)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct radeon_device *rdev = dev->dev_private; struct radeon_device *rdev = dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
uint32_t offset;
if (!dig || !dig->afmt) if (!dig || !dig->afmt)
return; return;
offset = dig->afmt->offset;
if (enable) { if (enable) {
struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
struct radeon_connector *radeon_connector = to_radeon_connector(connector); struct radeon_connector *radeon_connector = to_radeon_connector(connector);
struct radeon_connector_atom_dig *dig_connector; struct radeon_connector_atom_dig *dig_connector;
uint32_t val; uint32_t val;
if (dig->afmt->enabled) WREG32(EVERGREEN_DP_SEC_TIMESTAMP + dig->afmt->offset,
return; EVERGREEN_DP_SEC_TIMESTAMP_MODE(1));
WREG32(EVERGREEN_DP_SEC_TIMESTAMP + offset, EVERGREEN_DP_SEC_TIMESTAMP_MODE(1));
if (radeon_connector->con_priv) { if (radeon_connector->con_priv) {
dig_connector = radeon_connector->con_priv; dig_connector = radeon_connector->con_priv;
val = RREG32(EVERGREEN_DP_SEC_AUD_N + offset); val = RREG32(EVERGREEN_DP_SEC_AUD_N + dig->afmt->offset);
val &= ~EVERGREEN_DP_SEC_N_BASE_MULTIPLE(0xf); val &= ~EVERGREEN_DP_SEC_N_BASE_MULTIPLE(0xf);
if (dig_connector->dp_clock == 162000) if (dig_connector->dp_clock == 162000)
...@@ -459,21 +447,16 @@ void evergreen_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable) ...@@ -459,21 +447,16 @@ void evergreen_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable)
else else
val |= EVERGREEN_DP_SEC_N_BASE_MULTIPLE(5); val |= EVERGREEN_DP_SEC_N_BASE_MULTIPLE(5);
WREG32(EVERGREEN_DP_SEC_AUD_N + offset, val); WREG32(EVERGREEN_DP_SEC_AUD_N + dig->afmt->offset, val);
} }
WREG32(EVERGREEN_DP_SEC_CNTL + offset, WREG32(EVERGREEN_DP_SEC_CNTL + dig->afmt->offset,
EVERGREEN_DP_SEC_ASP_ENABLE | /* Audio packet transmission */ EVERGREEN_DP_SEC_ASP_ENABLE | /* Audio packet transmission */
EVERGREEN_DP_SEC_ATP_ENABLE | /* Audio timestamp packet transmission */ EVERGREEN_DP_SEC_ATP_ENABLE | /* Audio timestamp packet transmission */
EVERGREEN_DP_SEC_AIP_ENABLE | /* Audio infoframe packet transmission */ EVERGREEN_DP_SEC_AIP_ENABLE | /* Audio infoframe packet transmission */
EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */ EVERGREEN_DP_SEC_STREAM_ENABLE); /* Master enable for secondary stream engine */
radeon_audio_enable(rdev, dig->afmt->pin, 0xf);
} else { } else {
if (!dig->afmt->enabled) WREG32(EVERGREEN_DP_SEC_CNTL + dig->afmt->offset, 0);
return;
WREG32(EVERGREEN_DP_SEC_CNTL + offset, 0);
radeon_audio_enable(rdev, dig->afmt->pin, 0);
} }
dig->afmt->enabled = enable; dig->afmt->enabled = enable;
......
...@@ -476,17 +476,6 @@ void r600_hdmi_enable(struct drm_encoder *encoder, bool enable) ...@@ -476,17 +476,6 @@ void r600_hdmi_enable(struct drm_encoder *encoder, bool enable)
if (!dig || !dig->afmt) if (!dig || !dig->afmt)
return; return;
/* Silent, r600_hdmi_enable will raise WARN for us */
if (enable && dig->afmt->enabled)
return;
if (!enable && !dig->afmt->enabled)
return;
if (!enable && dig->afmt->pin) {
radeon_audio_enable(rdev, dig->afmt->pin, 0);
dig->afmt->pin = NULL;
}
/* Older chipsets require setting HDMI and routing manually */ /* Older chipsets require setting HDMI and routing manually */
if (!ASIC_IS_DCE3(rdev)) { if (!ASIC_IS_DCE3(rdev)) {
if (enable) if (enable)
......
...@@ -101,8 +101,8 @@ static void radeon_audio_dp_mode_set(struct drm_encoder *encoder, ...@@ -101,8 +101,8 @@ static void radeon_audio_dp_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode); struct drm_display_mode *mode);
void r600_hdmi_enable(struct drm_encoder *encoder, bool enable); void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable); void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable);
void evergreen_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable); void evergreen_dp_enable(struct drm_encoder *encoder, bool enable);
void dce6_enable_dp_audio_packets(struct drm_encoder *encoder, bool enable); void dce6_dp_enable(struct drm_encoder *encoder, bool enable);
static const u32 pin_offsets[7] = static const u32 pin_offsets[7] =
{ {
...@@ -210,7 +210,7 @@ static struct radeon_audio_funcs dce4_dp_funcs = { ...@@ -210,7 +210,7 @@ static struct radeon_audio_funcs dce4_dp_funcs = {
.set_avi_packet = evergreen_set_avi_packet, .set_avi_packet = evergreen_set_avi_packet,
.set_audio_packet = dce4_set_audio_packet, .set_audio_packet = dce4_set_audio_packet,
.mode_set = radeon_audio_dp_mode_set, .mode_set = radeon_audio_dp_mode_set,
.dpms = evergreen_enable_dp_audio_packets, .dpms = evergreen_dp_enable,
}; };
static struct radeon_audio_funcs dce6_hdmi_funcs = { static struct radeon_audio_funcs dce6_hdmi_funcs = {
...@@ -240,7 +240,7 @@ static struct radeon_audio_funcs dce6_dp_funcs = { ...@@ -240,7 +240,7 @@ static struct radeon_audio_funcs dce6_dp_funcs = {
.set_avi_packet = evergreen_set_avi_packet, .set_avi_packet = evergreen_set_avi_packet,
.set_audio_packet = dce4_set_audio_packet, .set_audio_packet = dce4_set_audio_packet,
.mode_set = radeon_audio_dp_mode_set, .mode_set = radeon_audio_dp_mode_set,
.dpms = dce6_enable_dp_audio_packets, .dpms = dce6_dp_enable,
}; };
static void radeon_audio_interface_init(struct radeon_device *rdev) static void radeon_audio_interface_init(struct radeon_device *rdev)
......
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