From patchwork Wed Oct 30 22:52:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21281 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4D54C244A4 for ; Wed, 30 Oct 2013 22:52:26 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id aq17sf5760216iec.11 for ; Wed, 30 Oct 2013 15:52:26 -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=iiZKMSeSBaUvkvnkbI3Xj3UR2dtiA22xQ5ERyKm5aHA=; b=OHu+U3ZYWK1kaO6JyjOwYjWOKQCjIIIMMSTVEAqxunt3EOzILImepbohlm5kvadZTw l7XPxV20/lkw3mqPpRkWeP6lxIa8vYZMTPjCbyOZMj5PaXbvptr0u2YO0+JCArGWXzrr 8HVA/lhF2Tde6VaHW13QywqwAymSoJWcQnBUMv1gb46zFk9Og3lBHc1US0yCJd6zO6Iu 2WE4eXG+3S4NOwdDUOyu1KQFO1R8PXMPpevgqN2tjaC6cb1sCxc/XMq989i091Jn2y9u CcjX2kMM0ATfWUuvHcZtN3ydsKXjDHs1yrSvZHms2lk6FQtRUHv9OZCz4t1lbGVUL0WK NVMg== X-Gm-Message-State: ALoCoQn88ZwkeD9l9majhBiMw3X1Xuo1VyRfM22JtWn8V7bf3O9UW8/OGY98gmtZULnZ59M4YB2C X-Received: by 10.182.53.165 with SMTP id c5mr91412obp.0.1383173545951; Wed, 30 Oct 2013 15:52:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.100 with SMTP id j4ls739682qew.29.gmail; Wed, 30 Oct 2013 15:52:25 -0700 (PDT) X-Received: by 10.58.250.227 with SMTP id zf3mr20215vec.37.1383173545808; Wed, 30 Oct 2013 15:52:25 -0700 (PDT) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id m10si69328vcm.132.2013.10.30.15.52.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.42 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.42; Received: by mail-vb0-f42.google.com with SMTP id p14so1371350vbm.15 for ; Wed, 30 Oct 2013 15:52:25 -0700 (PDT) X-Received: by 10.58.22.33 with SMTP id a1mr15103vef.55.1383173545727; Wed, 30 Oct 2013 15:52:25 -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 u4csp316044vcz; Wed, 30 Oct 2013 15:52:25 -0700 (PDT) X-Received: by 10.182.191.36 with SMTP id gv4mr3145obc.103.1383173544885; Wed, 30 Oct 2013 15:52:24 -0700 (PDT) Received: from mail-oa0-f52.google.com (mail-oa0-f52.google.com [209.85.219.52]) by mx.google.com with ESMTPS id ck3si120506oeb.86.2013.10.30.15.52.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.219.52 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.219.52; Received: by mail-oa0-f52.google.com with SMTP id j1so2210076oag.39 for ; Wed, 30 Oct 2013 15:52:24 -0700 (PDT) X-Received: by 10.60.157.2 with SMTP id wi2mr45160oeb.35.1383173544602; Wed, 30 Oct 2013 15:52:24 -0700 (PDT) Received: from localhost (sccc-66-78-236-243.smartcity.com. [66.78.236.243]) by mx.google.com with ESMTPSA id nw5sm608060obc.9.2013.10.30.15.52.24 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:24 -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@linaro.org Subject: [PATCH V2 Resend 05/16] cpufreq: dbx500: use cpufreq_generic_get() routine Date: Thu, 31 Oct 2013 04:22:03 +0530 Message-Id: <956f3793295af6ac2552406ff3b7cf79edc93ae0.1383173230.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.212.42 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. Acked-by: Linus Walleij Signed-off-by: Viresh Kumar --- 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,