radeon/audio: applied audio_dpms() and audio_mode_set() calls
authorSlava Grigorev <slava.grigorev@amd.com>
Wed, 10 Dec 2014 19:52:43 +0000 (14:52 -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/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 9354c99ca3c2e7f29055fa82eb335ad111d69a40..8ca8b4fcb10cb38b62c7e30e69d74ca4f8b02560 100644 (file)
@@ -1616,6 +1616,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
        struct radeon_connector *radeon_connector = NULL;
        struct radeon_connector_atom_dig *radeon_dig_connector = NULL;
        bool travis_quirk = false;
+       int encoder_mode;
 
        if (connector) {
                radeon_connector = to_radeon_connector(connector);
@@ -1711,6 +1712,11 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
                }
                break;
        }
+
+       encoder_mode = atombios_get_encoder_mode(encoder);
+       if (radeon_audio != 0 &&
+               (encoder_mode == ATOM_ENCODER_MODE_HDMI || ENCODER_MODE_IS_DP(encoder_mode)))
+               radeon_audio_dpms(encoder, mode);
 }
 
 static void
@@ -2124,6 +2130,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
        struct drm_device *dev = encoder->dev;
        struct radeon_device *rdev = dev->dev_private;
        struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+       int encoder_mode;
 
        radeon_encoder->pixel_clock = adjusted_mode->clock;
 
@@ -2150,6 +2157,10 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
        case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3:
        case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
                /* handled in dpms */
+               encoder_mode = atombios_get_encoder_mode(encoder);
+               if (radeon_audio != 0 &&
+                       (encoder_mode == ATOM_ENCODER_MODE_HDMI || ENCODER_MODE_IS_DP(encoder_mode)))
+                       radeon_audio_mode_set(encoder, adjusted_mode);
                break;
        case ENCODER_OBJECT_ID_INTERNAL_DDI:
        case ENCODER_OBJECT_ID_INTERNAL_DVO1:
@@ -2171,12 +2182,6 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
        }
 
        atombios_apply_encoder_quirks(encoder, adjusted_mode);
-
-       if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) {
-               if (rdev->asic->display.hdmi_enable)
-                       radeon_hdmi_enable(rdev, encoder, true);
-               radeon_audio_mode_set(encoder, adjusted_mode);
-       }
 }
 
 static bool
@@ -2442,10 +2447,6 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
 
 disable_done:
        if (radeon_encoder_is_digital(encoder)) {
-               if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) {
-                       if (rdev->asic->display.hdmi_enable)
-                               radeon_hdmi_enable(rdev, encoder, false);
-               }
                dig = radeon_encoder->enc_priv;
                dig->dig_encoder = -1;
        }
index b8478882e3218d70b3c39654dd5a41fbac6d7fd8..f811ee14a237dba8d942a65ece9e5b9d9f1c8b1c 100644 (file)
@@ -638,7 +638,6 @@ static struct radeon_asic rs600_asic = {
                .wait_for_vblank = &avivo_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &r600_hdmi_enable,
        },
        .copy = {
                .blit = &r100_copy_blit,
@@ -705,7 +704,6 @@ static struct radeon_asic rs690_asic = {
                .wait_for_vblank = &avivo_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &r600_hdmi_enable,
        },
        .copy = {
                .blit = &r100_copy_blit,
@@ -933,7 +931,6 @@ static struct radeon_asic r600_asic = {
                .wait_for_vblank = &avivo_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &r600_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1018,7 +1015,6 @@ static struct radeon_asic rv6xx_asic = {
                .wait_for_vblank = &avivo_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &r600_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1108,7 +1104,6 @@ static struct radeon_asic rs780_asic = {
                .wait_for_vblank = &avivo_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &r600_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1211,7 +1206,6 @@ static struct radeon_asic rv770_asic = {
                .wait_for_vblank = &avivo_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &r600_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1328,7 +1322,6 @@ static struct radeon_asic evergreen_asic = {
                .wait_for_vblank = &dce4_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &evergreen_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1419,7 +1412,6 @@ static struct radeon_asic sumo_asic = {
                .wait_for_vblank = &dce4_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &evergreen_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1509,7 +1501,6 @@ static struct radeon_asic btc_asic = {
                .wait_for_vblank = &dce4_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &evergreen_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1654,7 +1645,6 @@ static struct radeon_asic cayman_asic = {
                .wait_for_vblank = &dce4_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &evergreen_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1756,7 +1746,6 @@ static struct radeon_asic trinity_asic = {
                .wait_for_vblank = &dce4_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &evergreen_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -1888,7 +1877,6 @@ static struct radeon_asic si_asic = {
                .wait_for_vblank = &dce4_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &evergreen_hdmi_enable,
        },
        .copy = {
                .blit = &r600_copy_cpdma,
@@ -2054,7 +2042,6 @@ static struct radeon_asic ci_asic = {
                .wait_for_vblank = &dce4_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &evergreen_hdmi_enable,
        },
        .copy = {
                .blit = &cik_copy_cpdma,
@@ -2164,7 +2151,6 @@ static struct radeon_asic kv_asic = {
                .wait_for_vblank = &dce4_wait_for_vblank,
                .set_backlight_level = &atombios_set_backlight_level,
                .get_backlight_level = &atombios_get_backlight_level,
-               .hdmi_enable = &evergreen_hdmi_enable,
        },
        .copy = {
                .blit = &cik_copy_cpdma,
index fee8d2297e5432f59b463bfc9790d797e10f349c..4045a320a42430d42e898b1a1357660139772bda 100644 (file)
@@ -398,7 +398,6 @@ void r600_hdmi_update_ACR(struct drm_encoder *encoder, uint32_t clock);
 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);
 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);
@@ -536,7 +535,6 @@ struct radeon_fence *evergreen_copy_dma(struct radeon_device *rdev,
                                        uint64_t src_offset, uint64_t dst_offset,
                                        unsigned num_gpu_pages,
                                        struct reservation_object *resv);
-void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable);
 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 05c7ffed6996e4b8e8aceff5d952ab44b25f12d4..4a2774ac78279fc1b2ffd419af4d6c415de368f9 100644 (file)
@@ -97,6 +97,8 @@ 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);
+void r600_hdmi_enable(struct drm_encoder *encoder, bool enable);
+void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable);
 
 static const u32 pin_offsets[7] =
 {
@@ -153,6 +155,7 @@ static struct radeon_audio_funcs r600_hdmi_funcs = {
        .set_audio_packet = r600_set_audio_packet,
        .set_mute = r600_set_mute,
        .mode_set = radeon_audio_hdmi_mode_set,
+       .dpms = r600_hdmi_enable,
 };
 
 static struct radeon_audio_funcs dce32_hdmi_funcs = {
@@ -166,6 +169,7 @@ static struct radeon_audio_funcs dce32_hdmi_funcs = {
        .set_audio_packet = dce3_2_set_audio_packet,
        .set_mute = dce3_2_set_mute,
        .mode_set = radeon_audio_hdmi_mode_set,
+       .dpms = r600_hdmi_enable,
 };
 
 static struct radeon_audio_funcs dce32_dp_funcs = {
@@ -189,6 +193,7 @@ static struct radeon_audio_funcs dce4_hdmi_funcs = {
        .set_audio_packet = dce4_set_audio_packet,
        .set_mute = dce4_set_mute,
        .mode_set = radeon_audio_hdmi_mode_set,
+       .dpms = evergreen_hdmi_enable,
 };
 
 static struct radeon_audio_funcs dce4_dp_funcs = {
@@ -214,6 +219,7 @@ static struct radeon_audio_funcs dce6_hdmi_funcs = {
        .set_audio_packet = dce4_set_audio_packet,
        .set_mute = dce4_set_mute,
        .mode_set = radeon_audio_hdmi_mode_set,
+       .dpms = evergreen_hdmi_enable,
 };
 
 static struct radeon_audio_funcs dce6_dp_funcs = {
@@ -705,3 +711,11 @@ void radeon_audio_mode_set(struct drm_encoder *encoder,
        if (radeon_encoder->audio && radeon_encoder->audio->mode_set)
                radeon_encoder->audio->mode_set(encoder, mode);
 }
+
+void radeon_audio_dpms(struct drm_encoder *encoder, int mode)
+{
+       struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
+
+       if (radeon_encoder->audio && radeon_encoder->audio->dpms)
+               radeon_encoder->audio->dpms(encoder, mode == DRM_MODE_DPMS_ON);
+}
index 69022116b6a477fcaf6d06c7e043bf206f954f60..c92d059ab204dd395f248e44fc3be33a84ec7005 100644 (file)
@@ -63,6 +63,7 @@ struct radeon_audio_funcs
        void (*set_mute)(struct drm_encoder *encoder, u32 offset, bool mute);
        void (*mode_set)(struct drm_encoder *encoder,
                struct drm_display_mode *mode);
+       void (*dpms)(struct drm_encoder *encoder, bool mode);
 };
 
 int radeon_audio_init(struct radeon_device *rdev);
@@ -78,5 +79,6 @@ void radeon_audio_enable(struct radeon_device *rdev,
 void radeon_audio_fini(struct radeon_device *rdev);
 void radeon_audio_mode_set(struct drm_encoder *encoder,
        struct drm_display_mode *mode);
+void radeon_audio_dpms(struct drm_encoder *encoder, int mode);
 
 #endif