From patchwork Wed Aug 21 10:31:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19373 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 52A3723981 for ; Wed, 21 Aug 2013 10:33:44 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id b4sf224662qen.7 for ; Wed, 21 Aug 2013 03:33:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=FsQplMo2RytxvFo85/WbrF2AdAmf0I630nTxkGHBg/s=; b=QRqgC2G8jMPEAyBxAlrrF1qZg7FNb5atheQwQLu1DEE/LGIoCKIbCSxqVyQDkyCUaV j7nH8UQvMXAbzEGS81SpvZcFP2la7+Ki8qUTUWIXGNwXKYsvKwZMHciRAnrsw5ZrYC12 yxBW+9AQt1zdvyTTlmyYhbxWFBce3QGW4d1WFkRXJykOKxmOcooz6yzXfgTCfbXrxv0Y sh7J+vOp+Rkywf4dh3VSb6n6UWOSjM1B0uUAS8hfzRI/whwAIU2fvTGfkqArgA8OydkS u4k1jgw9Lx6rt6YBzuOa4Wo0/azxYX7lyZgwJR5Tt4w5HYizF4ERk+e1xCW6GfDGBXOf dttw== X-Received: by 10.236.45.102 with SMTP id o66mr2464878yhb.47.1377081223858; Wed, 21 Aug 2013 03:33:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.30.35 with SMTP id p3ls565835qeh.97.gmail; Wed, 21 Aug 2013 03:33:43 -0700 (PDT) X-Received: by 10.58.196.132 with SMTP id im4mr377291vec.28.1377081223771; Wed, 21 Aug 2013 03:33:43 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id c11si1907490vej.128.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 03:33:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so172532veb.30 for ; Wed, 21 Aug 2013 03:33:43 -0700 (PDT) X-Gm-Message-State: ALoCoQmfWhYGgBwBd/4Wl0gu52Kgjp1wNHX8ltX11ddmXpcoqqlUNjbFC9u6rPeTBPycWll5mrKb X-Received: by 10.221.56.194 with SMTP id wd2mr5963928vcb.7.1377081223661; Wed, 21 Aug 2013 03:33:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp211350vcz; Wed, 21 Aug 2013 03:33:43 -0700 (PDT) X-Received: by 10.68.218.199 with SMTP id pi7mr7082850pbc.19.1377081222478; Wed, 21 Aug 2013 03:33:42 -0700 (PDT) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id qf5si6041734pac.37.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 03:33:42 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id z10so272151pdj.31 for ; Wed, 21 Aug 2013 03:33:42 -0700 (PDT) X-Received: by 10.68.52.10 with SMTP id p10mr7061735pbo.92.1377081221852; Wed, 21 Aug 2013 03:33:41 -0700 (PDT) Received: from localhost ([223.238.228.239]) by mx.google.com with ESMTPSA id sx7sm7525921pbc.41.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 21 Aug 2013 03:33:41 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl, swarren@nvidia.com Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH] cpufreq: Tegra: remove target_cpu_speed[] array Date: Wed, 21 Aug 2013 16:01:52 +0530 Message-Id: <896370a3ad0db9e85f8776d923fcd5129d4e4d56.1377080903.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Tegra's cpufreq driver was maintaining requested target frequencies in an array: target_cpu_speed. And then finally setting the highest requested freq in the core. This was probably done because both cores share clock line and logically we want to set both cores to the max frequency requested.. But this wasn't required to be done in individual CPUFreq drivers, its already taken care of by CPUFreq governors. They evaluate load for all CPUs and finally call target only for the frequency corresponding to max load. So, get rid of this stuff from Tegra's cpufreq driver. Signed-off-by: Viresh Kumar Acked-by: Stephen Warren --- Hi Stephen, Its only build tested and depends on lots of stuff that I have already sent for cpufreq core and its drivers. All of that is pushed here: https://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/for-v3.13 And only Tegra+cpufreq-core patches are pushed here (only 13 patches): https://git.linaro.org/gitweb?p=people/vireshk/linux.git;a=shortlog;h=refs/heads/cpufreq-next-tegra You can probably try cpufreq-next-tegra branch for testing on some real hardware. drivers/cpufreq/tegra-cpufreq.c | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c index b376b67..3f25ab6 100644 --- a/drivers/cpufreq/tegra-cpufreq.c +++ b/drivers/cpufreq/tegra-cpufreq.c @@ -47,7 +47,6 @@ static struct clk *pll_x_clk; static struct clk *pll_p_clk; static struct clk *emc_clk; -static unsigned long target_cpu_speed[NUM_CPUS]; static DEFINE_MUTEX(tegra_cpu_lock); static bool is_suspended; @@ -103,9 +102,6 @@ static int tegra_update_cpu_speed(struct cpufreq_policy *policy, { int ret = 0; - if (tegra_getspeed(0) == rate) - return ret; - /* * Vote on memory bus frequency based on cpu frequency * This sets the minimum frequency, display or avp may request higher @@ -125,35 +121,16 @@ static int tegra_update_cpu_speed(struct cpufreq_policy *policy, return ret; } -static unsigned long tegra_cpu_highest_speed(void) -{ - unsigned long rate = 0; - int i; - - for_each_online_cpu(i) - rate = max(rate, target_cpu_speed[i]); - return rate; -} - static int tegra_target(struct cpufreq_policy *policy, unsigned int index) { - unsigned int freq; - int ret = 0; + int ret = -EBUSY; mutex_lock(&tegra_cpu_lock); - if (is_suspended) { - ret = -EBUSY; - goto out; - } - - freq = freq_table[index].frequency; + if (!is_suspended) + ret = tegra_update_cpu_speed(policy, + freq_table[index].frequency); - target_cpu_speed[policy->cpu] = freq; - - ret = tegra_update_cpu_speed(policy, tegra_cpu_highest_speed()); - -out: mutex_unlock(&tegra_cpu_lock); return ret; } @@ -167,7 +144,8 @@ static int tegra_pm_notify(struct notifier_block *nb, unsigned long event, is_suspended = true; pr_info("Tegra cpufreq suspend: setting frequency to %d kHz\n", freq_table[0].frequency); - tegra_update_cpu_speed(policy, freq_table[0].frequency); + if (tegra_getspeed(0) != freq_table[0].frequency) + tegra_update_cpu_speed(policy, freq_table[0].frequency); cpufreq_cpu_put(policy); } else if (event == PM_POST_SUSPEND) { is_suspended = false; @@ -190,7 +168,6 @@ static int tegra_cpu_init(struct cpufreq_policy *policy) clk_prepare_enable(cpu_clk); cpufreq_table_validate_and_show(policy, freq_table); - target_cpu_speed[policy->cpu] = tegra_getspeed(policy->cpu); /* FIXME: what's the actual transition time? */ policy->cpuinfo.transition_latency = 300 * 1000;