提交 3cdde027 编写于 作者: S Slava Grigorev 提交者: Alex Deucher

radeon/audio: consolidate audio_get_pin() functions

Reviewed-by: NChristian König <christian.koenig@amd.com>
Signed-off-by: NSlava Grigorev <slava.grigorev@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 87654f87
...@@ -136,7 +136,7 @@ void dce3_1_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *m ...@@ -136,7 +136,7 @@ void dce3_1_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *m
offset = dig->afmt->offset; offset = dig->afmt->offset;
/* disable audio prior to setting up hw */ /* disable audio prior to setting up hw */
dig->afmt->pin = r600_audio_get_pin(rdev); dig->afmt->pin = radeon_audio_get_pin(encoder);
r600_audio_enable(rdev, dig->afmt->pin, 0); r600_audio_enable(rdev, dig->afmt->pin, 0);
r600_audio_set_dto(encoder, mode->clock); r600_audio_set_dto(encoder, mode->clock);
......
...@@ -301,11 +301,10 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode ...@@ -301,11 +301,10 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode
} }
/* disable audio prior to setting up hw */ /* disable audio prior to setting up hw */
dig->afmt->pin = radeon_audio_get_pin(encoder);
if (ASIC_IS_DCE6(rdev)) { if (ASIC_IS_DCE6(rdev)) {
dig->afmt->pin = dce6_audio_get_pin(rdev);
dce6_audio_enable(rdev, dig->afmt->pin, 0); dce6_audio_enable(rdev, dig->afmt->pin, 0);
} else { } else {
dig->afmt->pin = r600_audio_get_pin(rdev);
dce4_audio_enable(rdev, dig->afmt->pin, 0); dce4_audio_enable(rdev, dig->afmt->pin, 0);
} }
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <drm/radeon_drm.h> #include <drm/radeon_drm.h>
#include "radeon.h" #include "radeon.h"
#include "radeon_asic.h" #include "radeon_asic.h"
#include "radeon_audio.h"
#include "r600d.h" #include "r600d.h"
#include "atom.h" #include "atom.h"
...@@ -487,7 +488,7 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod ...@@ -487,7 +488,7 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod
offset = dig->afmt->offset; offset = dig->afmt->offset;
/* disable audio prior to setting up hw */ /* disable audio prior to setting up hw */
dig->afmt->pin = r600_audio_get_pin(rdev); dig->afmt->pin = radeon_audio_get_pin(encoder);
r600_audio_enable(rdev, dig->afmt->pin, 0xf); r600_audio_enable(rdev, dig->afmt->pin, 0xf);
r600_audio_set_dto(encoder, mode->clock); r600_audio_set_dto(encoder, mode->clock);
......
...@@ -57,6 +57,8 @@ void dce4_afmt_write_latency_fields(struct drm_encoder *encoder, ...@@ -57,6 +57,8 @@ void dce4_afmt_write_latency_fields(struct drm_encoder *encoder,
struct drm_connector *connector, struct drm_display_mode *mode); struct drm_connector *connector, struct drm_display_mode *mode);
void dce6_afmt_write_latency_fields(struct drm_encoder *encoder, void dce6_afmt_write_latency_fields(struct drm_encoder *encoder,
struct drm_connector *connector, struct drm_display_mode *mode); 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);
static const u32 pin_offsets[7] = static const u32 pin_offsets[7] =
{ {
...@@ -96,34 +98,40 @@ static struct radeon_audio_basic_funcs dce6_funcs = { ...@@ -96,34 +98,40 @@ static struct radeon_audio_basic_funcs dce6_funcs = {
}; };
static struct radeon_audio_funcs dce32_hdmi_funcs = { static struct radeon_audio_funcs dce32_hdmi_funcs = {
.get_pin = r600_audio_get_pin,
.write_sad_regs = dce3_2_afmt_write_sad_regs, .write_sad_regs = dce3_2_afmt_write_sad_regs,
.write_speaker_allocation = dce3_2_afmt_hdmi_write_speaker_allocation, .write_speaker_allocation = dce3_2_afmt_hdmi_write_speaker_allocation,
}; };
static struct radeon_audio_funcs dce32_dp_funcs = { static struct radeon_audio_funcs dce32_dp_funcs = {
.get_pin = r600_audio_get_pin,
.write_sad_regs = dce3_2_afmt_write_sad_regs, .write_sad_regs = dce3_2_afmt_write_sad_regs,
.write_speaker_allocation = dce3_2_afmt_dp_write_speaker_allocation, .write_speaker_allocation = dce3_2_afmt_dp_write_speaker_allocation,
}; };
static struct radeon_audio_funcs dce4_hdmi_funcs = { static struct radeon_audio_funcs dce4_hdmi_funcs = {
.get_pin = r600_audio_get_pin,
.write_sad_regs = evergreen_hdmi_write_sad_regs, .write_sad_regs = evergreen_hdmi_write_sad_regs,
.write_speaker_allocation = dce4_afmt_hdmi_write_speaker_allocation, .write_speaker_allocation = dce4_afmt_hdmi_write_speaker_allocation,
.write_latency_fields = dce4_afmt_write_latency_fields, .write_latency_fields = dce4_afmt_write_latency_fields,
}; };
static struct radeon_audio_funcs dce4_dp_funcs = { static struct radeon_audio_funcs dce4_dp_funcs = {
.get_pin = r600_audio_get_pin,
.write_sad_regs = evergreen_hdmi_write_sad_regs, .write_sad_regs = evergreen_hdmi_write_sad_regs,
.write_speaker_allocation = dce4_afmt_dp_write_speaker_allocation, .write_speaker_allocation = dce4_afmt_dp_write_speaker_allocation,
.write_latency_fields = dce4_afmt_write_latency_fields, .write_latency_fields = dce4_afmt_write_latency_fields,
}; };
static struct radeon_audio_funcs dce6_hdmi_funcs = { static struct radeon_audio_funcs dce6_hdmi_funcs = {
.get_pin = dce6_audio_get_pin,
.write_sad_regs = dce6_afmt_write_sad_regs, .write_sad_regs = dce6_afmt_write_sad_regs,
.write_speaker_allocation = dce6_afmt_hdmi_write_speaker_allocation, .write_speaker_allocation = dce6_afmt_hdmi_write_speaker_allocation,
.write_latency_fields = dce6_afmt_write_latency_fields, .write_latency_fields = dce6_afmt_write_latency_fields,
}; };
static struct radeon_audio_funcs dce6_dp_funcs = { static struct radeon_audio_funcs dce6_dp_funcs = {
.get_pin = dce6_audio_get_pin,
.write_sad_regs = dce6_afmt_write_sad_regs, .write_sad_regs = dce6_afmt_write_sad_regs,
.write_speaker_allocation = dce6_afmt_dp_write_speaker_allocation, .write_speaker_allocation = dce6_afmt_dp_write_speaker_allocation,
.write_latency_fields = dce6_afmt_write_latency_fields, .write_latency_fields = dce6_afmt_write_latency_fields,
...@@ -341,3 +349,14 @@ void radeon_audio_write_latency_fields(struct drm_encoder *encoder, ...@@ -341,3 +349,14 @@ void radeon_audio_write_latency_fields(struct drm_encoder *encoder,
if (radeon_encoder->audio && radeon_encoder->audio->write_latency_fields) if (radeon_encoder->audio && radeon_encoder->audio->write_latency_fields)
radeon_encoder->audio->write_latency_fields(encoder, connector, mode); radeon_encoder->audio->write_latency_fields(encoder, connector, mode);
} }
struct r600_audio_pin* radeon_audio_get_pin(struct drm_encoder *encoder)
{
struct radeon_device *rdev = encoder->dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
if (radeon_encoder->audio && radeon_encoder->audio->get_pin)
return radeon_encoder->audio->get_pin(rdev);
return NULL;
}
...@@ -41,6 +41,7 @@ struct radeon_audio_basic_funcs ...@@ -41,6 +41,7 @@ struct radeon_audio_basic_funcs
struct radeon_audio_funcs struct radeon_audio_funcs
{ {
struct r600_audio_pin* (*get_pin)(struct radeon_device *rdev);
void (*write_latency_fields)(struct drm_encoder *encoder, void (*write_latency_fields)(struct drm_encoder *encoder,
struct drm_connector *connector, struct drm_display_mode *mode); struct drm_connector *connector, struct drm_display_mode *mode);
void (*write_sad_regs)(struct drm_encoder *encoder, void (*write_sad_regs)(struct drm_encoder *encoder,
...@@ -60,5 +61,6 @@ void radeon_audio_write_sad_regs(struct drm_encoder *encoder); ...@@ -60,5 +61,6 @@ void radeon_audio_write_sad_regs(struct drm_encoder *encoder);
void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder); void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder);
void radeon_audio_write_latency_fields(struct drm_encoder *encoder, void radeon_audio_write_latency_fields(struct drm_encoder *encoder,
struct drm_display_mode *mode); struct drm_display_mode *mode);
struct r600_audio_pin *radeon_audio_get_pin(struct drm_encoder *encoder);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册