From patchwork Wed Oct 30 22:52:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21288 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 66599244A4 for ; Wed, 30 Oct 2013 22:52:40 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id m17sf6225433oag.11 for ; Wed, 30 Oct 2013 15:52:40 -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=v/U2K4IMj2B03J7z7Ij8tH6L23MNDdAH5emdtgd/py8=; b=kF0WLqZenVmDeI+jYuTRc4wx4uQlrN8pJBxfK+T196uQoPy9K1Arx53Koe8/2nWx+n ebbB5uPoGxRp0gKVHQ5sh98+mM2We06y8TawgFVt2gk9O8PzPDUgxT9kWTO1/hROlPP5 UkbMHUcKlj8fNGef15wl8/AM7ZVp6TW3S5vRJ4U/OPJynork/igqcWcCqUYADH+Hj3QK 4Tu/tFZrsaLe5ntqEjJ2+QXVnyCnohAPF/MMagnLJ7BEnidv9Pk7jsqi9Bf+cd+JhT3u IBiqqgq1PiburYAA/bSKrXlpHAZU/YgI/IMeXFyVuD6DmIwdEBijzNq67RMPkybXOy3Y 4vgQ== X-Gm-Message-State: ALoCoQkO5XzP1AnHtSTZIkLBolkjPykZS2Er1S61d51c9nWzDUe5eM9s8R7PimQytpWkxHswZ7eB X-Received: by 10.182.241.129 with SMTP id wi1mr82944obc.10.1383173560055; Wed, 30 Oct 2013 15:52:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.37 with SMTP id z5ls215376qen.49.gmail; Wed, 30 Oct 2013 15:52:39 -0700 (PDT) X-Received: by 10.58.11.201 with SMTP id s9mr4250veb.91.1383173559945; Wed, 30 Oct 2013 15:52:39 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id uw4si79084vec.77.2013.10.30.15.52.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:39 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.170 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.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so1512841veb.15 for ; Wed, 30 Oct 2013 15:52:39 -0700 (PDT) X-Received: by 10.58.188.42 with SMTP id fx10mr16388vec.51.1383173559868; Wed, 30 Oct 2013 15:52:39 -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 u4csp316061vcz; Wed, 30 Oct 2013 15:52:39 -0700 (PDT) X-Received: by 10.60.58.71 with SMTP id o7mr36329oeq.51.1383173559109; Wed, 30 Oct 2013 15:52:39 -0700 (PDT) Received: from mail-oa0-f41.google.com (mail-oa0-f41.google.com [209.85.219.41]) by mx.google.com with ESMTPS id w10si108797obo.134.2013.10.30.15.52.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:39 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.219.41 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.219.41; Received: by mail-oa0-f41.google.com with SMTP id o9so2271732oag.28 for ; Wed, 30 Oct 2013 15:52:38 -0700 (PDT) X-Received: by 10.60.94.164 with SMTP id dd4mr93147oeb.68.1383173558839; Wed, 30 Oct 2013 15:52:38 -0700 (PDT) Received: from localhost (sccc-66-78-236-243.smartcity.com. [66.78.236.243]) by mx.google.com with ESMTPSA id d8sm726925oeu.6.2013.10.30.15.52.38 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:38 -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 12/16] cpufreq: s5pv210: use cpufreq_generic_get() routine Date: Thu, 31 Oct 2013 04:22:10 +0530 Message-Id: <30a7fe7b07dad08b80f8b8d6df3dc5ffdeb906be.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.128.170 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