From patchwork Thu Jun 27 03:51:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Airlie X-Patchwork-Id: 2790051 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D94BDC0AB1 for ; Thu, 27 Jun 2013 06:41:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCEF4201CB for ; Thu, 27 Jun 2013 06:41:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 619DA2018E for ; Thu, 27 Jun 2013 06:41:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A014E62A5 for ; Wed, 26 Jun 2013 23:41:38 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 0274DE61FA for ; Wed, 26 Jun 2013 20:52:14 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5R3po1J013876 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 26 Jun 2013 23:51:51 -0400 Received: from prime.bne.redhat.com (dhcp-41-132.bne.redhat.com [10.64.41.132]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5R3pnZ7019479 for ; Wed, 26 Jun 2013 23:51:49 -0400 From: Dave Airlie To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/radeon: fix 32-bit compile after dpm merge Date: Thu, 27 Jun 2013 13:51:47 +1000 Message-Id: <1372305107-27370-1-git-send-email-airlied@gmail.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Airlie feel free to split this back up and merge it into the individual commits. should probably also confirm its doing sane things. Signed-off-by: Dave Airlie --- drivers/gpu/drm/radeon/ni_dpm.c | 10 +++++----- drivers/gpu/drm/radeon/rv730_dpm.c | 6 +++--- drivers/gpu/drm/radeon/rv740_dpm.c | 6 +++--- drivers/gpu/drm/radeon/rv770_dpm.c | 6 +++--- drivers/gpu/drm/radeon/si_dpm.c | 11 ++++++----- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index ee82495..d547c42 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c @@ -1376,8 +1376,8 @@ static u32 ni_calculate_power_boost_limit(struct radeon_device *rdev, if (ret) return 0; - tmp = ((u64)near_tdp_limit * ((u64)std_vddc_med * (u64)std_vddc_med) * 90) / - ((u64)std_vddc_high * (u64)std_vddc_high * 100); + tmp = ((u64)near_tdp_limit * ((u64)std_vddc_med * (u64)std_vddc_med) * 90); + do_div(tmp, ((u64)std_vddc_high * (u64)std_vddc_high * 100)); if (tmp >> 32) return 0; power_boost_limit = (u32)tmp; @@ -1978,9 +1978,9 @@ static int ni_calculate_sclk_params(struct radeon_device *rdev, reference_divider = 1 + dividers.ref_div; - tmp = (u64) engine_clock * reference_divider * dividers.post_div; - - fbdiv = (u32) ((16384 * tmp) / reference_clock); + tmp = (u64) engine_clock * reference_divider * dividers.post_div * 16834; + do_div(tmp, reference_clock); + fbdiv = (u32) tmp; spll_func_cntl &= ~(SPLL_PDIV_A_MASK | SPLL_REF_DIV_MASK); spll_func_cntl |= SPLL_REF_DIV(dividers.ref_div); diff --git a/drivers/gpu/drm/radeon/rv730_dpm.c b/drivers/gpu/drm/radeon/rv730_dpm.c index b23be71..3f5e1cf 100644 --- a/drivers/gpu/drm/radeon/rv730_dpm.c +++ b/drivers/gpu/drm/radeon/rv730_dpm.c @@ -67,9 +67,9 @@ int rv730_populate_sclk_value(struct radeon_device *rdev, else post_divider = 1; - tmp = (u64) engine_clock * reference_divider * post_divider; - - fbdiv = (u32) ((16384 * tmp) / reference_clock); + tmp = (u64) engine_clock * reference_divider * post_divider * 16384; + do_div(tmp, reference_clock); + fbdiv = (u32) tmp; /* set up registers */ if (dividers.enable_post_div) diff --git a/drivers/gpu/drm/radeon/rv740_dpm.c b/drivers/gpu/drm/radeon/rv740_dpm.c index 7aa1608..c4c8da5 100644 --- a/drivers/gpu/drm/radeon/rv740_dpm.c +++ b/drivers/gpu/drm/radeon/rv740_dpm.c @@ -141,9 +141,9 @@ int rv740_populate_sclk_value(struct radeon_device *rdev, u32 engine_clock, reference_divider = 1 + dividers.ref_div; - tmp = (u64) engine_clock * reference_divider * dividers.post_div; - - fbdiv = (u32) ((16384 * tmp) / reference_clock); + tmp = (u64) engine_clock * reference_divider * dividers.post_div * 16384; + do_div(tmp, reference_clock); + fbdiv = (u32) tmp; spll_func_cntl &= ~(SPLL_PDIV_A_MASK | SPLL_REF_DIV_MASK); spll_func_cntl |= SPLL_REF_DIV(dividers.ref_div); diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 038c013..e58f8b6 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c @@ -511,9 +511,9 @@ static int rv770_populate_sclk_value(struct radeon_device *rdev, else post_divider = 1; - tmp = (u64) engine_clock * reference_divider * post_divider; - - fbdiv = (u32) ((16384 * tmp) / reference_clock); + tmp = (u64) engine_clock * reference_divider * post_divider * 16384; + do_div(tmp, reference_clock); + fbdiv = (u32) tmp; if (dividers.enable_post_div) spll_func_cntl |= SPLL_DIVEN; diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 4c5b258..98450d8 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -2243,8 +2243,9 @@ static u16 si_calculate_power_efficiency_ratio(struct radeon_device *rdev, if ((prev_vddc == 0) || (curr_vddc == 0)) return 0; - pwr_efficiency_ratio = ((u64)1024 * curr_vddc * curr_vddc * ((u64)1000 + margin) / - (u64)1000) / (prev_vddc * prev_vddc); + pwr_efficiency_ratio = (u64)1024 * curr_vddc * curr_vddc * ((u64)1000 + margin); + do_div(pwr_efficiency_ratio, 1000); + do_div(pwr_efficiency_ratio, (prev_vddc * prev_vddc)); if (pwr_efficiency_ratio > (u64)0xFFFF) return 0; @@ -4532,9 +4533,9 @@ static int si_calculate_sclk_params(struct radeon_device *rdev, reference_divider = 1 + dividers.ref_div; - tmp = (uint64_t) engine_clock * reference_divider * dividers.post_div; - - fbdiv = (u32) ((16384 * tmp) / reference_clock); + tmp = engine_clock * reference_divider * dividers.post_div * 16384; + do_div(tmp, reference_clock); + fbdiv = (u32) tmp; spll_func_cntl &= ~(SPLL_PDIV_A_MASK | SPLL_REF_DIV_MASK); spll_func_cntl |= SPLL_REF_DIV(dividers.ref_div);