From: Slava Grigorev Date: Wed, 10 Dec 2014 19:52:43 +0000 (-0500) Subject: radeon/audio: applied audio_dpms() and audio_mode_set() calls X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6f945693be7eea24b1a8e5ce252a96df98d55a5c;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git radeon/audio: applied audio_dpms() and audio_mode_set() calls Reviewed-by: Christian König Signed-off-by: Slava Grigorev Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 9354c99ca3c2..8ca8b4fcb10c 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c @@ -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; } diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index b8478882e321..f811ee14a237 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c @@ -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, diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index fee8d2297e54..4045a320a424 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h @@ -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); diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c index 05c7ffed6996..4a2774ac7827 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.c +++ b/drivers/gpu/drm/radeon/radeon_audio.c @@ -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); +} diff --git a/drivers/gpu/drm/radeon/radeon_audio.h b/drivers/gpu/drm/radeon/radeon_audio.h index 69022116b6a4..c92d059ab204 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.h +++ b/drivers/gpu/drm/radeon/radeon_audio.h @@ -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