From patchwork Wed Oct 30 22:52:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21291 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DA19E244A4 for ; Wed, 30 Oct 2013 22:52:44 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wp18sf6237299obc.9 for ; Wed, 30 Oct 2013 15:52:44 -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=ZeWREtmB1vF5cjo4y9Es6SuqP39+wHQCS5Awy6Fzt3A=; b=IK7qXZE/FN0lYzBm3zxtLQcYs9MRzfXNyUkv+RXvukXVvPcc4wKScEddCiqgEXUvVl UOBXQWgPzuDlCP+BnKKGNP1ooYa85/ebd0QAjNQ4FlKSFSjDIVuTaZMB0VMqCf9AlkGO d4/6wkYiKfZ11j5OlL0TrK0eyyVciCJcSkzw9E5ZeLNKMXnW7N4N6qlMu46/MF8ogyLa sr1ijSVNsFlNrJSHvSvHyiMSwObppRG3CM9jqEH8uISk99QIS73jKw1RG7NpNDwEJZzF beroQEbVYK4viD1ji1v6hrof0rb9BgKSPt5gY4DDCoU5vqTn1/uMNV9BvxIrZ/uS6lHU K5CA== X-Gm-Message-State: ALoCoQnLyyPDNrC/qVkpPoAPChZlJL2DKDQ2gCYi/A++FF8uGy4K9BfMzEj+XWguMZgmwtD4VSk2 X-Received: by 10.182.116.200 with SMTP id jy8mr72846obb.22.1383173564515; Wed, 30 Oct 2013 15:52:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.198 with SMTP id j6ls685468qez.6.gmail; Wed, 30 Oct 2013 15:52:44 -0700 (PDT) X-Received: by 10.58.75.164 with SMTP id d4mr16110vew.53.1383173564384; Wed, 30 Oct 2013 15:52:44 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id o7si70247vcl.135.2013.10.30.15.52.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id jw12so1535575veb.32 for ; Wed, 30 Oct 2013 15:52:44 -0700 (PDT) X-Received: by 10.58.181.230 with SMTP id dz6mr21604vec.35.1383173564307; Wed, 30 Oct 2013 15:52:44 -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 u4csp316065vcz; Wed, 30 Oct 2013 15:52:43 -0700 (PDT) X-Received: by 10.182.53.138 with SMTP id b10mr99052obp.66.1383173563713; Wed, 30 Oct 2013 15:52:43 -0700 (PDT) Received: from mail-oa0-f46.google.com (mail-oa0-f46.google.com [209.85.219.46]) by mx.google.com with ESMTPS id h3si106550oej.143.2013.10.30.15.52.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.219.46 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.219.46; Received: by mail-oa0-f46.google.com with SMTP id g12so2224038oah.19 for ; Wed, 30 Oct 2013 15:52:43 -0700 (PDT) X-Received: by 10.60.155.166 with SMTP id vx6mr125148oeb.28.1383173563482; Wed, 30 Oct 2013 15:52:43 -0700 (PDT) Received: from localhost (sccc-66-78-236-243.smartcity.com. [66.78.236.243]) by mx.google.com with ESMTPSA id rr6sm787752oeb.0.2013.10.30.15.52.42 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Oct 2013 15:52:43 -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 15/16] cpufreq: tegra: use cpufreq_generic_get() routine Date: Thu, 31 Oct 2013 04:22:13 +0530 Message-Id: <9d3de82b097a5d05a1ca5cff4e23399e28fbcfff.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.173 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: Stephen Warren Signed-off-by: Viresh Kumar --- drivers/cpufreq/tegra-cpufreq.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/tegra-cpufreq.c b/drivers/cpufreq/tegra-cpufreq.c index 7d36b54..360d1a7 100644 --- a/drivers/cpufreq/tegra-cpufreq.c +++ b/drivers/cpufreq/tegra-cpufreq.c @@ -50,17 +50,6 @@ static struct clk *emc_clk; static DEFINE_MUTEX(tegra_cpu_lock); static bool is_suspended; -static unsigned int tegra_getspeed(unsigned int cpu) -{ - unsigned long rate; - - if (cpu >= NUM_CPUS) - return 0; - - rate = clk_get_rate(cpu_clk) / 1000; - return rate; -} - static int tegra_cpu_clk_set_rate(unsigned long rate) { int ret; @@ -144,7 +133,7 @@ static int tegra_pm_notify(struct notifier_block *nb, unsigned long event, is_suspended = true; pr_info("Tegra cpufreq suspend: setting frequency to %d kHz\n", freq_table[0].frequency); - if (tegra_getspeed(0) != freq_table[0].frequency) + if (clk_get_rate(cpu_clk) / 1000 != freq_table[0].frequency) tegra_update_cpu_speed(policy, freq_table[0].frequency); cpufreq_cpu_put(policy); } else if (event == PM_POST_SUSPEND) { @@ -180,6 +169,7 @@ static int tegra_cpu_init(struct cpufreq_policy *policy) if (policy->cpu == 0) register_pm_notifier(&tegra_cpu_pm_notifier); + policy->clk = cpu_clk; return 0; } @@ -194,7 +184,7 @@ static int tegra_cpu_exit(struct cpufreq_policy *policy) static struct cpufreq_driver tegra_cpufreq_driver = { .verify = cpufreq_generic_frequency_table_verify, .target_index = tegra_target, - .get = tegra_getspeed, + .get = cpufreq_generic_get, .init = tegra_cpu_init, .exit = tegra_cpu_exit, .name = "tegra",