From patchwork Fri Aug 23 15:50:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19489 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 777F9248E6 for ; Fri, 23 Aug 2013 15:54:42 +0000 (UTC) Received: by mail-vb0-f71.google.com with SMTP id g17sf597915vbg.6 for ; Fri, 23 Aug 2013 08:54:42 -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=v/U2K4IMj2B03J7z7Ij8tH6L23MNDdAH5emdtgd/py8=; b=pu/D7S8dzgd71mT+V/YpVcDyDfKMehCZ5F82DqJ9sZZbM+ytdozF9g5eLOlnspdr4E LWP2zUAV4e5G8ZhkGQfvrVhBizWhRV+KVS7Tqy7JTpchtt8lDeefZDeeHVMT54VITun0 CXo7OOtPllyZl65mrGAuTSsMK6yQBgvHke43lG0B1YaCJ+1/gYfkF1sGpS0Dizb12vmt 65yqKXgugWqjBh1daFfjPrcFfMpdMNMMj5JzyKOF8QkegY2kva7OIxpZDiKcRw3YHwFa 4rNMNUbN8rMChS9Dk4b4NZesuB81GDFKvUWosN9ToybfMU5loBaYkkvFnefp0wWoQs/o c7YQ== X-Received: by 10.236.189.37 with SMTP id b25mr90145yhn.48.1377273282245; Fri, 23 Aug 2013 08:54:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.1.12 with SMTP id 12ls1611176qei.92.gmail; Fri, 23 Aug 2013 08:54:42 -0700 (PDT) X-Received: by 10.221.40.10 with SMTP id to10mr154648vcb.22.1377273282161; Fri, 23 Aug 2013 08:54:42 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id gq10si114420vdc.147.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:54:42 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.172 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.172; Received: by mail-ve0-f172.google.com with SMTP id oz10so566366veb.17 for ; Fri, 23 Aug 2013 08:54:42 -0700 (PDT) X-Gm-Message-State: ALoCoQm4kaiN+r7BvyysmoHKs8nUrid6vDBWcMXZlPI+LCneT/GRAPXatv7qXPuj3T9wuolpIHgo X-Received: by 10.58.198.13 with SMTP id iy13mr165228vec.11.1377273282057; Fri, 23 Aug 2013 08:54:42 -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 u4csp100767vcz; Fri, 23 Aug 2013 08:54:41 -0700 (PDT) X-Received: by 10.66.251.1 with SMTP id zg1mr11561513pac.160.1377273281111; Fri, 23 Aug 2013 08:54:41 -0700 (PDT) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id mp5si204887pbc.333.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:54:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.46 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id fa1so831548pad.19 for ; Fri, 23 Aug 2013 08:54:40 -0700 (PDT) X-Received: by 10.68.227.4 with SMTP id rw4mr292392pbc.182.1377273278466; Fri, 23 Aug 2013 08:54:38 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id ys4sm563808pbb.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:54:37 -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 , Kukjin Kim Subject: [PATCH 13/16] cpufreq: s5pv210: use cpufreq_generic_get() routine Date: Fri, 23 Aug 2013 21:20:48 +0530 Message-Id: <221200ddbecf6044b3dc4044d9422b39ad713f9a.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.128.172 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 need a global variable to hold clock anymore. Cc: Kukjin Kim Signed-off-by: Viresh Kumar --- drivers/cpufreq/s5pv210-cpufreq.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c index e3973da..da0e291 100644 --- a/drivers/cpufreq/s5pv210-cpufreq.c +++ b/drivers/cpufreq/s5pv210-cpufreq.c @@ -23,7 +23,6 @@ #include #include -static struct clk *cpu_clk; static struct clk *dmc0_clk; static struct clk *dmc1_clk; static DEFINE_MUTEX(set_freq_lock); @@ -164,14 +163,6 @@ static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq) __raw_writel(tmp1, reg); } -static unsigned int s5pv210_getspeed(unsigned int cpu) -{ - if (cpu) - return 0; - - return clk_get_rate(cpu_clk) / 1000; -} - static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index) { unsigned long reg; @@ -193,7 +184,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index) goto exit; } - old_freq = s5pv210_getspeed(0); + old_freq = policy->cur; new_freq = s5pv210_freq_table[index].frequency; /* Finding current running level index */ @@ -471,9 +462,9 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy) unsigned long mem_type; int ret; - cpu_clk = clk_get(NULL, "armclk"); - if (IS_ERR(cpu_clk)) - return PTR_ERR(cpu_clk); + policy->clk = clk_get(NULL, "armclk"); + if (IS_ERR(policy->clk)) + return PTR_ERR(policy->clk); dmc0_clk = clk_get(NULL, "sclk_dmc0"); if (IS_ERR(dmc0_clk)) { @@ -516,7 +507,7 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy) out_dmc1: clk_put(dmc0_clk); out_dmc0: - clk_put(cpu_clk); + clk_put(policy->clk); return ret; } @@ -563,7 +554,7 @@ static struct cpufreq_driver s5pv210_driver = { .flags = CPUFREQ_STICKY, .verify = cpufreq_generic_frequency_table_verify, .target_index = s5pv210_target, - .get = s5pv210_getspeed, + .get = cpufreq_generic_get, .init = s5pv210_cpu_init, .name = "s5pv210", #ifdef CONFIG_PM