From patchwork Fri Sep 13 13:01:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20208 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EE76F20358 for ; Fri, 13 Sep 2013 13:21:12 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf1233755qec.0 for ; Fri, 13 Sep 2013 06:21:12 -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=qxWxN0Lrc7/FLLYwZo7sPP0iTAtYabCkR5rBThChkZU=; b=Qwjaxwe5e1eBy32oVSD6TjiFXQm6Y7t/7AiUCf08+xwE1MzGYWfXCdMkIhw5XASnwz Ae26FLkOjBYDJ+SoJhcMzRQXYEuACvYi13263864D1rUneFJxGrCSJqEzs0A/Fm3yyTP ZmDQI9Vv2S8SrVO1q3YdE2Vr7dM8r4EvbVWrM8HrHGyLo10WlATR6T+wvW8TH4Kbyigy 96MjHUrxvwEMpBBcuGB/OE+vQti/8kl58DPkYY/to3Uli3p8XziECrFUeVj67n74EBQi 4dMTntBAFGwVyxR4UqgDTiBHQbPGx7dnebwzHHZ/nT+Kw6bZETyllj+Gly5V/9FHr/7h h7WQ== X-Gm-Message-State: ALoCoQlL2Apmlui3vurT2pBuOvUpatanihZu2284ZnwKxA49L7DQ1jDpY/sLTSiW5psaLKDwfO8Q X-Received: by 10.236.41.100 with SMTP id g64mr5116834yhb.31.1379078472817; Fri, 13 Sep 2013 06:21:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.24.172 with SMTP id v12ls1187518qef.91.gmail; Fri, 13 Sep 2013 06:21:12 -0700 (PDT) X-Received: by 10.58.171.4 with SMTP id aq4mr1638198vec.26.1379078472621; Fri, 13 Sep 2013 06:21:12 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id ti4si3119107vec.61.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:21:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 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.169; Received: by mail-ve0-f169.google.com with SMTP id db12so982966veb.28 for ; Fri, 13 Sep 2013 06:21:12 -0700 (PDT) X-Received: by 10.52.157.134 with SMTP id wm6mr5870508vdb.26.1379078472535; Fri, 13 Sep 2013 06:21:12 -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 u4csp80389vcz; Fri, 13 Sep 2013 06:21:12 -0700 (PDT) X-Received: by 10.66.142.107 with SMTP id rv11mr15530478pab.17.1379078471695; Fri, 13 Sep 2013 06:21:11 -0700 (PDT) Received: from mail-pb0-f41.google.com (mail-pb0-f41.google.com [209.85.160.41]) by mx.google.com with ESMTPS id sl4si11166730pac.300.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:21:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.41 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.41; Received: by mail-pb0-f41.google.com with SMTP id rp2so1232255pbb.14 for ; Fri, 13 Sep 2013 06:21:11 -0700 (PDT) X-Received: by 10.66.216.129 with SMTP id oq1mr15509984pac.75.1379078471287; Fri, 13 Sep 2013 06:21:11 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id qa9sm11757053pbc.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:21:10 -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 154/228] cpufreq: davinci: Convert to light weight ->target_index() routine Date: Fri, 13 Sep 2013 18:31:40 +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.128.169 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 972583b..1f5d8a5 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c @@ -66,28 +66,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 */ @@ -148,7 +138,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,