lkml.org 
[lkml]   [2013]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.10 164/173] drm/radeon: use 64-bit math to calculate CTS values for audio (v2)
    Date
    3.10-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Alex Deucher <alexander.deucher@amd.com>

    commit 062c2e4363451d49ef840232fe65e8bff0dde2a5 upstream.

    Avoid losing precision. See bug:
    https://bugs.freedesktop.org/show_bug.cgi?id=69675

    v2: fix math as per Anssi's comments.

    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    drivers/gpu/drm/radeon/r600_hdmi.c | 11 +++++++++--
    1 file changed, 9 insertions(+), 2 deletions(-)

    --- a/drivers/gpu/drm/radeon/r600_hdmi.c
    +++ b/drivers/gpu/drm/radeon/r600_hdmi.c
    @@ -75,8 +75,15 @@ static const struct radeon_hdmi_acr r600
    */
    static void r600_hdmi_calc_cts(uint32_t clock, int *CTS, int N, int freq)
    {
    - if (*CTS == 0)
    - *CTS = clock * N / (128 * freq) * 1000;
    + u64 n;
    + u32 d;
    +
    + if (*CTS == 0) {
    + n = (u64)clock * (u64)N * 1000ULL;
    + d = 128 * freq;
    + do_div(n, d);
    + *CTS = n;
    + }
    DRM_DEBUG("Using ACR timing N=%d CTS=%d for frequency %d\n",
    N, *CTS, freq);
    }



    \
     
     \ /
      Last update: 2013-12-03 00:21    [W:3.886 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site