From patchwork Fri Sep 13 13:02:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20248 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF5D720358 for ; Fri, 13 Sep 2013 13:26:07 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id db12sf1243293veb.6 for ; Fri, 13 Sep 2013 06:26:07 -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=D7zL1QJSd5BTs9L9EZP4ulfvOCs0WDVuYZDmPPQ83yM=; b=mc1Kq1vTBf8doioDOmuLJIqpyO23V9ycBnzVoewP4YbQEK6qLV6D/qRR5pGaluZ/cU xBKqgV8C3M6UMblVgBKt77v2/3hLU+KWLHy8b6jdXWAT/KtPi8iW+JZLAcJ4gYf2CUMA lPoKVdVAe73Uwoe6XfgNlL6xPwQ4Of3AIREZOfDFaSJa3nfVfj76AZqwPnLg7AuSyUqZ yGHu6cjqfH8AS72ef19UCoYcXmhtmq1MPhAznSeqLgp6gHMb7NHYT1TiJzBzW8j+FTuB CZPM4tMf3cMu7UrHm/CO10OaaeIFU9KDTSOY0v5A2fQZTxITIdKirtXJ69ylsAwfwfjK 5xFA== X-Gm-Message-State: ALoCoQlpz/Ji2JfSqb+wMrwu/fERtpH+qlQMKs7nLFZfDBR/+R3hV1OXhPtiKzcD7CSwqJCcqK8s X-Received: by 10.236.142.38 with SMTP id h26mr333663yhj.57.1379078767463; Fri, 13 Sep 2013 06:26:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.28.10 with SMTP id x10ls1218399qeg.20.gmail; Fri, 13 Sep 2013 06:26:07 -0700 (PDT) X-Received: by 10.221.56.194 with SMTP id wd2mr12185042vcb.7.1379078767162; Fri, 13 Sep 2013 06:26:07 -0700 (PDT) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id vv9si3139639vec.5.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:26:07 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.51 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.51; Received: by mail-vb0-f51.google.com with SMTP id x16so924297vbf.10 for ; Fri, 13 Sep 2013 06:26:07 -0700 (PDT) X-Received: by 10.52.230.202 with SMTP id ta10mr163907vdc.41.1379078767063; Fri, 13 Sep 2013 06:26:07 -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 u4csp80648vcz; Fri, 13 Sep 2013 06:26:06 -0700 (PDT) X-Received: by 10.66.221.8 with SMTP id qa8mr1649057pac.188.1379078766093; Fri, 13 Sep 2013 06:26:06 -0700 (PDT) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx.google.com with ESMTPS id h2si11278649pao.20.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:26:06 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.53 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.53; Received: by mail-pa0-f53.google.com with SMTP id lb1so2536073pab.12 for ; Fri, 13 Sep 2013 06:26:05 -0700 (PDT) X-Received: by 10.66.136.227 with SMTP id qd3mr15070042pab.113.1379078765683; Fri, 13 Sep 2013 06:26:05 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id iu7sm11738415pbc.45.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:26:05 -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 , Shawn Guo Subject: [PATCH 194/228] cpufreq: imx6q: remove calls to cpufreq_notify_transition() Date: Fri, 13 Sep 2013 18:32:20 +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.212.51 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: , Most of the drivers do following in their ->target_index() routines: struct cpufreq_freqs freqs; freqs.old = old freq... freqs.new = new freq... cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* Change rate here */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); This is replicated over all cpufreq drivers today and there doesn't exists a good enough reason why this shouldn't be moved to cpufreq core instead. Earlier patches have added support in cpufreq core to do cpufreq notification on frequency change, this one removes it from this driver. Some related minor cleanups are also done along with it. Cc: Shawn Guo Signed-off-by: Viresh Kumar --- drivers/cpufreq/imx6q-cpufreq.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index e8846d7..a3829a0 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -41,14 +41,14 @@ static unsigned int imx6q_get_speed(unsigned int cpu) static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) { - struct cpufreq_freqs freqs; struct opp *opp; unsigned long freq_hz, volt, volt_old; + unsigned int old_freq, new_freq; int ret; - freqs.new = freq_table[index].frequency; - freq_hz = freqs.new * 1000; - freqs.old = clk_get_rate(arm_clk) / 1000; + new_freq = freq_table[index].frequency; + freq_hz = new_freq * 1000; + old_freq = clk_get_rate(arm_clk) / 1000; rcu_read_lock(); opp = opp_find_freq_ceil(cpu_dev, &freq_hz); @@ -63,26 +63,23 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) volt_old = regulator_get_voltage(arm_reg); dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n", - freqs.old / 1000, volt_old / 1000, - freqs.new / 1000, volt / 1000); - - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); + old_freq / 1000, volt_old / 1000, + new_freq / 1000, volt / 1000); /* scaling up? scale voltage before frequency */ - if (freqs.new > freqs.old) { + if (new_freq > old_freq) { ret = regulator_set_voltage_tol(arm_reg, volt, 0); if (ret) { dev_err(cpu_dev, "failed to scale vddarm up: %d\n", ret); - freqs.new = freqs.old; - goto post_notify; + return ret; } /* * Need to increase vddpu and vddsoc for safety * if we are about to run at 1.2 GHz. */ - if (freqs.new == FREQ_1P2_GHZ / 1000) { + if (new_freq == FREQ_1P2_GHZ / 1000) { regulator_set_voltage_tol(pu_reg, PU_SOC_VOLTAGE_HIGH, 0); regulator_set_voltage_tol(soc_reg, @@ -102,21 +99,20 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) clk_set_parent(step_clk, pll2_pfd2_396m_clk); clk_set_parent(pll1_sw_clk, step_clk); if (freq_hz > clk_get_rate(pll2_pfd2_396m_clk)) { - clk_set_rate(pll1_sys_clk, freqs.new * 1000); + clk_set_rate(pll1_sys_clk, new_freq * 1000); clk_set_parent(pll1_sw_clk, pll1_sys_clk); } /* Ensure the arm clock divider is what we expect */ - ret = clk_set_rate(arm_clk, freqs.new * 1000); + ret = clk_set_rate(arm_clk, new_freq * 1000); if (ret) { dev_err(cpu_dev, "failed to set clock rate: %d\n", ret); regulator_set_voltage_tol(arm_reg, volt_old, 0); - freqs.new = freqs.old; - goto post_notify; + return ret; } /* scaling down? scale voltage after frequency */ - if (freqs.new < freqs.old) { + if (new_freq < old_freq) { ret = regulator_set_voltage_tol(arm_reg, volt, 0); if (ret) { dev_warn(cpu_dev, @@ -124,7 +120,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) ret = 0; } - if (freqs.old == FREQ_1P2_GHZ / 1000) { + if (old_freq == FREQ_1P2_GHZ / 1000) { regulator_set_voltage_tol(pu_reg, PU_SOC_VOLTAGE_NORMAL, 0); regulator_set_voltage_tol(soc_reg, @@ -132,10 +128,7 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) } } -post_notify: - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); - - return ret; + return 0; } static int imx6q_cpufreq_init(struct cpufreq_policy *policy)