From patchwork Tue Oct 11 21:12:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hotran X-Patchwork-Id: 9371721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1EBBF60487 for ; Tue, 11 Oct 2016 21:21:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1276A290AD for ; Tue, 11 Oct 2016 21:21:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06D5E290FC; Tue, 11 Oct 2016 21:21:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7094C290AD for ; Tue, 11 Oct 2016 21:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752842AbcJKVVT (ORCPT ); Tue, 11 Oct 2016 17:21:19 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:35433 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752796AbcJKVVS (ORCPT ); Tue, 11 Oct 2016 17:21:18 -0400 Received: by mail-pa0-f54.google.com with SMTP id qn10so21101682pac.2 for ; Tue, 11 Oct 2016 14:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id; bh=+H23iTOI7k8Ml+QrZc6qoSMmFm64ENbOYK4K+fWilks=; b=Qdyu3pFet3Nhba09TbBbS1MPBRFc7Otz1Jibw9c1MTg9uEd2XRoM9EcyRX1/9zagK0 T6oD5dhsonhlLWLKCrrLeHjwJpZaW8htcekpf3Vh51lMl32LR6Xi05VG5O8Iqt01xibl 1TVT/YPgEUDISeScrcSKFBgW2vmuX8AwoEsVs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+H23iTOI7k8Ml+QrZc6qoSMmFm64ENbOYK4K+fWilks=; b=bpVaJT5F1QIbKp5l4zqfRXTfm6QroyEo0RGUggekIY5f0uM81aJnA5RZ+/20U6x/8C tYgetAfHYFoN1Maf8RRh7195zMR5Lw2iOo28XQkNXxLPizpklAWe0LQ6oEtwsDTgzrFr oAzNYzur1NlO+F0RDOEzszJVrdw1mmKNQOz+344Y1VSKqC82pXPuBF1Q0tC2ZbIyNBiB SHFCBkk+qCD8kBtAxIqGz4oeMZQ+1TRGtJ7pmagDz/3fVFTY+b2lypoO1kV3J2hHJyNa MRHfFsxvog5fxmWeLVq/QcpnETZq/jor3c0oVUO+UYEQNG24VPSPTtkfqGPfUwftt/ph 8sBw== X-Gm-Message-State: AA6/9RlS4Cgm+ulBbrvLNAYBa+woTWTYE2lwWoCXybJnBqgtPBWA2qLeK74LZISWlzreo4rq X-Received: by 10.66.55.9 with SMTP id n9mr9777651pap.153.1476220360863; Tue, 11 Oct 2016 14:12:40 -0700 (PDT) Received: from hotran_localhost.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id s6sm6469251pfg.46.2016.10.11.14.12.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Oct 2016 14:12:40 -0700 (PDT) From: Hoan Tran To: "Rafael J. Wysocki" , Viresh Kumar , pprakash@codeaurora.org, Al Stone Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, lho@apm.com, Duc Dang , Hoan Tran Subject: [PATCH] cpufreq: CPPC: Correct desired_perf calculation Date: Tue, 11 Oct 2016 14:12:00 -0700 Message-Id: <1476220320-19685-1-git-send-email-hotran@apm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The desired_perf is an abstract performance number. Its value should be in the range of [lowest perf, highest perf] of CPPC. The correct calculation is desired_perf = freq * cppc_highest_perf / cppc_dmi_max_khz Signed-off-by: Hoan Tran Acked-by: Viresh Kumar --- drivers/cpufreq/cppc_cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 1b2f28f..ab1d4b7 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -84,7 +84,7 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, cpu = all_cpu_data[policy->cpu]; - cpu->perf_ctrls.desired_perf = (u64)target_freq * policy->max / cppc_dmi_max_khz; + cpu->perf_ctrls.desired_perf = (u64)target_freq * cpu->perf_caps.highest_perf / cppc_dmi_max_khz; freqs.old = policy->cur; freqs.new = target_freq;