From patchwork Mon Aug 12 17:48:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19018 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 171B2246B8 for ; Mon, 12 Aug 2013 17:50:32 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id hf12sf468086vcb.11 for ; Mon, 12 Aug 2013 10:50:31 -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=oxxl0ZIG8/p5jom+PVxGYVGoG/xAulLMhrQuuYjW/YI=; b=Y2bRt/bUW1uHcX+qh0qkM5w95L+24dENJiWhcjkAlKfMrMbtlB/HJb5X1zYclu3ldU 86ry9z6CtkhA4Yfir2LzkPdMbj9tM4r6FwVV84PwTRx2QQbk/I/trwf6TF3cSlraNVrr Xz6Pwv0pHBcyJIY6vIKPuU7SBIXR+6px3WJTNeFxtrjchzWSEazbu113GEHfrK5AwxFF FoT1J6824owxq0koxv8XRbVicT47+oFxAKUQ4hIUh8Pgt0w18L7v/QBSS8WxU06Z0EXt c6DTrmabQiUDwYD8e9LCnJ68nkxNQz/pDUEy+yWCtYJktBZP61KHuXmOUzXyICw0HJE7 kbGQ== X-Received: by 10.236.54.135 with SMTP id i7mr70051yhc.33.1376329831583; Mon, 12 Aug 2013 10:50:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.30.164 with SMTP id t4ls1547150qeh.54.gmail; Mon, 12 Aug 2013 10:50:31 -0700 (PDT) X-Received: by 10.220.145.75 with SMTP id c11mr144485vcv.30.1376329831224; Mon, 12 Aug 2013 10:50:31 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id jf10si8579924vdb.128.2013.08.12.10.50.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:50:31 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.172 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.172; Received: by mail-vc0-f172.google.com with SMTP id m17so3072390vca.17 for ; Mon, 12 Aug 2013 10:50:31 -0700 (PDT) X-Gm-Message-State: ALoCoQkQ4FCUfq88G0u1rzUrMwxs6KWD248LtKxm+4mqZbcS6Ze1ImAZuiuxUyaUTSkhMI3Q9TGN X-Received: by 10.58.219.68 with SMTP id pm4mr147765vec.49.1376329831137; Mon, 12 Aug 2013 10:50:31 -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 u4csp108171vcz; Mon, 12 Aug 2013 10:50:30 -0700 (PDT) X-Received: by 10.68.60.132 with SMTP id h4mr217975pbr.177.1376329830294; Mon, 12 Aug 2013 10:50:30 -0700 (PDT) Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by mx.google.com with ESMTPS id vs7si22163364pbc.205.2013.08.12.10.50.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:50:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.48 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.48; Received: by mail-pa0-f48.google.com with SMTP id kp13so7792753pab.35 for ; Mon, 12 Aug 2013 10:50:29 -0700 (PDT) X-Received: by 10.66.189.98 with SMTP id gh2mr247779pac.60.1376329829910; Mon, 12 Aug 2013 10:50:29 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id fa5sm38631209pbb.3.2013.08.12.10.50.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 12 Aug 2013 10:50:29 -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 , Sekhar Nori Subject: [PATCH 08/31] cpufreq: davinci: Covert to light weight ->target() routine Date: Mon, 12 Aug 2013 23:18:44 +0530 Message-Id: <6ab130ddaaa25641dd980f73400ee9ec06aabc75.1376329128.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.172 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_old() to newly defined light weight .target() routine for this driver. CPUFreq core will call cpufreq_frequency_table_target() before calling this routine and will pass index to it. Cc: Sekhar Nori Signed-off-by: Viresh Kumar --- drivers/cpufreq/davinci-cpufreq.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c index abefa13..8d622e0 100644 --- a/drivers/cpufreq/davinci-cpufreq.c +++ b/drivers/cpufreq/davinci-cpufreq.c @@ -68,28 +68,18 @@ static unsigned int davinci_getspeed(unsigned int cpu) return clk_get_rate(cpufreq.armclk) / 1000; } -static int davinci_target(struct cpufreq_policy *policy, - unsigned int target_freq, unsigned int relation) +static int davinci_target(struct cpufreq_policy *policy, unsigned int idx) { int ret = 0; - unsigned int idx; struct cpufreq_freqs freqs; struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; struct clk *armclk = cpufreq.armclk; freqs.old = davinci_getspeed(0); - freqs.new = clk_round_rate(armclk, target_freq * 1000) / 1000; - - if (freqs.old == freqs.new) - return ret; + freqs.new = pdata->freq_table[idx].frequency; dev_dbg(cpufreq.dev, "transition: %u --> %u\n", freqs.old, freqs.new); - ret = cpufreq_frequency_table_target(policy, pdata->freq_table, - freqs.new, relation, &idx); - if (ret) - return -EINVAL; - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* if moving to higher frequency, up the voltage beforehand */ @@ -160,7 +150,7 @@ static int davinci_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver davinci_driver = { .flags = CPUFREQ_STICKY, .verify = davinci_verify_speed, - .target_old = davinci_target, + .target = davinci_target, .get = davinci_getspeed, .init = davinci_cpu_init, .exit = cpufreq_generic_exit,