From patchwork Wed Aug 21 14:42:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19390 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 950B6248E6 for ; Wed, 21 Aug 2013 14:44:24 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf476194vbg.7 for ; Wed, 21 Aug 2013 07:44:24 -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=wVgcS/k7Q6QgETHWu2Q408/BTXQfbmLzyT04mxORqDI=; b=L6Dr5sCbAnCLVCK04u6AjydWYqT+Bum+Rbo1DvGRARwaHkjhMOLldf7+hQJCylI4lA Fh1YBWVwUfZ4Y5AsKo9mbMXgUlma+ru5941bqofRcOAi6O0Kz0f2nEc4flCk/YuOFli5 f/jN153rmXSXC/XraVJToceYpDcxX/ZaHbtNX0XDwBeZovWPV8NGUnX1RCEaguq3yihT QeX880EYRgDifatI9YTMfH2tZ19ycthuYSvvSpQW8UL+gRgicYdqhbzubas0cEBfHmL9 1RVivFNwKzU/CjqmdgmUpQ3cOHaxORqlltH/8oE1os2TOhHh2GDRwTyd0DA+dstmxYrz UT3A== X-Received: by 10.236.147.70 with SMTP id s46mr2863245yhj.0.1377096264390; Wed, 21 Aug 2013 07:44:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.105.225 with SMTP id gp1ls711898qeb.55.gmail; Wed, 21 Aug 2013 07:44:24 -0700 (PDT) X-Received: by 10.58.201.227 with SMTP id kd3mr6913989vec.14.1377096264285; Wed, 21 Aug 2013 07:44:24 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id gq10si2213680vdc.121.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 07:44:24 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 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.177; Received: by mail-vc0-f177.google.com with SMTP id gf12so317150vcb.22 for ; Wed, 21 Aug 2013 07:44:24 -0700 (PDT) X-Gm-Message-State: ALoCoQlsMap9fHxdJRDyOGhANuGQfAIiMhXF4VYF65gKKtzm8EJ/MqIWwD0B8Ifl885lAhla/BcS X-Received: by 10.58.108.8 with SMTP id hg8mr6747717veb.6.1377096264207; Wed, 21 Aug 2013 07:44:24 -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 u4csp224630vcz; Wed, 21 Aug 2013 07:44:23 -0700 (PDT) X-Received: by 10.66.179.143 with SMTP id dg15mr9871614pac.52.1377096263412; Wed, 21 Aug 2013 07:44:23 -0700 (PDT) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by mx.google.com with ESMTPS id zo6si6725373pac.54.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 Aug 2013 07:44:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.52 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.52; Received: by mail-pa0-f52.google.com with SMTP id kq13so893754pab.11 for ; Wed, 21 Aug 2013 07:44:23 -0700 (PDT) X-Received: by 10.68.132.67 with SMTP id os3mr40061pbb.188.1377096263049; Wed, 21 Aug 2013 07:44:23 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id x8sm8797357pbb.39.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 21 Aug 2013 07:44:22 -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 , Stephen Warren Subject: [PATCH 14/14] cpufreq: tegra: use cpufreq_generic_init() routine Date: Wed, 21 Aug 2013 20:12:33 +0530 Message-Id: <45979df742e182f28704d3a05b4d011aeae4ef3c.1377093938.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.177 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: , Use generic cpufreq_generic_init() routine instead of replicating the same code here. Along with that we are disabling clks in error cases and ->exit() routine. Cc: Stephen Warren Signed-off-by: Viresh Kumar --- drivers/cpufreq/tegra-cpufreq.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c index 3f25ab6..bc7c2a1 100644 --- a/drivers/cpufreq/tegra-cpufreq.c +++ b/drivers/cpufreq/tegra-cpufreq.c @@ -161,18 +161,21 @@ static struct notifier_block tegra_cpu_pm_notifier = { static int tegra_cpu_init(struct cpufreq_policy *policy) { + int ret; + if (policy->cpu >= NUM_CPUS) return -EINVAL; clk_prepare_enable(emc_clk); clk_prepare_enable(cpu_clk); - cpufreq_table_validate_and_show(policy, freq_table); - /* FIXME: what's the actual transition time? */ - policy->cpuinfo.transition_latency = 300 * 1000; - - cpumask_copy(policy->cpus, cpu_possible_mask); + ret = cpufreq_generic_init(policy, freq_table, 300 * 1000); + if (ret) { + clk_disable_unprepare(cpu_clk); + clk_disable_unprepare(emc_clk); + return ret; + } if (policy->cpu == 0) register_pm_notifier(&tegra_cpu_pm_notifier); @@ -183,6 +186,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy) static int tegra_cpu_exit(struct cpufreq_policy *policy) { cpufreq_frequency_table_put_attr(policy->cpu); + clk_disable_unprepare(cpu_clk); clk_disable_unprepare(emc_clk); return 0; }