From patchwork Wed Sep 2 11:22:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 45176 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n82BP98l006402 for ; Wed, 2 Sep 2009 11:25:09 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id n82BNZSK027076; Wed, 2 Sep 2009 06:23:40 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n82BNYvH004008; Wed, 2 Sep 2009 06:23:34 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id B266880638; Wed, 2 Sep 2009 06:23:05 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp31.itg.ti.com (dbdp31.itg.ti.com [172.24.170.98]) by linux.omap.com (Postfix) with ESMTP id 4F67C80628 for ; Wed, 2 Sep 2009 06:22:41 -0500 (CDT) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id n82BMdDr004374; Wed, 2 Sep 2009 16:52:39 +0530 (IST) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by psplinux051.india.ti.com (8.13.1/8.13.1) with ESMTP id n82BMd54008755; Wed, 2 Sep 2009 16:52:39 +0530 Received: (from a0875516@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id n82BMdBu008752; Wed, 2 Sep 2009 16:52:39 +0530 From: Sekhar Nori To: davinci-linux-open-source@linux.davincidsp.com Date: Wed, 2 Sep 2009 16:52:37 +0530 Message-Id: <1251890559-8388-2-git-send-email-nsekhar@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1251890559-8388-1-git-send-email-nsekhar@ti.com> References: <1251890559-8388-1-git-send-email-nsekhar@ti.com> Cc: Subject: [PATCH 2/4] davinci: cpufreq: add support for voltage regulation X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com This patch adds a new function to the davinci_soc_info structure which controls voltage level (typically CVDD). The new set_new_voltage call will be implemented by platform code supporting voltage change. Signed-off-by: Sekhar Nori --- arch/arm/mach-davinci/cpufreq.c | 8 ++++++++ arch/arm/mach-davinci/include/mach/common.h | 1 + 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c index af60d3d..8cb0c85 100644 --- a/arch/arm/mach-davinci/cpufreq.c +++ b/arch/arm/mach-davinci/cpufreq.c @@ -102,8 +102,16 @@ static int davinci_target(struct cpufreq_policy *policy, cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); + /* if moving to higher frequency, up the voltage beforehand */ + if (davinci_soc_info.set_new_voltage && freqs.new > freqs.old) + davinci_soc_info.set_new_voltage(idx); + ret = clk_set_rate(armclk, idx); + /* if moving to lower freq, lower the voltage after lowering freq */ + if (davinci_soc_info.set_new_voltage && freqs.new < freqs.old) + davinci_soc_info.set_new_voltage(idx); + cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); return ret; diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h index 1487a57..49d08aa 100644 --- a/arch/arm/mach-davinci/include/mach/common.h +++ b/arch/arm/mach-davinci/include/mach/common.h @@ -71,6 +71,7 @@ struct davinci_soc_info { dma_addr_t sram_dma; unsigned sram_len; void (*init_cpufreq_table) (struct cpufreq_frequency_table **); + int (*set_new_voltage) (unsigned int index); }; extern struct davinci_soc_info davinci_soc_info;