Commit 7991d665 authored by Slava Grigorev's avatar Slava Grigorev Committed by Alex Deucher

radeon/audio: consolidate audio_fini() functions

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarSlava Grigorev <slava.grigorev@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8bf59820
...@@ -8576,7 +8576,7 @@ int cik_suspend(struct radeon_device *rdev) ...@@ -8576,7 +8576,7 @@ int cik_suspend(struct radeon_device *rdev)
{ {
radeon_kfd_suspend(rdev); radeon_kfd_suspend(rdev);
radeon_pm_suspend(rdev); radeon_pm_suspend(rdev);
dce6_audio_fini(rdev); radeon_audio_fini(rdev);
radeon_vm_manager_fini(rdev); radeon_vm_manager_fini(rdev);
cik_cp_enable(rdev, false); cik_cp_enable(rdev, false);
cik_sdma_enable(rdev, false); cik_sdma_enable(rdev, false);
......
...@@ -248,16 +248,3 @@ void dce6_audio_enable(struct radeon_device *rdev, ...@@ -248,16 +248,3 @@ void dce6_audio_enable(struct radeon_device *rdev,
WREG32_ENDPOINT(pin->offset, AZ_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL, WREG32_ENDPOINT(pin->offset, AZ_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL,
enable_mask ? AUDIO_ENABLED : 0); enable_mask ? AUDIO_ENABLED : 0);
} }
void dce6_audio_fini(struct radeon_device *rdev)
{
int i;
if (!rdev->audio.enabled)
return;
for (i = 0; i < rdev->audio.num_pins; i++)
radeon_audio_enable(rdev, &rdev->audio.pin[i], false);
rdev->audio.enabled = false;
}
...@@ -5333,7 +5333,7 @@ int evergreen_resume(struct radeon_device *rdev) ...@@ -5333,7 +5333,7 @@ int evergreen_resume(struct radeon_device *rdev)
int evergreen_suspend(struct radeon_device *rdev) int evergreen_suspend(struct radeon_device *rdev)
{ {
radeon_pm_suspend(rdev); radeon_pm_suspend(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
uvd_v1_0_fini(rdev); uvd_v1_0_fini(rdev);
radeon_uvd_suspend(rdev); radeon_uvd_suspend(rdev);
r700_cp_stop(rdev); r700_cp_stop(rdev);
...@@ -5483,7 +5483,7 @@ int evergreen_init(struct radeon_device *rdev) ...@@ -5483,7 +5483,7 @@ int evergreen_init(struct radeon_device *rdev)
void evergreen_fini(struct radeon_device *rdev) void evergreen_fini(struct radeon_device *rdev)
{ {
radeon_pm_fini(rdev); radeon_pm_fini(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
r700_cp_fini(rdev); r700_cp_fini(rdev);
r600_dma_fini(rdev); r600_dma_fini(rdev);
r600_irq_fini(rdev); r600_irq_fini(rdev);
......
...@@ -2135,10 +2135,7 @@ int cayman_resume(struct radeon_device *rdev) ...@@ -2135,10 +2135,7 @@ int cayman_resume(struct radeon_device *rdev)
int cayman_suspend(struct radeon_device *rdev) int cayman_suspend(struct radeon_device *rdev)
{ {
radeon_pm_suspend(rdev); radeon_pm_suspend(rdev);
if (ASIC_IS_DCE6(rdev)) radeon_audio_fini(rdev);
dce6_audio_fini(rdev);
else
r600_audio_fini(rdev);
radeon_vm_manager_fini(rdev); radeon_vm_manager_fini(rdev);
cayman_cp_enable(rdev, false); cayman_cp_enable(rdev, false);
cayman_dma_stop(rdev); cayman_dma_stop(rdev);
......
...@@ -3106,7 +3106,7 @@ int r600_resume(struct radeon_device *rdev) ...@@ -3106,7 +3106,7 @@ int r600_resume(struct radeon_device *rdev)
int r600_suspend(struct radeon_device *rdev) int r600_suspend(struct radeon_device *rdev)
{ {
radeon_pm_suspend(rdev); radeon_pm_suspend(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
r600_cp_stop(rdev); r600_cp_stop(rdev);
if (rdev->has_uvd) { if (rdev->has_uvd) {
uvd_v1_0_fini(rdev); uvd_v1_0_fini(rdev);
...@@ -3225,7 +3225,7 @@ int r600_init(struct radeon_device *rdev) ...@@ -3225,7 +3225,7 @@ int r600_init(struct radeon_device *rdev)
void r600_fini(struct radeon_device *rdev) void r600_fini(struct radeon_device *rdev)
{ {
radeon_pm_fini(rdev); radeon_pm_fini(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
r600_cp_fini(rdev); r600_cp_fini(rdev);
r600_irq_fini(rdev); r600_irq_fini(rdev);
if (rdev->has_uvd) { if (rdev->has_uvd) {
......
...@@ -183,19 +183,6 @@ void r600_audio_enable(struct radeon_device *rdev, ...@@ -183,19 +183,6 @@ void r600_audio_enable(struct radeon_device *rdev,
WREG32(AZ_HOT_PLUG_CONTROL, tmp); WREG32(AZ_HOT_PLUG_CONTROL, tmp);
} }
/*
* release the audio timer
* TODO: How to do this correctly on SMP systems?
*/
void r600_audio_fini(struct radeon_device *rdev)
{
if (!rdev->audio.enabled)
return;
radeon_audio_enable(rdev, &rdev->audio.pin[0], 0);
rdev->audio.enabled = false;
}
struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev) struct r600_audio_pin *r600_audio_get_pin(struct radeon_device *rdev)
{ {
/* only one pin on 6xx-NI */ /* only one pin on 6xx-NI */
......
...@@ -380,3 +380,16 @@ void radeon_audio_enable(struct radeon_device *rdev, ...@@ -380,3 +380,16 @@ void radeon_audio_enable(struct radeon_device *rdev,
if (rdev->audio.funcs->enable) if (rdev->audio.funcs->enable)
rdev->audio.funcs->enable(rdev, pin, enable_mask); rdev->audio.funcs->enable(rdev, pin, enable_mask);
} }
void radeon_audio_fini(struct radeon_device *rdev)
{
int i;
if (!rdev->audio.enabled)
return;
for (i = 0; i < rdev->audio.num_pins; i++)
radeon_audio_enable(rdev, &rdev->audio.pin[i], false);
rdev->audio.enabled = false;
}
...@@ -68,5 +68,6 @@ struct r600_audio_pin *radeon_audio_get_pin(struct drm_encoder *encoder); ...@@ -68,5 +68,6 @@ struct r600_audio_pin *radeon_audio_get_pin(struct drm_encoder *encoder);
void radeon_audio_select_pin(struct drm_encoder *encoder); void radeon_audio_select_pin(struct drm_encoder *encoder);
void radeon_audio_enable(struct radeon_device *rdev, void radeon_audio_enable(struct radeon_device *rdev,
struct r600_audio_pin *pin, u8 enable_mask); struct r600_audio_pin *pin, u8 enable_mask);
void radeon_audio_fini(struct radeon_device *rdev);
#endif #endif
...@@ -1054,7 +1054,7 @@ int rs600_resume(struct radeon_device *rdev) ...@@ -1054,7 +1054,7 @@ int rs600_resume(struct radeon_device *rdev)
int rs600_suspend(struct radeon_device *rdev) int rs600_suspend(struct radeon_device *rdev)
{ {
radeon_pm_suspend(rdev); radeon_pm_suspend(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
r100_cp_disable(rdev); r100_cp_disable(rdev);
radeon_wb_disable(rdev); radeon_wb_disable(rdev);
rs600_irq_disable(rdev); rs600_irq_disable(rdev);
...@@ -1065,7 +1065,7 @@ int rs600_suspend(struct radeon_device *rdev) ...@@ -1065,7 +1065,7 @@ int rs600_suspend(struct radeon_device *rdev)
void rs600_fini(struct radeon_device *rdev) void rs600_fini(struct radeon_device *rdev)
{ {
radeon_pm_fini(rdev); radeon_pm_fini(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
r100_cp_fini(rdev); r100_cp_fini(rdev);
radeon_wb_fini(rdev); radeon_wb_fini(rdev);
radeon_ib_pool_fini(rdev); radeon_ib_pool_fini(rdev);
......
...@@ -771,7 +771,7 @@ int rs690_resume(struct radeon_device *rdev) ...@@ -771,7 +771,7 @@ int rs690_resume(struct radeon_device *rdev)
int rs690_suspend(struct radeon_device *rdev) int rs690_suspend(struct radeon_device *rdev)
{ {
radeon_pm_suspend(rdev); radeon_pm_suspend(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
r100_cp_disable(rdev); r100_cp_disable(rdev);
radeon_wb_disable(rdev); radeon_wb_disable(rdev);
rs600_irq_disable(rdev); rs600_irq_disable(rdev);
...@@ -782,7 +782,7 @@ int rs690_suspend(struct radeon_device *rdev) ...@@ -782,7 +782,7 @@ int rs690_suspend(struct radeon_device *rdev)
void rs690_fini(struct radeon_device *rdev) void rs690_fini(struct radeon_device *rdev)
{ {
radeon_pm_fini(rdev); radeon_pm_fini(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
r100_cp_fini(rdev); r100_cp_fini(rdev);
radeon_wb_fini(rdev); radeon_wb_fini(rdev);
radeon_ib_pool_fini(rdev); radeon_ib_pool_fini(rdev);
......
...@@ -1830,7 +1830,7 @@ int rv770_resume(struct radeon_device *rdev) ...@@ -1830,7 +1830,7 @@ int rv770_resume(struct radeon_device *rdev)
int rv770_suspend(struct radeon_device *rdev) int rv770_suspend(struct radeon_device *rdev)
{ {
radeon_pm_suspend(rdev); radeon_pm_suspend(rdev);
r600_audio_fini(rdev); radeon_audio_fini(rdev);
uvd_v1_0_fini(rdev); uvd_v1_0_fini(rdev);
radeon_uvd_suspend(rdev); radeon_uvd_suspend(rdev);
r700_cp_stop(rdev); r700_cp_stop(rdev);
......
...@@ -6909,7 +6909,7 @@ int si_resume(struct radeon_device *rdev) ...@@ -6909,7 +6909,7 @@ int si_resume(struct radeon_device *rdev)
int si_suspend(struct radeon_device *rdev) int si_suspend(struct radeon_device *rdev)
{ {
radeon_pm_suspend(rdev); radeon_pm_suspend(rdev);
dce6_audio_fini(rdev); radeon_audio_fini(rdev);
radeon_vm_manager_fini(rdev); radeon_vm_manager_fini(rdev);
si_cp_enable(rdev, false); si_cp_enable(rdev, false);
cayman_dma_stop(rdev); cayman_dma_stop(rdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment