From patchwork Wed Sep 2 11:22:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 45173 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n82BNSSA006151 for ; Wed, 2 Sep 2009 11:23:29 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n82BNN8Z020219 for ; Wed, 2 Sep 2009 06:23:28 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n82BNNuw006989 for ; Wed, 2 Sep 2009 06:23:23 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 09FBC80803 for ; Wed, 2 Sep 2009 06:23:00 -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 4A96580627 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 n82BMdNt004375; 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 n82BMd6M008761; 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 n82BMdcW008758; 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:38 +0530 Message-Id: <1251890559-8388-3-git-send-email-nsekhar@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1251890559-8388-2-git-send-email-nsekhar@ti.com> References: <1251890559-8388-1-git-send-email-nsekhar@ti.com> <1251890559-8388-2-git-send-email-nsekhar@ti.com> Cc: Subject: [PATCH 3/4] davinci: DA850/OMAP-L138: 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+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@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 0b99bcf..abd46ce 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) \ @@ -962,6 +971,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; + } + + davinci_soc_info.set_new_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),