From patchwork Fri Jan 21 14:01:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishwanath BS X-Patchwork-Id: 7 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:39:12 -0000 Delivered-To: patches@linaro.org Received: by 10.147.124.10 with SMTP id b10cs148469yan; Fri, 21 Jan 2011 05:57:45 -0800 (PST) Received: by 10.90.68.16 with SMTP id q16mr851236aga.10.1295618265193; Fri, 21 Jan 2011 05:57:45 -0800 (PST) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by mx.google.com with ESMTPS id i27si21523127anq.120.2011.01.21.05.57.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 21 Jan 2011 05:57:45 -0800 (PST) Received-SPF: pass (google.com: domain of vishwanath.bs@ti.com designates 192.94.94.41 as permitted sender) client-ip=192.94.94.41; Authentication-Results: mx.google.com; spf=pass (google.com: domain of vishwanath.bs@ti.com designates 192.94.94.41 as permitted sender) smtp.mail=vishwanath.bs@ti.com Received: from dbdp31.itg.ti.com ([172.24.170.98]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p0LDvfE6021821 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 21 Jan 2011 07:57:44 -0600 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p0LDvSPY010507; Fri, 21 Jan 2011 19:27:41 +0530 (IST) From: Vishwanath BS To: linux-omap@vger.kernel.org Cc: patches@linaro.org, Vishwanath BS , Santosh Shilimkar Subject: [PATCH 08/13] OMAP3: cpufreq driver changes for DVFS support Date: Fri, 21 Jan 2011 19:31:00 +0530 Message-Id: <1295618465-15234-9-git-send-email-vishwanath.bs@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1295618465-15234-1-git-send-email-vishwanath.bs@ti.com> References: <1295618465-15234-1-git-send-email-vishwanath.bs@ti.com> Changes in the omap cpufreq driver for DVFS support. Signed-off-by: Vishwanath BS Cc: Santosh Shilimkar --- arch/arm/plat-omap/cpu-omap.c | 35 ++++++++++++++++++++++++++++++++--- 1 files changed, 32 insertions(+), 3 deletions(-) diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c index 1c1b80b..d965220 100644 --- a/arch/arm/plat-omap/cpu-omap.c +++ b/arch/arm/plat-omap/cpu-omap.c @@ -30,10 +30,12 @@ #include #include #include +#include #if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE) #include #include +#include #endif #define VERY_HI_RATE 900000000 @@ -85,11 +87,11 @@ static int omap_target(struct cpufreq_policy *policy, unsigned int target_freq, unsigned int relation) { -#ifdef CONFIG_ARCH_OMAP1 struct cpufreq_freqs freqs; -#endif #if defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE) unsigned long freq; + int i; + struct cpufreq_freqs freqs_notify; struct device *mpu_dev = omap2_get_mpuss_device(); #endif int ret = 0; @@ -116,9 +118,36 @@ static int omap_target(struct cpufreq_policy *policy, ret = clk_set_rate(mpu_clk, freqs.new * 1000); cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); #elif defined(CONFIG_ARCH_OMAP3) && !defined(CONFIG_OMAP_PM_NONE) + freqs.old = omap_getspeed(policy->cpu);; + freqs_notify.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000; + freqs.cpu = policy->cpu; + + if (freqs.old == freqs.new) + return ret; + + /* pre notifiers */ + for_each_cpu(i, policy->cpus) { + freqs.cpu = i; + cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + } + + /* scale the frequency */ freq = target_freq * 1000; if (opp_find_freq_ceil(mpu_dev, &freq)) - omap_pm_cpu_set_freq(freq); + omap_device_scale(mpu_dev, mpu_dev, freq); + + /* Update loops per jiffy */ + freqs.new = omap_getspeed(policy->cpu); + for_each_cpu(i, policy->cpus) + per_cpu(cpu_data, i).loops_per_jiffy = + cpufreq_scale(per_cpu(cpu_data, i).loops_per_jiffy, + freqs.old, freqs.new); + + /* post notifiers */ + for_each_cpu(i, policy->cpus) { + freqs.cpu = i; + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); + } #endif return ret; }