[PATCH 18/24] radeon/audio: moved mute programming to a separate function
Alex Deucher
alexdeucher at gmail.com
Tue Jan 13 09:46:47 PST 2015
From: Slava Grigorev <slava.grigorev at amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
drivers/gpu/drm/radeon/dce3_1_afmt.c | 15 ++++++++++++---
drivers/gpu/drm/radeon/evergreen_hdmi.c | 17 +++++++++++++----
drivers/gpu/drm/radeon/r600_hdmi.c | 16 ++++++++++++----
drivers/gpu/drm/radeon/radeon_audio.c | 19 +++++++++++++++++++
drivers/gpu/drm/radeon/radeon_audio.h | 2 ++
5 files changed, 58 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/radeon/dce3_1_afmt.c b/drivers/gpu/drm/radeon/dce3_1_afmt.c
index fa0e011..b46473a 100644
--- a/drivers/gpu/drm/radeon/dce3_1_afmt.c
+++ b/drivers/gpu/drm/radeon/dce3_1_afmt.c
@@ -220,6 +220,17 @@ void dce3_2_set_audio_packet(struct drm_encoder *encoder, u32 offset)
HDMI0_AUDIO_INFO_LINE(2)); /* anything other than 0 */
}
+void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
+{
+ struct drm_device *dev = encoder->dev;
+ struct radeon_device *rdev = dev->dev_private;
+
+ if (mute)
+ WREG32_OR(HDMI0_GC + offset, HDMI0_GC_AVMUTE);
+ else
+ WREG32_AND(HDMI0_GC + offset, ~HDMI0_GC_AVMUTE);
+}
+
/*
* update the info frames with the data from the current display mode
*/
@@ -246,9 +257,7 @@ void dce3_1_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *m
radeon_audio_set_dto(encoder, mode->clock);
radeon_audio_set_vbi_packet(encoder);
radeon_hdmi_set_color_depth(encoder);
-
- WREG32(HDMI0_GC + offset, 0); /* unset HDMI0_GC_AVMUTE */
-
+ radeon_audio_set_mute(encoder, false);
radeon_audio_update_acr(encoder, mode->clock);
radeon_audio_write_speaker_allocation(encoder);
radeon_audio_set_audio_packet(encoder);
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index 7c7644c..9f35bd0 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -386,6 +386,18 @@ void dce4_set_audio_packet(struct drm_encoder *encoder, u32 offset)
AFMT_AUDIO_SAMPLE_SEND | AFMT_RESET_FIFO_WHEN_AUDIO_DIS | AFMT_60958_CS_UPDATE);
}
+
+void dce4_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
+{
+ struct drm_device *dev = encoder->dev;
+ struct radeon_device *rdev = dev->dev_private;
+
+ if (mute)
+ WREG32_OR(HDMI_GC + offset, HDMI_GC_AVMUTE);
+ else
+ WREG32_AND(HDMI_GC + offset, ~HDMI_GC_AVMUTE);
+}
+
/*
* update the info frames with the data from the current display mode
*/
@@ -412,13 +424,10 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
radeon_audio_set_dto(encoder, mode->clock);
radeon_audio_set_vbi_packet(encoder);
radeon_hdmi_set_color_depth(encoder);
-
- WREG32(HDMI_GC + offset, 0); /* unset HDMI_GC_AVMUTE */
-
+ radeon_audio_set_mute(encoder, false);
radeon_audio_update_acr(encoder, mode->clock);
radeon_audio_write_speaker_allocation(encoder);
radeon_audio_set_audio_packet(encoder);
-
radeon_audio_select_pin(encoder);
radeon_audio_write_sad_regs(encoder);
radeon_audio_write_latency_fields(encoder, mode);
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index b433823..a4c2ce9 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -389,6 +389,17 @@ void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset)
~HDMI0_60958_CS_CHANNEL_NUMBER_R_MASK);
}
+void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
+{
+ struct drm_device *dev = encoder->dev;
+ struct radeon_device *rdev = dev->dev_private;
+
+ if (mute)
+ WREG32_OR(HDMI0_GC + offset, HDMI0_GC_AVMUTE);
+ else
+ WREG32_AND(HDMI0_GC + offset, ~HDMI0_GC_AVMUTE);
+}
+
/*
* update the info frames with the data from the current display mode
*/
@@ -415,10 +426,7 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod
radeon_audio_set_dto(encoder, mode->clock);
radeon_audio_set_vbi_packet(encoder);
radeon_hdmi_set_color_depth(encoder);
-
- WREG32_AND(HDMI0_GC + offset,
- ~HDMI0_GC_AVMUTE); /* unset HDMI0_GC_AVMUTE */
-
+ radeon_audio_set_mute(encoder, false);
radeon_audio_update_acr(encoder, mode->clock);
radeon_audio_set_audio_packet(encoder);
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
index 728a416..bbfdce3 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -92,6 +92,9 @@ void dce4_hdmi_set_color_depth(struct drm_encoder *encoder,
void r600_set_audio_packet(struct drm_encoder *encoder, u32 offset);
void dce3_2_set_audio_packet(struct drm_encoder *encoder, u32 offset);
void dce4_set_audio_packet(struct drm_encoder *encoder, u32 offset);
+void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
+void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
+void dce4_set_mute(struct drm_encoder *encoder, u32 offset, bool mute);
static const u32 pin_offsets[7] =
{
@@ -146,6 +149,7 @@ static struct radeon_audio_funcs r600_hdmi_funcs = {
.set_vbi_packet = r600_set_vbi_packet,
.set_avi_packet = r600_set_avi_packet,
.set_audio_packet = r600_set_audio_packet,
+ .set_mute = r600_set_mute,
};
static struct radeon_audio_funcs dce32_hdmi_funcs = {
@@ -157,6 +161,7 @@ static struct radeon_audio_funcs dce32_hdmi_funcs = {
.set_vbi_packet = r600_set_vbi_packet,
.set_avi_packet = r600_set_avi_packet,
.set_audio_packet = dce3_2_set_audio_packet,
+ .set_mute = dce3_2_set_mute,
};
static struct radeon_audio_funcs dce32_dp_funcs = {
@@ -178,6 +183,7 @@ static struct radeon_audio_funcs dce4_hdmi_funcs = {
.set_color_depth = dce4_hdmi_set_color_depth,
.set_avi_packet = evergreen_set_avi_packet,
.set_audio_packet = dce4_set_audio_packet,
+ .set_mute = dce4_set_mute,
};
static struct radeon_audio_funcs dce4_dp_funcs = {
@@ -200,6 +206,7 @@ static struct radeon_audio_funcs dce6_hdmi_funcs = {
.set_color_depth = dce4_hdmi_set_color_depth,
.set_avi_packet = evergreen_set_avi_packet,
.set_audio_packet = dce4_set_audio_packet,
+ .set_mute = dce4_set_mute,
};
static struct radeon_audio_funcs dce6_dp_funcs = {
@@ -635,3 +642,15 @@ void radeon_audio_set_audio_packet(struct drm_encoder *encoder)
if (radeon_encoder->audio && radeon_encoder->audio->set_audio_packet)
radeon_encoder->audio->set_audio_packet(encoder, dig->afmt->offset);
}
+
+void radeon_audio_set_mute(struct drm_encoder *encoder, bool mute)
+{
+ struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+ struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
+
+ if (!dig || !dig->afmt)
+ return;
+
+ if (radeon_encoder->audio && radeon_encoder->audio->set_mute)
+ radeon_encoder->audio->set_mute(encoder, dig->afmt->offset, mute);
+}
diff --git a/drivers/gpu/drm/radeon/radeon_audio.h b/drivers/gpu/drm/radeon/radeon_audio.h
index cefe457..5ca5e7e 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.h
+++ b/drivers/gpu/drm/radeon/radeon_audio.h
@@ -60,6 +60,7 @@ struct radeon_audio_funcs
void (*set_avi_packet)(struct radeon_device *rdev, u32 offset,
unsigned char *buffer, size_t size);
void (*set_audio_packet)(struct drm_encoder *encoder, u32 offset);
+ void (*set_mute)(struct drm_encoder *encoder, u32 offset, bool mute);
};
int radeon_audio_init(struct radeon_device *rdev);
@@ -85,5 +86,6 @@ void radeon_audio_update_acr(struct drm_encoder *encoder, unsigned int clock);
void radeon_audio_set_vbi_packet(struct drm_encoder *encoder);
void radeon_hdmi_set_color_depth(struct drm_encoder *encoder);
void radeon_audio_set_audio_packet(struct drm_encoder *encoder);
+void radeon_audio_set_mute(struct drm_encoder *encoder, bool mute);
#endif
--
1.8.3.1
More information about the dri-devel
mailing list