From patchwork Fri Sep 13 13:02:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20266 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CC10620358 for ; Fri, 13 Sep 2013 13:28:17 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id ht10sf1209957vcb.5 for ; Fri, 13 Sep 2013 06:28:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=lmdIm6d4QAM84a8ztHfD+CaFCs7g5kVyTS1+smDB5Zg=; b=Xd1ZfWkiBCusm9+m0XwXWb3PXGixI7N6oxUA9WjaBm6cXn7lz8BX+NZjKwZ7YbUf3W R8NwoSSmWODQecu5oASjZ/zj9u7jNH24cvjI8nGPcFdvEGeOHLBUbtgr6Vj/JoT7L8fi 7HKesBFcRjvfcjEIsn4Um3Lzs2JeoPSep2c8QwA58Q9LmRsDw8h1c7GdA/V1KEzmUhj0 FR2O29wpE9huIU4T9ib0tkxPcEiKE6veZHiMs9BXGOHR8DmEyfynWor23Fw6IeJAYjgZ nIcZrg/UaPvhZYmU/x6KVy8NgXtXK6sJGFqxAyO0xtNsQtFk5hm2TsY2oT8ia/swRVWs i4LA== X-Gm-Message-State: ALoCoQksEsfKRm/s9r6p+tGKG0zRw8JUkxfCWg2ASeapipZuCi1/N5Bkv0VoTrJeoTlDo2M/JjAF X-Received: by 10.236.0.232 with SMTP id 68mr5007535yhb.16.1379078897577; Fri, 13 Sep 2013 06:28:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.16.6 with SMTP id b6ls1078844qed.79.gmail; Fri, 13 Sep 2013 06:28:17 -0700 (PDT) X-Received: by 10.52.23.113 with SMTP id l17mr10246075vdf.23.1379078897337; Fri, 13 Sep 2013 06:28:17 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id tt2si3125628vcb.77.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:28:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.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.220.171; Received: by mail-vc0-f171.google.com with SMTP id ij15so904530vcb.2 for ; Fri, 13 Sep 2013 06:28:17 -0700 (PDT) X-Received: by 10.52.103.101 with SMTP id fv5mr1411647vdb.31.1379078897251; Fri, 13 Sep 2013 06:28:17 -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 u4csp80760vcz; Fri, 13 Sep 2013 06:28:16 -0700 (PDT) X-Received: by 10.68.135.35 with SMTP id pp3mr2091025pbb.190.1379078896403; Fri, 13 Sep 2013 06:28:16 -0700 (PDT) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx.google.com with ESMTPS id pi7si7445590pbc.321.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:28:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.49 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.49; Received: by mail-pa0-f49.google.com with SMTP id ld10so2526117pab.22 for ; Fri, 13 Sep 2013 06:28:16 -0700 (PDT) X-Received: by 10.66.161.38 with SMTP id xp6mr15099931pab.145.1379078895967; Fri, 13 Sep 2013 06:28:15 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id fk4sm18082385pab.23.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:28:15 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar Subject: [PATCH 212/228] cpufreq: tegra: remove target_cpu_speed[] array Date: Fri, 13 Sep 2013 18:32:38 +0530 Message-Id: X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: 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.220.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. Acked-by: Stephen Warren Signed-off-by: Viresh Kumar --- drivers/cpufreq/tegra-cpufreq.c | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c index f42df7e..7d36b54 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; - - target_cpu_speed[policy->cpu] = freq; + if (!is_suspended) + ret = tegra_update_cpu_speed(policy, + freq_table[index].frequency); - 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; @@ -191,8 +169,6 @@ static int tegra_cpu_init(struct cpufreq_policy *policy) clk_prepare_enable(emc_clk); clk_prepare_enable(cpu_clk); - target_cpu_speed[policy->cpu] = tegra_getspeed(policy->cpu); - /* FIXME: what's the actual transition time? */ ret = cpufreq_generic_init(policy, freq_table, 300 * 1000); if (ret) {