From patchwork Wed Oct 30 22:52:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21278 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 02203244A6 for ; Wed, 30 Oct 2013 22:52:21 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id n12sf6223773oag.0 for ; Wed, 30 Oct 2013 15:52:21 -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=FUv1eu9tgX+qyJoFOlVcSAEjNTOi+LYb49Ad1he5JdE=; b=X4zOo5Z62swMd1lffNOtbhcdnpbwSkUKS4ghn74QHicW9schycUnHXqU+cy9Gd11jK p/2vqkFb7WlR4AmpCEJiKDllD6jocTDQw0JY5TuW03YIn8vI3Dr4gGQzWKvaac437i3j aR/moRPqfgTYo6Mni9fdP2iCXEw4xFP8Pwgr+X67uAewFABuh61QcDtQOCK0GS0t05XF YC8uD5mLj4rEmAMPbtt0wT1V5x0YTXvgxeoG5az0PeRkZ/SxWI+bD7lHWF+GV+lMhK0G +HuZCe9803AQS/2o0xZywEVv0Ls5G/p2sHjDvaDEEP+vIwKG83rGVW+O7BTB5gTBFAm1 nBJA== X-Gm-Message-State: ALoCoQnXj8RYdK4xdmeV1cWnbZExocWQAk6EkZsBvgAr2k9OBPXQ63dwK8u2P1ZjlDCFlXOCcQ7H X-Received: by 10.50.85.109 with SMTP id g13mr83297igz.1.1383173541672; Wed, 30 Oct 2013 15:52:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.51.40 with SMTP id h8ls752029qeo.28.gmail; Wed, 30 Oct 2013 15:52:21 -0700 (PDT) X-Received: by 10.58.44.166 with SMTP id f6mr39439vem.76.1383173541543; Wed, 30 Oct 2013 15:52:21 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id pu5si69522veb.135.2013.10.30.15.52.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id ld13so1421227vcb.33 for ; Wed, 30 Oct 2013 15:52:21 -0700 (PDT) X-Received: by 10.58.188.42 with SMTP id fx10mr16106vec.51.1383173541445; Wed, 30 Oct 2013 15:52:21 -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 u4csp316041vcz; Wed, 30 Oct 2013 15:52:21 -0700 (PDT) X-Received: by 10.182.96.100 with SMTP id dr4mr127821obb.22.1383173540489; Wed, 30 Oct 2013 15:52:20 -0700 (PDT) Received: from mail-oa0-f45.google.com (mail-oa0-f45.google.com [209.85.219.45]) by mx.google.com with ESMTPS id u6si118732obi.93.2013.10.30.15.52.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.219.45 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.219.45; Received: by mail-oa0-f45.google.com with SMTP id i4so2242142oah.18 for ; Wed, 30 Oct 2013 15:52:20 -0700 (PDT) X-Received: by 10.60.130.163 with SMTP id of3mr75672oeb.96.1383173540174; Wed, 30 Oct 2013 15:52:20 -0700 (PDT) Received: from localhost (sccc-66-78-236-243.smartcity.com. [66.78.236.243]) by mx.google.com with ESMTPSA id z5sm576346obg.13.2013.10.30.15.52.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:19 -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 02/16] cpufreq: at32ap: use cpufreq_generic_get() routine Date: Thu, 31 Oct 2013 04:22:00 +0530 Message-Id: <5f0068423d041bcdd6e64de8d1481a501873f9a9.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.220.174 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. Acked-by: Hans-Christian Egtvedt Signed-off-by: Viresh Kumar --- 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, };