From patchwork Tue Sep 22 15:44:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 49342 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 n8MFkoMJ011344 for ; Tue, 22 Sep 2009 15:46:50 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id n8MFjD99001302; Tue, 22 Sep 2009 10:45:13 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id n8MFjCrX013440; Tue, 22 Sep 2009 10:45:12 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 29C308086F; Tue, 22 Sep 2009 10:44:42 -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 03EA48062B for ; Tue, 22 Sep 2009 10:44:08 -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 n8MFi4en026781; Tue, 22 Sep 2009 21:14:05 +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 n8MFi49S024871; Tue, 22 Sep 2009 21:14:04 +0530 Received: (from a0875516@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id n8MFi4T9024868; Tue, 22 Sep 2009 21:14:04 +0530 From: Sekhar Nori To: davinci-linux-open-source@linux.davincidsp.com Date: Tue, 22 Sep 2009 21:14:02 +0530 Message-Id: <1253634244-24503-3-git-send-email-nsekhar@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1253634244-24503-2-git-send-email-nsekhar@ti.com> References: <1253634244-24503-1-git-send-email-nsekhar@ti.com> <1253634244-24503-2-git-send-email-nsekhar@ti.com> Cc: Subject: [PATCH v2 3/5] davinci: DA850/OMAP-L138: add voltage regulation support 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 support for regulating the CVDD voltage for the DA850/OMAP-L138 platform. The CVDD min and max values for each OPP have been obtained from section 5.2 "Recommended Operating Conditions" of SPRS586 Signed-off-by: Sekhar Nori --- arch/arm/mach-davinci/da850.c | 43 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 49dcc71..0e1027e 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -16,6 +16,7 @@ #include #include #include +#include #include @@ -844,6 +845,8 @@ struct da850_opp { unsigned int prediv; unsigned int mult; unsigned int postdiv; + unsigned int cvdd_min; /* in uV */ + unsigned int cvdd_max; /* in uV */ }; static const struct da850_opp da850_opp_300 = { @@ -851,6 +854,8 @@ static const struct da850_opp da850_opp_300 = { .prediv = 1, .mult = 25, .postdiv = 2, + .cvdd_min = 1140000, + .cvdd_max = 1320000, }; static const struct da850_opp da850_opp_200 = { @@ -858,6 +863,8 @@ static const struct da850_opp da850_opp_200 = { .prediv = 1, .mult = 25, .postdiv = 3, + .cvdd_min = 1050000, + .cvdd_max = 1160000, }; static const struct da850_opp da850_opp_96 = { @@ -865,6 +872,8 @@ static const struct da850_opp da850_opp_96 = { .prediv = 1, .mult = 20, .postdiv = 5, + .cvdd_min = 950000, + .cvdd_max = 1050000, }; #define OPP(freq) \ @@ -973,6 +982,40 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate) } #endif +#ifdef CONFIG_REGULATOR +static struct regulator *cvdd; + +static int da850_set_voltage(unsigned int index) +{ + struct da850_opp *opp; + + if (!cvdd) + return -ENODEV; + + opp = (struct da850_opp *) da850_freq_table[index].index; + + return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max); +} + +static int __init da850_regulator_init(void) +{ + int ret = 0; + + cvdd = regulator_get(NULL, "cvdd"); + if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;" + " voltage scaling unsupported\n")) { + ret = PTR_ERR(cvdd); + goto out; + } + + cpufreq_info.set_voltage = da850_set_voltage; + +out: + return ret; +} +device_initcall(da850_regulator_init); +#endif + static struct davinci_soc_info davinci_soc_info_da850 = { .io_desc = da850_io_desc, .io_desc_num = ARRAY_SIZE(da850_io_desc),