[PATCH 20/24] radeon/audio: consolidate audio_mode_set() functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Slava Grigorev <slava.grigorev@xxxxxxx>

Signed-off-by: Slava Grigorev <slava.grigorev@xxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
---
 drivers/gpu/drm/radeon/atombios_encoders.c |  4 +-
 drivers/gpu/drm/radeon/dce3_1_afmt.c       | 41 -----------------
 drivers/gpu/drm/radeon/evergreen_hdmi.c    | 41 -----------------
 drivers/gpu/drm/radeon/r600_hdmi.c         | 37 ---------------
 drivers/gpu/drm/radeon/radeon_asic.c       | 14 ------
 drivers/gpu/drm/radeon/radeon_asic.h       |  4 --
 drivers/gpu/drm/radeon/radeon_audio.c      | 72 +++++++++++++++++++++++++-----
 drivers/gpu/drm/radeon/radeon_audio.h      | 15 ++-----
 8 files changed, 66 insertions(+), 162 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index b8cd797..9354c99 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -27,6 +27,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/radeon_drm.h>
 #include "radeon.h"
+#include "radeon_audio.h"
 #include "atom.h"
 #include <linux/backlight.h>
 
@@ -2174,8 +2175,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
 	if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) {
 		if (rdev->asic->display.hdmi_enable)
 			radeon_hdmi_enable(rdev, encoder, true);
-		if (rdev->asic->display.hdmi_setmode)
-			radeon_hdmi_setmode(rdev, encoder, adjusted_mode);
+		radeon_audio_mode_set(encoder, adjusted_mode);
 	}
 }
 
diff --git a/drivers/gpu/drm/radeon/dce3_1_afmt.c b/drivers/gpu/drm/radeon/dce3_1_afmt.c
index 3bc95b4..602c2b0 100644
--- a/drivers/gpu/drm/radeon/dce3_1_afmt.c
+++ b/drivers/gpu/drm/radeon/dce3_1_afmt.c
@@ -230,44 +230,3 @@ void dce3_2_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
 	else
 		WREG32_AND(HDMI0_GC + offset, ~HDMI0_GC_AVMUTE);
 }
-
-/*
- * update the info frames with the data from the current display mode
- */
-void dce3_1_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode)
-{
-	struct drm_device *dev = encoder->dev;
-	struct radeon_device *rdev = dev->dev_private;
-	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
-	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
-	uint32_t offset;
-
-	if (!dig || !dig->afmt)
-		return;
-
-	/* Silent, r600_hdmi_enable will raise WARN for us */
-	if (!dig->afmt->enabled)
-		return;
-	offset = dig->afmt->offset;
-
-	/* disable audio prior to setting up hw */
-	dig->afmt->pin = radeon_audio_get_pin(encoder);
-	radeon_audio_enable(rdev, dig->afmt->pin, 0);
-
-	radeon_audio_set_dto(encoder, mode->clock);
-	radeon_audio_set_vbi_packet(encoder);
-	radeon_hdmi_set_color_depth(encoder);
-	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_write_sad_regs(encoder);
-
-	if (radeon_audio_set_avi_packet(encoder, mode) < 0)
-		return;
-
-	r600_hdmi_audio_workaround(encoder);
-
-	/* enable audio after to setting up hw */
-	radeon_audio_enable(rdev, dig->afmt->pin, 0xf);
-}
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index 5090819..0d8c85f 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -398,47 +398,6 @@ void dce4_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
 		WREG32_AND(HDMI_GC + offset, ~HDMI_GC_AVMUTE);
 }
 
-/*
- * update the info frames with the data from the current display mode
- */
-void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode)
-{
-	struct drm_device *dev = encoder->dev;
-	struct radeon_device *rdev = dev->dev_private;
-	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
-	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
-	uint32_t offset;
-
-	if (!dig || !dig->afmt)
-		return;
-
-	/* Silent, r600_hdmi_enable will raise WARN for us */
-	if (!dig->afmt->enabled)
-		return;
-	offset = dig->afmt->offset;
-
-	/* disable audio prior to setting up hw */
-	dig->afmt->pin = radeon_audio_get_pin(encoder);
-	radeon_audio_enable(rdev, dig->afmt->pin, 0);
-
-	radeon_audio_set_dto(encoder, mode->clock);
-	radeon_audio_set_vbi_packet(encoder);
-	radeon_hdmi_set_color_depth(encoder);
-	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);
-
-	if (radeon_audio_set_avi_packet(encoder, mode) < 0)
-		return;
-
-	/* enable audio after to setting up hw */
-	radeon_audio_enable(rdev, dig->afmt->pin, 0xf);
-}
-
 void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable)
 {
 	struct drm_device *dev = encoder->dev;
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index ea1950b..e34370a 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -400,43 +400,6 @@ void r600_set_mute(struct drm_encoder *encoder, u32 offset, bool mute)
 		WREG32_AND(HDMI0_GC + offset, ~HDMI0_GC_AVMUTE);
 }
 
-/*
- * update the info frames with the data from the current display mode
- */
-void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode)
-{
-	struct drm_device *dev = encoder->dev;
-	struct radeon_device *rdev = dev->dev_private;
-	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
-	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
-	uint32_t offset;
-
-	if (!dig || !dig->afmt)
-		return;
-
-	/* Silent, r600_hdmi_enable will raise WARN for us */
-	if (!dig->afmt->enabled)
-		return;
-	offset = dig->afmt->offset;
-
-	/* disable audio prior to setting up hw */
-	dig->afmt->pin = radeon_audio_get_pin(encoder);
-	radeon_audio_enable(rdev, dig->afmt->pin, 0);
-
-	radeon_audio_set_dto(encoder, mode->clock);
-	radeon_audio_set_vbi_packet(encoder);
-	radeon_hdmi_set_color_depth(encoder);
-	radeon_audio_set_mute(encoder, false);
-	radeon_audio_update_acr(encoder, mode->clock);
-	radeon_audio_set_audio_packet(encoder);
-
-	if (radeon_audio_set_avi_packet(encoder, mode) < 0)
-		return;
-
-	/* enable audio after to setting up hw */
-	radeon_audio_enable(rdev, dig->afmt->pin, 0xf);
-}
-
 /**
  * r600_hdmi_update_audio_settings - Update audio infoframe
  *
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 82c43eb..fc8da28 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -625,7 +625,6 @@ static struct radeon_asic rs600_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &r600_hdmi_enable,
-		.hdmi_setmode = &r600_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r100_copy_blit,
@@ -693,7 +692,6 @@ static struct radeon_asic rs690_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &r600_hdmi_enable,
-		.hdmi_setmode = &r600_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r100_copy_blit,
@@ -922,7 +920,6 @@ static struct radeon_asic r600_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &r600_hdmi_enable,
-		.hdmi_setmode = &r600_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1008,7 +1005,6 @@ static struct radeon_asic rv6xx_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &r600_hdmi_enable,
-		.hdmi_setmode = &r600_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1099,7 +1095,6 @@ static struct radeon_asic rs780_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &r600_hdmi_enable,
-		.hdmi_setmode = &r600_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1203,7 +1198,6 @@ static struct radeon_asic rv770_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &r600_hdmi_enable,
-		.hdmi_setmode = &dce3_1_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1321,7 +1315,6 @@ static struct radeon_asic evergreen_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &evergreen_hdmi_enable,
-		.hdmi_setmode = &evergreen_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1413,7 +1406,6 @@ static struct radeon_asic sumo_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &evergreen_hdmi_enable,
-		.hdmi_setmode = &evergreen_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1504,7 +1496,6 @@ static struct radeon_asic btc_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &evergreen_hdmi_enable,
-		.hdmi_setmode = &evergreen_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1650,7 +1641,6 @@ static struct radeon_asic cayman_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &evergreen_hdmi_enable,
-		.hdmi_setmode = &evergreen_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1753,7 +1743,6 @@ static struct radeon_asic trinity_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &evergreen_hdmi_enable,
-		.hdmi_setmode = &evergreen_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -1886,7 +1875,6 @@ static struct radeon_asic si_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &evergreen_hdmi_enable,
-		.hdmi_setmode = &evergreen_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &r600_copy_cpdma,
@@ -2053,7 +2041,6 @@ static struct radeon_asic ci_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &evergreen_hdmi_enable,
-		.hdmi_setmode = &evergreen_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &cik_copy_cpdma,
@@ -2164,7 +2151,6 @@ static struct radeon_asic kv_asic = {
 		.set_backlight_level = &atombios_set_backlight_level,
 		.get_backlight_level = &atombios_get_backlight_level,
 		.hdmi_enable = &evergreen_hdmi_enable,
-		.hdmi_setmode = &evergreen_hdmi_setmode,
 	},
 	.copy = {
 		.blit = &cik_copy_cpdma,
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 6eacf41..fee8d22 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -399,7 +399,6 @@ void r600_hdmi_audio_workaround(struct drm_encoder *encoder);
 int r600_hdmi_buffer_status_changed(struct drm_encoder *encoder);
 void r600_hdmi_update_audio_settings(struct drm_encoder *encoder);
 void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
-void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode);
 int r600_mc_wait_for_idle(struct radeon_device *rdev);
 u32 r600_get_xclk(struct radeon_device *rdev);
 uint64_t r600_get_gpu_clock_counter(struct radeon_device *rdev);
@@ -468,8 +467,6 @@ struct radeon_fence *rv770_copy_dma(struct radeon_device *rdev,
 u32 rv770_get_xclk(struct radeon_device *rdev);
 int rv770_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk);
 int rv770_get_temp(struct radeon_device *rdev);
-/* hdmi */
-void dce3_1_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode);
 /* rv7xx pm */
 int rv770_dpm_init(struct radeon_device *rdev);
 int rv770_dpm_enable(struct radeon_device *rdev);
@@ -540,7 +537,6 @@ struct radeon_fence *evergreen_copy_dma(struct radeon_device *rdev,
 					unsigned num_gpu_pages,
 					struct reservation_object *resv);
 void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable);
-void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode);
 int evergreen_get_temp(struct radeon_device *rdev);
 int sumo_get_temp(struct radeon_device *rdev);
 int tn_get_temp(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
index bbfdce3..eb85a09 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -95,6 +95,8 @@ 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 void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder,
+	struct drm_display_mode *mode);
 
 static const u32 pin_offsets[7] =
 {
@@ -150,6 +152,7 @@ static struct radeon_audio_funcs r600_hdmi_funcs = {
 	.set_avi_packet = r600_set_avi_packet,
 	.set_audio_packet = r600_set_audio_packet,
 	.set_mute = r600_set_mute,
+	.mode_set = radeon_audio_hdmi_mode_set,
 };
 
 static struct radeon_audio_funcs dce32_hdmi_funcs = {
@@ -162,6 +165,7 @@ static struct radeon_audio_funcs dce32_hdmi_funcs = {
 	.set_avi_packet = r600_set_avi_packet,
 	.set_audio_packet = dce3_2_set_audio_packet,
 	.set_mute = dce3_2_set_mute,
+	.mode_set = radeon_audio_hdmi_mode_set,
 };
 
 static struct radeon_audio_funcs dce32_dp_funcs = {
@@ -184,6 +188,7 @@ static struct radeon_audio_funcs dce4_hdmi_funcs = {
 	.set_avi_packet = evergreen_set_avi_packet,
 	.set_audio_packet = dce4_set_audio_packet,
 	.set_mute = dce4_set_mute,
+	.mode_set = radeon_audio_hdmi_mode_set,
 };
 
 static struct radeon_audio_funcs dce4_dp_funcs = {
@@ -207,6 +212,7 @@ static struct radeon_audio_funcs dce6_hdmi_funcs = {
 	.set_avi_packet = evergreen_set_avi_packet,
 	.set_audio_packet = dce4_set_audio_packet,
 	.set_mute = dce4_set_mute,
+	.mode_set = radeon_audio_hdmi_mode_set,
 };
 
 static struct radeon_audio_funcs dce6_dp_funcs = {
@@ -336,7 +342,7 @@ void radeon_audio_endpoint_wreg(struct radeon_device *rdev, u32 offset,
 		rdev->audio.funcs->endpoint_wreg(rdev, offset, reg, v);
 }
 
-void radeon_audio_write_sad_regs(struct drm_encoder *encoder)
+static void radeon_audio_write_sad_regs(struct drm_encoder *encoder)
 {
 	struct radeon_encoder *radeon_encoder;
 	struct drm_connector *connector;
@@ -372,7 +378,7 @@ void radeon_audio_write_sad_regs(struct drm_encoder *encoder)
 	kfree(sads);
 }
 
-void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder)
+static void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder)
 {
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
     struct drm_connector *connector;
@@ -407,7 +413,7 @@ void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder)
     kfree(sadb);
 }
 
-void radeon_audio_write_latency_fields(struct drm_encoder *encoder,
+static void radeon_audio_write_latency_fields(struct drm_encoder *encoder,
 	struct drm_display_mode *mode)
 {
 	struct radeon_encoder *radeon_encoder;
@@ -444,7 +450,7 @@ struct r600_audio_pin* radeon_audio_get_pin(struct drm_encoder *encoder)
 	return NULL;
 }
 
-void radeon_audio_select_pin(struct drm_encoder *encoder)
+static void radeon_audio_select_pin(struct drm_encoder *encoder)
 {
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
 
@@ -472,7 +478,7 @@ void radeon_audio_fini(struct radeon_device *rdev)
 	rdev->audio.enabled = false;
 }
 
-void radeon_audio_set_dto(struct drm_encoder *encoder, unsigned int clock)
+static void radeon_audio_set_dto(struct drm_encoder *encoder, unsigned int clock)
 {
 	struct radeon_device *rdev = encoder->dev->dev_private;
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
@@ -482,7 +488,7 @@ void radeon_audio_set_dto(struct drm_encoder *encoder, unsigned int clock)
 		radeon_encoder->audio->set_dto(rdev, crtc, clock);
 }
 
-int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
+static int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
 	struct drm_display_mode *mode)
 {
     struct radeon_device *rdev = encoder->dev->dev_private;
@@ -588,7 +594,7 @@ static const struct radeon_hdmi_acr* radeon_audio_acr(unsigned int clock)
 /*
  * update the N and CTS parameters for a given pixel clock rate
  */
-void radeon_audio_update_acr(struct drm_encoder *encoder, unsigned int clock)
+static void radeon_audio_update_acr(struct drm_encoder *encoder, unsigned int clock)
 {
     const struct radeon_hdmi_acr *acr = radeon_audio_acr(clock);
     struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
@@ -601,7 +607,7 @@ void radeon_audio_update_acr(struct drm_encoder *encoder, unsigned int clock)
 		radeon_encoder->audio->update_acr(encoder, dig->afmt->offset, acr);
 }
 
-void radeon_audio_set_vbi_packet(struct drm_encoder *encoder)
+static void radeon_audio_set_vbi_packet(struct drm_encoder *encoder)
 {
     struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
     struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
@@ -613,7 +619,7 @@ void radeon_audio_set_vbi_packet(struct drm_encoder *encoder)
 		radeon_encoder->audio->set_vbi_packet(encoder, dig->afmt->offset);
 }
 
-void radeon_hdmi_set_color_depth(struct drm_encoder *encoder)
+static void radeon_hdmi_set_color_depth(struct drm_encoder *encoder)
 {
 	int bpc = 8;
 	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
@@ -631,7 +637,7 @@ void radeon_hdmi_set_color_depth(struct drm_encoder *encoder)
 		radeon_encoder->audio->set_color_depth(encoder, dig->afmt->offset, bpc);
 }
 
-void radeon_audio_set_audio_packet(struct drm_encoder *encoder)
+static void radeon_audio_set_audio_packet(struct drm_encoder *encoder)
 {
     struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
     struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
@@ -643,7 +649,7 @@ void radeon_audio_set_audio_packet(struct drm_encoder *encoder)
 		radeon_encoder->audio->set_audio_packet(encoder, dig->afmt->offset);
 }
 
-void radeon_audio_set_mute(struct drm_encoder *encoder, bool mute)
+static 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;
@@ -654,3 +660,47 @@ void radeon_audio_set_mute(struct drm_encoder *encoder, bool mute)
 	if (radeon_encoder->audio && radeon_encoder->audio->set_mute)
 		radeon_encoder->audio->set_mute(encoder, dig->afmt->offset, mute);
 }
+
+/*
+ * update the info frames with the data from the current display mode
+ */
+static void radeon_audio_hdmi_mode_set(struct drm_encoder *encoder,
+	struct drm_display_mode *mode)
+{
+    struct radeon_device *rdev = encoder->dev->dev_private;
+	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+	struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
+
+	if (!dig || !dig->afmt)
+		return;
+
+	/* disable audio prior to setting up hw */
+	dig->afmt->pin = radeon_audio_get_pin(encoder);
+	radeon_audio_enable(rdev, dig->afmt->pin, 0);
+
+	radeon_audio_set_dto(encoder, mode->clock);
+	radeon_audio_set_vbi_packet(encoder);
+	radeon_hdmi_set_color_depth(encoder);
+	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);
+
+	if (radeon_audio_set_avi_packet(encoder, mode) < 0)
+		return;
+
+	/* enable audio after to setting up hw */
+	radeon_audio_enable(rdev, dig->afmt->pin, 0xf);
+}
+
+void radeon_audio_mode_set(struct drm_encoder *encoder,
+	struct drm_display_mode *mode)
+{
+	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+
+	if (radeon_encoder->audio && radeon_encoder->audio->mode_set)
+		radeon_encoder->audio->mode_set(encoder, mode);
+}
diff --git a/drivers/gpu/drm/radeon/radeon_audio.h b/drivers/gpu/drm/radeon/radeon_audio.h
index 5ca5e7e..6902211 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.h
+++ b/drivers/gpu/drm/radeon/radeon_audio.h
@@ -61,6 +61,8 @@ struct radeon_audio_funcs
 		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);
+	void (*mode_set)(struct drm_encoder *encoder,
+		struct drm_display_mode *mode);
 };
 
 int radeon_audio_init(struct radeon_device *rdev);
@@ -70,22 +72,11 @@ u32 radeon_audio_endpoint_rreg(struct radeon_device *rdev,
 	u32 offset, u32 reg);
 void radeon_audio_endpoint_wreg(struct radeon_device *rdev,
 	u32 offset,	u32 reg, u32 v);
-void radeon_audio_write_sad_regs(struct drm_encoder *encoder);
-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);
 void radeon_audio_enable(struct radeon_device *rdev,
 	struct r600_audio_pin *pin, u8 enable_mask);
 void radeon_audio_fini(struct radeon_device *rdev);
-void radeon_audio_set_dto(struct drm_encoder *encoder, unsigned int clock);
-int radeon_audio_set_avi_packet(struct drm_encoder *encoder,
+void radeon_audio_mode_set(struct drm_encoder *encoder,
 	struct drm_display_mode *mode);
-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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux