summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/dce6_afmt.c
diff options
context:
space:
mode:
authorSlava Grigorev <slava.grigorev@amd.com>2016-01-26 16:56:25 -0500
committerAlex Deucher <alexander.deucher@amd.com>2016-01-27 12:48:32 -0500
commita64c9dab1c4d05c87ec8a1cb9b48915816462143 (patch)
tree374bfa1bb2f03adba7d22642c0dc8b550ad8933c /drivers/gpu/drm/radeon/dce6_afmt.c
parentc9a392eac18409f51a071520cf508c0b4ad990e2 (diff)
downloadlinux-a64c9dab1c4d05c87ec8a1cb9b48915816462143.tar.gz
linux-a64c9dab1c4d05c87ec8a1cb9b48915816462143.tar.bz2
linux-a64c9dab1c4d05c87ec8a1cb9b48915816462143.zip
drm/radeon: Add a common function for DFS handling
Move encoding of DFS (digital frequency synthesizer) divider into a separate function and improve calculation precision. Signed-off-by: Slava Grigorev <slava.grigorev@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/gpu/drm/radeon/dce6_afmt.c')
-rw-r--r--drivers/gpu/drm/radeon/dce6_afmt.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c
index ea4e3fc2744f..367a916f364e 100644
--- a/drivers/gpu/drm/radeon/dce6_afmt.c
+++ b/drivers/gpu/drm/radeon/dce6_afmt.c
@@ -304,18 +304,10 @@ void dce6_dp_audio_set_dto(struct radeon_device *rdev,
unsigned int div = (RREG32(DENTIST_DISPCLK_CNTL) &
DENTIST_DPREFCLK_WDIVIDER_MASK) >>
DENTIST_DPREFCLK_WDIVIDER_SHIFT;
-
- if (div < 128 && div >= 96)
- div -= 64;
- else if (div >= 64)
- div = div / 2 - 16;
- else if (div >= 8)
- div /= 4;
- else
- div = 0;
+ div = radeon_audio_decode_dfs_div(div);
if (div)
- clock /= div;
+ clock = clock * 100 / div;
WREG32(DCE8_DCCG_AUDIO_DTO1_PHASE, 24000);
WREG32(DCE8_DCCG_AUDIO_DTO1_MODULE, clock);