From 88252d7728f414a838f6a7cfbe895ba708e8d26d Mon Sep 17 00:00:00 2001 From: Slava Grigorev Date: Tue, 2 Dec 2014 17:27:29 -0500 Subject: [PATCH] radeon/audio: consolidate select_pin() functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Christian König Signed-off-by: Slava Grigorev Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/evergreen_hdmi.c | 6 +----- drivers/gpu/drm/radeon/radeon_audio.c | 11 +++++++++++ drivers/gpu/drm/radeon/radeon_audio.h | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 26d8cd5c20a1..6bd113bc6551 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c @@ -33,8 +33,6 @@ #include "evergreend.h" #include "atom.h" -extern void dce6_afmt_select_pin(struct drm_encoder *encoder); - /* enable the audio stream */ static void dce4_audio_enable(struct radeon_device *rdev, struct r600_audio_pin *pin, @@ -401,9 +399,7 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode /* fglrx sets 0x40 in 0x5f80 here */ - if (ASIC_IS_DCE6(rdev)) - dce6_afmt_select_pin(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/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c index 795f84c8187e..5aedf5b97b96 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.c +++ b/drivers/gpu/drm/radeon/radeon_audio.c @@ -59,6 +59,7 @@ void dce6_afmt_write_latency_fields(struct drm_encoder *encoder, struct drm_connector *connector, struct drm_display_mode *mode); struct r600_audio_pin* r600_audio_get_pin(struct radeon_device *rdev); struct r600_audio_pin* dce6_audio_get_pin(struct radeon_device *rdev); +void dce6_afmt_select_pin(struct drm_encoder *encoder); static const u32 pin_offsets[7] = { @@ -124,6 +125,7 @@ static struct radeon_audio_funcs dce4_dp_funcs = { }; static struct radeon_audio_funcs dce6_hdmi_funcs = { + .select_pin = dce6_afmt_select_pin, .get_pin = dce6_audio_get_pin, .write_sad_regs = dce6_afmt_write_sad_regs, .write_speaker_allocation = dce6_afmt_hdmi_write_speaker_allocation, @@ -131,6 +133,7 @@ static struct radeon_audio_funcs dce6_hdmi_funcs = { }; static struct radeon_audio_funcs dce6_dp_funcs = { + .select_pin = dce6_afmt_select_pin, .get_pin = dce6_audio_get_pin, .write_sad_regs = dce6_afmt_write_sad_regs, .write_speaker_allocation = dce6_afmt_dp_write_speaker_allocation, @@ -360,3 +363,11 @@ struct r600_audio_pin* radeon_audio_get_pin(struct drm_encoder *encoder) return NULL; } + +void radeon_audio_select_pin(struct drm_encoder *encoder) +{ + struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); + + if (radeon_encoder->audio && radeon_encoder->audio->select_pin) + radeon_encoder->audio->select_pin(encoder); +} diff --git a/drivers/gpu/drm/radeon/radeon_audio.h b/drivers/gpu/drm/radeon/radeon_audio.h index 492f98b4df78..36d329a413c1 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.h +++ b/drivers/gpu/drm/radeon/radeon_audio.h @@ -41,6 +41,7 @@ struct radeon_audio_basic_funcs struct radeon_audio_funcs { + void (*select_pin)(struct drm_encoder *encoder); struct r600_audio_pin* (*get_pin)(struct radeon_device *rdev); void (*write_latency_fields)(struct drm_encoder *encoder, struct drm_connector *connector, struct drm_display_mode *mode); @@ -62,5 +63,6 @@ void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder); void radeon_audio_write_latency_fields(struct drm_encoder *encoder, struct drm_display_mode *mode); struct r600_audio_pin *radeon_audio_get_pin(struct drm_encoder *encoder); +void radeon_audio_select_pin(struct drm_encoder *encoder); #endif -- 2.39.5