From patchwork Tue Aug 13 13:32:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19064 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5C714246B8 for ; Tue, 13 Aug 2013 13:34:17 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id 9sf647810qea.2 for ; Tue, 13 Aug 2013 06:34:17 -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: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=8cWP/JObhbWUf2UH/JbcvMFC0y+PiUYHJZx2jChPV48=; b=LFfA3mkiyFezPCPqwB4XjQ0KKo1cd+0etBniFMjeyocdz0e4hoC2X+JN4sraJvBoW+ 1Zcy9Nw8iUQ5V0WqLmd6QtXZUqfZ90GyofQY0XfRBKFo1blgKIHKMZT41IYA9FERh27R xlBsgq2Tj2Vcta0In10HYD23QQ7d4M0Gn/6HQOuoS+qbXSMqcVPRsTcAJvY8y37C7zUT iNFkLHGAfppDv6OkCD56gZYWK4fDVG3KnLfOy67dSOzTbd6GcY1PJSxmxzsCxlu9YyTQ JxQkNf1VffecZKoyGiEjEjNmH1PBJSGaEQB9v4pdznSKgcSdkLshM21qT5Lf9L4ZhhMy Iq0A== X-Received: by 10.236.151.44 with SMTP id a32mr552318yhk.51.1376400857144; Tue, 13 Aug 2013 06:34:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.101.44 with SMTP id fd12ls2800539qeb.98.gmail; Tue, 13 Aug 2013 06:34:17 -0700 (PDT) X-Received: by 10.52.103.35 with SMTP id ft3mr3795360vdb.5.1376400857041; Tue, 13 Aug 2013 06:34:17 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id sy7si9745872vdc.66.2013.08.13.06.34.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:34:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.179 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.179; Received: by mail-vc0-f179.google.com with SMTP id ht10so3834677vcb.24 for ; Tue, 13 Aug 2013 06:34:17 -0700 (PDT) X-Gm-Message-State: ALoCoQk/EQRKt49LMS/l7ktS9aLxHd1K1OLf2HvRr/PEoyQmzY9NJtSzX3HyqW8btNNvNE4irS2h X-Received: by 10.221.44.136 with SMTP id ug8mr4484277vcb.13.1376400856870; Tue, 13 Aug 2013 06:34:16 -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 u4csp154164vcz; Tue, 13 Aug 2013 06:34:16 -0700 (PDT) X-Received: by 10.68.225.164 with SMTP id rl4mr4671876pbc.100.1376400855800; Tue, 13 Aug 2013 06:34:15 -0700 (PDT) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id qf5si26238722pac.211.2013.08.13.06.34.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:34:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kl13so8870807pab.6 for ; Tue, 13 Aug 2013 06:34:15 -0700 (PDT) X-Received: by 10.66.37.43 with SMTP id v11mr4630685paj.108.1376400855393; Tue, 13 Aug 2013 06:34:15 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id a5sm44018364pbw.4.2013.08.13.06.34.11 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Aug 2013 06:34:14 -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 , Sekhar Nori Subject: [PATCH V2 09/35] cpufreq: davinci: Covert to light weight ->target_index() routine Date: Tue, 13 Aug 2013 19:02:22 +0530 Message-Id: <85dcef4ab5e76cc011f09804c5472dff8ccd3d48.1376392602.git.viresh.kumar@linaro.org> 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.179 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: , This patch converts existing .target() to newly defined light weight .target_index() routine for this driver. CPUFreq core will call cpufreq_frequency_table_target() before calling this routine and will pass index to it. Cc: Sekhar Nori Signed-off-by: Viresh Kumar --- drivers/cpufreq/davinci-cpufreq.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c index 33e9460..822100b 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c @@ -68,28 +68,18 @@ static unsigned int davinci_getspeed(unsigned int cpu) return clk_get_rate(cpufreq.armclk) / 1000; } -static int davinci_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) +static int davinci_target(struct cpufreq_policy *policy, unsigned int idx) { int ret = 0; - unsigned int idx; struct cpufreq_freqs freqs; struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; struct clk *armclk = cpufreq.armclk; freqs.old = davinci_getspeed(0); - freqs.new = clk_round_rate(armclk, target_freq * 1000) / 1000; - - if (freqs.old == freqs.new) - return ret; + freqs.new = pdata->freq_table[idx].frequency; dev_dbg(cpufreq.dev, "transition: %u --> %u\n", freqs.old, freqs.new); - ret = cpufreq_frequency_table_target(policy, pdata->freq_table, - freqs.new, relation, &idx); - if (ret) - return -EINVAL; - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* if moving to higher frequency, up the voltage beforehand */ @@ -160,7 +150,7 @@ static int davinci_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver davinci_driver = { .flags = CPUFREQ_STICKY, .verify = davinci_verify_speed, - .target = davinci_target, + .target_index = davinci_target, .get = davinci_getspeed, .init = davinci_cpu_init, .exit = cpufreq_generic_exit,