From patchwork Fri Aug 23 15:50:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19482 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f70.google.com (mail-qe0-f70.google.com [209.85.128.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 00AA2248E6 for ; Fri, 23 Aug 2013 15:52:49 +0000 (UTC) Received: by mail-qe0-f70.google.com with SMTP id a11sf614187qen.9 for ; Fri, 23 Aug 2013 08:52:49 -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=97W1RAlDgeHw5pBK+CYDigLFNIU1YIHcAfl0rA3nTNg=; b=VbHlXHuIr8czBZ07GUpUAr6yBC0TjYAN22gY3yp3gBgf9njr8Kr6NGr0AOQpTikoWY fdxgAdK8G8NMNAylVWxJ84uRhR2CROQ1lo0UNokz2Lo5k3PAm0K9MLIN5VaeaaqVfxMD 7Lz9XmurZYhw1vZ5sVMlsMVSuznx8DtzeNUVv/shHF8FDroPdKPZxF9My5TeXkrCf19O EWRMyDy/qXcIJdi2b0WeQwLqgY6TkTDfxs7NsfEAmJ3Pv1f7Xa/Il5xp62bHs4Jw8wFj +nKHPUZbpyU5xDoVo6+9sA78ZFkHtVX34m1XPlyYPirM9RfsS39Lpd3gN/lLq/B92uRS WWfw== X-Received: by 10.236.115.198 with SMTP id e46mr112735yhh.33.1377273169777; Fri, 23 Aug 2013 08:52:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.26.70 with SMTP id j6ls1679984qeg.94.gmail; Fri, 23 Aug 2013 08:52:49 -0700 (PDT) X-Received: by 10.220.177.72 with SMTP id bh8mr108529vcb.73.1377273169697; Fri, 23 Aug 2013 08:52:49 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id j6si123483vet.93.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:52:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id ha12so536142vcb.23 for ; Fri, 23 Aug 2013 08:52:49 -0700 (PDT) X-Gm-Message-State: ALoCoQnCT3PLS34a40cZa8UmO5VNCdI/3Aii8DFa33OavslpnmTo+Ue3gVEvQ16K2jw3RCdgzAmJ X-Received: by 10.58.152.3 with SMTP id uu3mr158009veb.16.1377273169601; Fri, 23 Aug 2013 08:52:49 -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 u4csp100661vcz; Fri, 23 Aug 2013 08:52:49 -0700 (PDT) X-Received: by 10.66.254.136 with SMTP id ai8mr11973775pad.86.1377273168652; Fri, 23 Aug 2013 08:52:48 -0700 (PDT) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id tl4si834908pac.21.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:52:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id fb10so826974pad.23 for ; Fri, 23 Aug 2013 08:52:48 -0700 (PDT) X-Received: by 10.66.170.168 with SMTP id an8mr21912920pac.58.1377273168132; Fri, 23 Aug 2013 08:52:48 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id tz3sm536051pbc.20.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:52:47 -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 , Linus Walleij Subject: [PATCH 06/16] cpufreq: dbx500: use cpufreq_generic_get() routine Date: Fri, 23 Aug 2013 21:20:41 +0530 Message-Id: <5f8581601947988a49c36f465e36028758539cc0.1377272740.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.178 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: , We have common infrastructure available with us for getting a CPUs clk rate. Lets use it for this driver. We don't have to find closest frequency in platform specific ->get() routine wihch dbx500 driver was doing and hence it can be removed as well. Cc: Linus Walleij Signed-off-by: Viresh Kumar Acked-by: Linus Walleij --- drivers/cpufreq/dbx500-cpufreq.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/cpufreq/dbx500-cpufreq.c b/drivers/cpufreq/dbx500-cpufreq.c index 0e67ab9..d83129d 100644 --- a/drivers/cpufreq/dbx500-cpufreq.c +++ b/drivers/cpufreq/dbx500-cpufreq.c @@ -26,24 +26,9 @@ static int dbx500_cpufreq_target(struct cpufreq_policy *policy, return clk_set_rate(armss_clk, freq_table[index].frequency * 1000); } -static unsigned int dbx500_cpufreq_getspeed(unsigned int cpu) -{ - int i = 0; - unsigned long freq = clk_get_rate(armss_clk) / 1000; - - /* The value is rounded to closest frequency in the defined table. */ - while (freq_table[i + 1].frequency != CPUFREQ_TABLE_END) { - if (freq < freq_table[i].frequency + - (freq_table[i + 1].frequency - freq_table[i].frequency) / 2) - return freq_table[i].frequency; - i++; - } - - return freq_table[i].frequency; -} - static int dbx500_cpufreq_init(struct cpufreq_policy *policy) { + policy->clk = armss_clk; return cpufreq_generic_init(policy, freq_table, 20 * 1000); } @@ -51,7 +36,7 @@ static struct cpufreq_driver dbx500_cpufreq_driver = { .flags = CPUFREQ_STICKY | CPUFREQ_CONST_LOOPS, .verify = cpufreq_generic_frequency_table_verify, .target_index = dbx500_cpufreq_target, - .get = dbx500_cpufreq_getspeed, + .get = cpufreq_generic_get, .init = dbx500_cpufreq_init, .name = "DBX500", .attr = cpufreq_generic_attr,