From patchwork Fri Aug 23 15:50:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19479 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 68CA5248E6 for ; Fri, 23 Aug 2013 15:52:19 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf600236vbg.11 for ; Fri, 23 Aug 2013 08:52:19 -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=ujv+OYAywlMj+LoEX9bT0qr0QkmfMnEKmRxo/2/MKMg=; b=CumIA4WyhKJRbFgNm9ezfZCkQNLNEeQdXctOPttbomBL/fSGtoR7LA3qRSBD6WaYoc cWbI25WgGt2vBJ1nqnmlQCmKxlGKEmhuqJ4zIyr7d/PNBtOEgzIC7fgxXomvFgKfp137 dOo8txkor49prUAWagGkHSPbq7oQQwGfnNjoCL5rHr3d8bq3JQPpAlxb3OIkHTeBFUYe 2uWueK810Bv+aHdWCp+oGOl3RssJv4+QhE6vmF7uGMIaDngzgh4DWWbvJSDqyT3+/BIu tc4A7XWdB0JcYH9auAN/IUgLQtP4kakg+VZwxsS6l+yguDMY/p6lJHK7aMaaQZZJnv+D pqkg== X-Received: by 10.236.116.135 with SMTP id g7mr80562yhh.53.1377273139233; Fri, 23 Aug 2013 08:52:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.71.231 with SMTP id y7ls1617876qeu.39.gmail; Fri, 23 Aug 2013 08:52:19 -0700 (PDT) X-Received: by 10.220.103.84 with SMTP id j20mr101332vco.76.1377273139152; Fri, 23 Aug 2013 08:52:19 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id xe6si141308vdb.9.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:52:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.175 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.175; Received: by mail-ve0-f175.google.com with SMTP id oy10so550256veb.20 for ; Fri, 23 Aug 2013 08:52:19 -0700 (PDT) X-Gm-Message-State: ALoCoQnKKbod7V8zCQu64yJWbfWc2S+8J8Ttfuo/HjjhF+0FcWgmnHObdRo8dqiZgJL6azpYUk+J X-Received: by 10.52.0.238 with SMTP id 14mr138112vdh.3.1377273139059; Fri, 23 Aug 2013 08:52:19 -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 u4csp100631vcz; Fri, 23 Aug 2013 08:52:18 -0700 (PDT) X-Received: by 10.68.225.164 with SMTP id rl4mr396055pbc.100.1377273138130; Fri, 23 Aug 2013 08:52:18 -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 co1si238868pbc.138.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:52:18 -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 fb10so826460pad.23 for ; Fri, 23 Aug 2013 08:52:17 -0700 (PDT) X-Received: by 10.66.228.234 with SMTP id sl10mr11954645pac.149.1377273137580; Fri, 23 Aug 2013 08:52:17 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id zi1sm520477pbb.28.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Aug 2013 08:52:16 -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 , Hans-Christian Egtvedt Subject: [PATCH 03/16] cpufreq: at32ap: use cpufreq_generic_get() routine Date: Fri, 23 Aug 2013 21:20:38 +0530 Message-Id: <25c1ed14adc7fff2b2fbac993c829997fc7eea12.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.175 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. Cc: Hans-Christian Egtvedt Signed-off-by: Viresh Kumar Acked-by: Hans-Christian Egtvedt --- drivers/cpufreq/at32ap-cpufreq.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/at32ap-cpufreq.c b/drivers/cpufreq/at32ap-cpufreq.c index 856ad80..869c0b5 100644 --- a/drivers/cpufreq/at32ap-cpufreq.c +++ b/drivers/cpufreq/at32ap-cpufreq.c @@ -21,17 +21,8 @@ #include #include -static struct clk *cpuclk; static struct cpufreq_frequency_table *freq_table; -static unsigned int at32_get_speed(unsigned int cpu) -{ - /* No SMP support */ - if (cpu) - return 0; - return (unsigned int)((clk_get_rate(cpuclk) + 500) / 1000); -} - static unsigned int ref_freq; static unsigned long loops_per_jiffy_ref; @@ -39,7 +30,7 @@ static int at32_set_target(struct cpufreq_policy *policy, unsigned int index) { unsigned int old_freq, new_freq; - old_freq = at32_get_speed(0); + old_freq = policy->cur; new_freq = freq_table[index].frequency; if (!ref_freq) { @@ -50,7 +41,7 @@ static int at32_set_target(struct cpufreq_policy *policy, unsigned int index) if (old_freq < new_freq) boot_cpu_data.loops_per_jiffy = cpufreq_scale( loops_per_jiffy_ref, ref_freq, new_freq); - clk_set_rate(cpuclk, new_freq * 1000); + clk_set_rate(policy->clk, new_freq * 1000); if (new_freq < old_freq) boot_cpu_data.loops_per_jiffy = cpufreq_scale( loops_per_jiffy_ref, ref_freq, new_freq); @@ -61,6 +52,7 @@ static int at32_set_target(struct cpufreq_policy *policy, unsigned int index) static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) { unsigned int frequency, rate, min_freq; + static struct clk *cpuclk; int retval, steps, i; if (policy->cpu != 0) @@ -103,6 +95,7 @@ static int __init at32_cpufreq_driver_init(struct cpufreq_policy *policy) frequency /= 2; } + policy->clk = cpuclk; freq_table[steps - 1].frequency = CPUFREQ_TABLE_END; retval = cpufreq_table_validate_and_show(policy, freq_table); @@ -123,7 +116,7 @@ static struct cpufreq_driver at32_driver = { .init = at32_cpufreq_driver_init, .verify = cpufreq_generic_frequency_table_verify, .target_index = at32_set_target, - .get = at32_get_speed, + .get = cpufreq_generic_get, .flags = CPUFREQ_STICKY, };