From patchwork Fri Sep 13 13:02:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 20272 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 31F3420358 for ; Fri, 13 Sep 2013 13:28:59 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf1215905vbg.3 for ; Fri, 13 Sep 2013 06:28:58 -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=YVfIWl41MqmcANXEzr4Rr+WDpfc38LEhj1Qi3rnlujJw72i+xVXwbZA8mAXDuuNQEt AXqVoOVbXh1RyCgEY8coWniRZ3E/tRBGGhStP96hwOCq/M5C1mWNWbf2k+poxerewJtC GeTHiddwDc5zRJYP5uqSyTkrcdW8cyhjLgc2O4wIn4iLlsZ/+VvUnaFNRkLT5SjcA/jS LfncD/gJuwtpXyyCauS97Yg2TKQC5aIATe43zcvP4rHEN4QSHAsbRmFFjlPEkCg8sxJq CNDb8ntq/D+FCU6oJn6h5qypkjW75ZWSEdi0CvXmW30C/9PaA04dUPml/PzKd9bYyAPv LJGg== X-Gm-Message-State: ALoCoQlo0q1gk0YXSHgaoFl7a1m1p2Xp7PJkR/8n3QXyVtbuTcEBtu8Jvjmn2ifTS4tmqVrU503i X-Received: by 10.236.52.228 with SMTP id e64mr4839423yhc.45.1379078938945; Fri, 13 Sep 2013 06:28:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.169 with SMTP id d9ls1209493qeo.21.gmail; Fri, 13 Sep 2013 06:28:58 -0700 (PDT) X-Received: by 10.52.103.101 with SMTP id fv5mr1414024vdb.31.1379078938716; Fri, 13 Sep 2013 06:28:58 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id r3si3135240ven.31.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:28:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 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.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so939422veb.2 for ; Fri, 13 Sep 2013 06:28:58 -0700 (PDT) X-Received: by 10.220.46.72 with SMTP id i8mr12214141vcf.10.1379078938646; Fri, 13 Sep 2013 06:28:58 -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 u4csp80790vcz; Fri, 13 Sep 2013 06:28:58 -0700 (PDT) X-Received: by 10.68.59.38 with SMTP id w6mr12457073pbq.135.1379078937517; Fri, 13 Sep 2013 06:28:57 -0700 (PDT) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) by mx.google.com with ESMTPS id mj9si11278669pab.45.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:28:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.47 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.47; Received: by mail-pb0-f47.google.com with SMTP id rr4so1234231pbb.34 for ; Fri, 13 Sep 2013 06:28:57 -0700 (PDT) X-Received: by 10.68.60.226 with SMTP id k2mr13596747pbr.146.1379078937101; Fri, 13 Sep 2013 06:28:57 -0700 (PDT) Received: from localhost ([122.167.78.148]) by mx.google.com with ESMTPSA id cx4sm11776342pbc.24.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 13 Sep 2013 06:28:56 -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 Subject: [PATCH 218/228] cpufreq: dbx500: use cpufreq_generic_get() routine Date: Fri, 13 Sep 2013 18:32:44 +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.171 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,