From patchwork Fri Oct 18 13:59:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21139 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 86A4C202FF for ; Fri, 18 Oct 2013 14:01:16 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id uy5sf5281526obc.7 for ; Fri, 18 Oct 2013 07:01:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=qxWxN0Lrc7/FLLYwZo7sPP0iTAtYabCkR5rBThChkZU=; b=H0r9baXxo+7d4pyZ0/JeotscrQS/gTWCirhC8UxVMv+nWHbKGe4d7ZxYEAt4pmALxW PC0dmA2RNq1L6iGwYQiQnrNGZm9oFYffG3AWkVK32u9MVuyG6X/SsH3kGjTtJZTyKCHB BSh6RPHqA3fUZs281aNsooH+/F+M+nv/sYtDCzHlVDW5HJLh+i20hz01FV02zrrNGVjj GonlCRVvauTUNbwnHqVM8VyGB0N+f+NZEaFFn1wuwZCJlmWlLAXJUzDb4dxU4TU70yAW bBndtsfupU4QRiVNTDi0I+AaYPWu6FrnWziWpx2QliId61DXuVklhHID8GjcaayyHHJN Zd/w== X-Received: by 10.182.205.138 with SMTP id lg10mr1076372obc.33.1382104875960; Fri, 18 Oct 2013 07:01:15 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.198 with SMTP id j6ls1248129qez.6.gmail; Fri, 18 Oct 2013 07:01:15 -0700 (PDT) X-Received: by 10.220.16.73 with SMTP id n9mr500574vca.24.1382104875836; Fri, 18 Oct 2013 07:01:15 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id g7si334788vcz.45.2013.10.18.07.01.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:01:15 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 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.175; Received: by mail-vc0-f175.google.com with SMTP id ht10so272377vcb.20 for ; Fri, 18 Oct 2013 07:01:15 -0700 (PDT) X-Gm-Message-State: ALoCoQnL8GrbnPNOi/oVv6fltoiHL2B4yOyNxfM4zMcTx/yWCbNTpDk0VclMYVrY17z+gi2+Yznk X-Received: by 10.52.32.37 with SMTP id f5mr1808141vdi.17.1382104875745; Fri, 18 Oct 2013 07:01:15 -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 u4csp37940vcz; Fri, 18 Oct 2013 07:01:15 -0700 (PDT) X-Received: by 10.66.66.42 with SMTP id c10mr3688109pat.98.1382104874799; Fri, 18 Oct 2013 07:01:14 -0700 (PDT) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by mx.google.com with ESMTPS id sg3si969477pbb.283.2013.10.18.07.01.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:01:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.42; Received: by mail-pa0-f42.google.com with SMTP id kx10so4635525pab.1 for ; Fri, 18 Oct 2013 07:01:14 -0700 (PDT) X-Received: by 10.68.44.66 with SMTP id c2mr3216787pbm.57.1382104874316; Fri, 18 Oct 2013 07:01:14 -0700 (PDT) Received: from localhost ([120.56.197.189]) by mx.google.com with ESMTPSA id b3sm2649525pbh.7.2013.10.18.07.01.10 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:01:13 -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, Viresh Kumar , Sekhar Nori Subject: [PATCH V2 Resend 08/34] cpufreq: davinci: Convert to light weight ->target_index() routine Date: Fri, 18 Oct 2013 19:29:31 +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.175 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,