From patchwork Fri Oct 18 13:59:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21143 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B0393202FF for ; Fri, 18 Oct 2013 14:01:46 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id l4sf5705646ggi.0 for ; Fri, 18 Oct 2013 07:01:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; 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=LKj9Ao9bXXUm46lZD8tYpUmSoIyQ+VQ+9GLsnvK5Imw=; b=J3vYO8izfkM1tKGKKuZXnCVtXCukG+ChQ5Tb2yeT57I0RERMo9N3lzkm/ZhfabOxPh Gk6Ws5snwR+LP6Nb8fvty/5BhumIRhJbVQh2J65LDdKgvrAko9hrTcFnGlHxsdVVP8Le HOGuxyu0HQXtmuPp0Lkdo6Lo1rrs1F+uLhBs0O/H9ubZXHA4iQXTCyPC8NhZzaXPOXhZ JCKAalY8Fl479bxPZCDkMqYjEjb8953+2TrJ7WPGF6b7iB2SJTRKHiP7ErkTCErHVt4P GP4bsu1BZa8TNwk3UvQEr6Mz6RT41Mj4YDQ8ldjOj8XhhKj00LInv2qRW0Rgqx6k5HMh aXeA== X-Received: by 10.58.198.116 with SMTP id jb20mr1126951vec.4.1382104906476; Fri, 18 Oct 2013 07:01:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.111 with SMTP id g15ls1294029qej.21.gmail; Fri, 18 Oct 2013 07:01:46 -0700 (PDT) X-Received: by 10.220.1.203 with SMTP id 11mr2189331vcg.15.1382104906370; Fri, 18 Oct 2013 07:01:46 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id s4si325670vcy.136.2013.10.18.07.01.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:01:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 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.182; Received: by mail-vc0-f182.google.com with SMTP id im17so447055vcb.13 for ; Fri, 18 Oct 2013 07:01:46 -0700 (PDT) X-Gm-Message-State: ALoCoQmlbN/Y7g92d+gln2hRajCMBPo7nZHCiXYmkLgXN0Yy9fbE2NdgbqPqbHR/yGQsnRxOKao8 X-Received: by 10.52.33.44 with SMTP id o12mr1858368vdi.7.1382104906271; Fri, 18 Oct 2013 07:01:46 -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 u4csp37980vcz; Fri, 18 Oct 2013 07:01:45 -0700 (PDT) X-Received: by 10.68.59.38 with SMTP id w6mr3142882pbq.135.1382104905345; Fri, 18 Oct 2013 07:01:45 -0700 (PDT) Received: from mail-pd0-f171.google.com (mail-pd0-f171.google.com [209.85.192.171]) by mx.google.com with ESMTPS id zl9si1005680pbc.84.2013.10.18.07.01.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:01:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.171 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.171; Received: by mail-pd0-f171.google.com with SMTP id z10so4712220pdj.16 for ; Fri, 18 Oct 2013 07:01:45 -0700 (PDT) X-Received: by 10.66.26.236 with SMTP id o12mr3537828pag.136.1382104904924; Fri, 18 Oct 2013 07:01:44 -0700 (PDT) Received: from localhost ([120.56.197.189]) by mx.google.com with ESMTPSA id ta10sm4638921pab.5.2013.10.18.07.01.40 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 18 Oct 2013 07:01:44 -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 , Kukjin Kim Subject: [PATCH V2 Resend 12/34] cpufreq: exynos: Convert to light weight ->target_index() routine Date: Fri, 18 Oct 2013 19:29:35 +0530 Message-Id: <78f38575b944c445a535bad32194d0fbca2996d3.1382104515.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.182 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: , This patch converts existing .target() to newly defined light weight .target_index() routine for this driver. CPUFreq core will call cpufreq_frequency_table_target() before calling this routine and will pass index to it. Cc: Kukjin Kim Signed-off-by: Viresh Kumar --- drivers/cpufreq/exynos-cpufreq.c | 21 +++------------------ drivers/cpufreq/exynos5440-cpufreq.c | 21 +++++---------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c index 3e4af67..9982fcb 100644 --- a/drivers/cpufreq/exynos-cpufreq.c +++ b/drivers/cpufreq/exynos-cpufreq.c @@ -65,9 +65,6 @@ static int exynos_cpufreq_scale(unsigned int target_freq) freqs.old = policy->cur; freqs.new = target_freq; - if (freqs.new == freqs.old) - goto out; - /* * The policy max have been changed so that we cannot get proper * old_index with cpufreq_frequency_table_target(). Thus, ignore @@ -151,13 +148,9 @@ out: return ret; } -static int exynos_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) +static int exynos_target(struct cpufreq_policy *policy, unsigned int index) { struct cpufreq_frequency_table *freq_table = exynos_info->freq_table; - unsigned int index; - unsigned int new_freq; int ret = 0; mutex_lock(&cpufreq_lock); @@ -165,15 +158,7 @@ static int exynos_target(struct cpufreq_policy *policy, if (frequency_locked) goto out; - if (cpufreq_frequency_table_target(policy, freq_table, - target_freq, relation, &index)) { - ret = -EINVAL; - goto out; - } - - new_freq = freq_table[index].frequency; - - ret = exynos_cpufreq_scale(new_freq); + ret = exynos_cpufreq_scale(freq_table[index].frequency); out: mutex_unlock(&cpufreq_lock); @@ -247,7 +232,7 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver exynos_driver = { .flags = CPUFREQ_STICKY, .verify = cpufreq_generic_frequency_table_verify, - .target = exynos_target, + .target_index = exynos_target, .get = exynos_getspeed, .init = exynos_cpufreq_cpu_init, .exit = cpufreq_generic_exit, diff --git a/drivers/cpufreq/exynos5440-cpufreq.c b/drivers/cpufreq/exynos5440-cpufreq.c index 8ae5e29..1bf9b06 100644 --- a/drivers/cpufreq/exynos5440-cpufreq.c +++ b/drivers/cpufreq/exynos5440-cpufreq.c @@ -214,27 +214,17 @@ static unsigned int exynos_getspeed(unsigned int cpu) return dvfs_info->cur_frequency; } -static int exynos_target(struct cpufreq_policy *policy, - unsigned int target_freq, - unsigned int relation) +static int exynos_target(struct cpufreq_policy *policy, unsigned int index) { - unsigned int index, tmp; - int ret = 0, i; + unsigned int tmp; + int i; struct cpufreq_frequency_table *freq_table = dvfs_info->freq_table; mutex_lock(&cpufreq_lock); - ret = cpufreq_frequency_table_target(policy, freq_table, - target_freq, relation, &index); - if (ret) - goto out; - freqs.old = dvfs_info->cur_frequency; freqs.new = freq_table[index].frequency; - if (freqs.old == freqs.new) - goto out; - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* Set the target frequency in all C0_3_PSTATE register */ @@ -245,9 +235,8 @@ static int exynos_target(struct cpufreq_policy *policy, __raw_writel(tmp, dvfs_info->base + XMU_C0_3_PSTATE + i * 4); } -out: mutex_unlock(&cpufreq_lock); - return ret; + return 0; } static void exynos_cpufreq_work(struct work_struct *work) @@ -325,7 +314,7 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver exynos_driver = { .flags = CPUFREQ_STICKY, .verify = cpufreq_generic_frequency_table_verify, - .target = exynos_target, + .target_index = exynos_target, .get = exynos_getspeed, .init = exynos_cpufreq_cpu_init, .exit = cpufreq_generic_exit,