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: 2843773 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7FB72BF546 for ; Tue, 13 Aug 2013 15:39:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5916A2049D for ; Tue, 13 Aug 2013 15:39:27 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 12C6A2045B for ; Tue, 13 Aug 2013 15:39:26 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Elj-0007He-72; Tue, 13 Aug 2013 13:36:17 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9El1-0007wQ-Ut; Tue, 13 Aug 2013 13:35:31 +0000 Received: from mail-pb0-f49.google.com ([209.85.160.49]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9Ek8-0007is-Sq for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2013 13:34:38 +0000 Received: by mail-pb0-f49.google.com with SMTP id xb4so8009661pbc.22 for ; Tue, 13 Aug 2013 06:34:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=8cWP/JObhbWUf2UH/JbcvMFC0y+PiUYHJZx2jChPV48=; b=ok6xyM+zwjRQboAXidyaTeopDdy01wW6+yihohYlaknsx5UvFz19t3Qk53HAvHGbWG B/rZTaodrP4ic1/+Q9APXIgNkdRT1OGv2VZ3bhTOwxbJ+7zor/4uGa8hN9FW1k/biPFQ iv3nDK9qn1Mxg9lZx49+i3avZM+hyVPwVu74JZDHOb0pUVsz/kKvaUiHSr0DJZWFu/F4 AVLQNKawjx3pAanhdVS+s4lALu9jq/q9QIN1MjVBmmVKXzib9x2KC8GsTuzjpWMq92Z9 pu9RqqpZXz1EZpHb1CiZhDpVaqkVQ3ewWMKDoUMR5OIMWFuw7pHeY7IApCGS0jbFoB+s KHNA== X-Gm-Message-State: ALoCoQmQRysOyzR5lV4IOPLy848cRZSt1Zn9Mp0oaRP8tnYNNqXhuZG/PxRrYip29B+m6wx6jcIF 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130813_093437_180110_7F1BA094 X-CRM114-Status: GOOD ( 10.27 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , patches@linaro.org, Sekhar Nori , linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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,