radeon/audio: consolidate audio_mode_set() functions
authorSlava Grigorev <slava.grigorev@amd.com>
Wed, 10 Dec 2014 15:43:51 +0000 (10:43 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 22 Jan 2015 15:42:17 +0000 (10:42 -0500)
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Slava Grigorev <slava.grigorev@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/radeon/atombios_encoders.c
drivers/gpu/drm/radeon/dce3_1_afmt.c
drivers/gpu/drm/radeon/evergreen_hdmi.c
drivers/gpu/drm/radeon/r600_hdmi.c
drivers/gpu/drm/radeon/radeon_asic.c
drivers/gpu/drm/radeon/radeon_asic.h
drivers/gpu/drm/radeon/radeon_audio.c
drivers/gpu/drm/radeon/radeon_audio.h

index b8cd7975f797e7d09bb3792ff3af15462cba68a6..9354c99ca3c2e7f29055fa82eb335ad111d69a40 100644 (file)
@@ -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);
        }
 }
 
index cbd07f5f276ab45dbeae41f0c0f04ddbdf93f630..f04205170b8a5942d73437ada72437bc18d028a8 100644 (file)
@@ -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);
-}
index 84a000d361e688c342908871e6448459a797b01c..c893fe1f0685878d9f10b14f6899358d98072ca1 100644 (file)
@@ -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;
index 0f90d70537e95a2b28ae4eb5f0022c5fc9a8b618..62c91ed669ce24bdf4f96ea3eb0c7c446e457b1b 100644 (file)
@@ -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
  *
index 7c6e1930fa38662462a013a13772d234c867ce7d..b8478882e3218d70b3c39654dd5a41fbac6d7fd8 100644 (file)
@@ -639,7 +639,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,
@@ -707,7 +706,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,
@@ -936,7 +934,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,
@@ -1022,7 +1019,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,
@@ -1113,7 +1109,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,
@@ -1217,7 +1212,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,
@@ -1335,7 +1329,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,
@@ -1427,7 +1420,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,
@@ -1518,7 +1510,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,
@@ -1664,7 +1655,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,
@@ -1767,7 +1757,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,
@@ -1900,7 +1889,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,
@@ -2067,7 +2055,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,
@@ -2178,7 +2165,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,
index 6eacf410a45f3ce380cffe3774cb08a97925ce27..fee8d2297e5432f59b463bfc9790d797e10f349c 100644 (file)
@@ -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);
index 3aa5d111f650c238b8759476d0355742cf18dbd5..05c7ffed6996e4b8e8aceff5d952ab44b25f12d4 100644 (file)
@@ -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 = {
@@ -208,6 +213,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 = {
@@ -337,7 +343,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;
@@ -373,7 +379,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;
@@ -408,7 +414,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;
@@ -445,7 +451,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);
 
@@ -473,7 +479,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);
@@ -483,7 +489,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;
@@ -589,7 +595,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);
@@ -602,7 +608,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;
@@ -614,7 +620,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);
@@ -632,7 +638,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;
@@ -644,7 +650,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;
@@ -655,3 +661,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);
+}
index 5ca5e7edc68065c0ce38f0409ae02c1f5b59b22e..69022116b6a477fcaf6d06c7e043bf206f954f60 100644 (file)
@@ -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