From patchwork Fri Oct 16 19:09:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 54393 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 n9GJL0pC013306 for ; Fri, 16 Oct 2009 19:21:00 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9GJIuQt031474 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 16 Oct 2009 14:18:56 -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 n9GJItxY024072; Fri, 16 Oct 2009 14:18:55 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 046E380814; Fri, 16 Oct 2009 14:17:15 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 3A83580640 for ; Fri, 16 Oct 2009 14:13:18 -0500 (CDT) Received: from red.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id n9GJDGne014153 for ; Fri, 16 Oct 2009 14:13:16 -0500 (CDT) Received: from mail183-va3-R.bigfish.com (mail-va3.bigfish.com [216.32.180.114]) by red.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9GJDFJ3003378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 16 Oct 2009 14:13:15 -0500 Received: from mail183-va3 (localhost.localdomain [127.0.0.1]) by mail183-va3-R.bigfish.com (Postfix) with ESMTP id 2F5883106DD for ; Fri, 16 Oct 2009 19:13:11 +0000 (UTC) X-SpamScore: 7 X-BigFish: vps7(zza4b1ozz1202hzzz2dh6bh61h) X-Spam-TCS-SCL: 0:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 209.85.219.220; Service: EHS Received: by mail183-va3 (MessageSwitch) id 1255720388982671_7552; Fri, 16 Oct 2009 19:13:08 +0000 (UCT) Received: from VA3EHSMHS015.bigfish.com (unknown [10.7.14.249]) by mail183-va3.bigfish.com (Postfix) with ESMTP id E05CB4C0050 for ; Fri, 16 Oct 2009 19:13:08 +0000 (UTC) Received: from mail-ew0-f220.google.com (209.85.219.220) by VA3EHSMHS015.bigfish.com (10.7.99.25) with Microsoft SMTP Server id 14.0.482.32; Fri, 16 Oct 2009 19:13:08 +0000 Received: by mail-ew0-f220.google.com with SMTP id 20so2500484ewy.40 for ; Fri, 16 Oct 2009 12:13:07 -0700 (PDT) Received: by 10.216.86.203 with SMTP id w53mr682619wee.58.1255720387513; Fri, 16 Oct 2009 12:13:07 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id x6sm3125496gvf.1.2009.10.16.12.13.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Oct 2009 12:13:06 -0700 (PDT) From: Kevin Hilman To: linux-arm-kernel@lists.infradead.org Date: Fri, 16 Oct 2009 12:09:39 -0700 Message-ID: <1255720190-7452-37-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.4.3 In-Reply-To: <1255720190-7452-36-git-send-email-khilman@deeprootsystems.com> References: <1255720190-7452-1-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-2-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-3-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-4-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-5-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-6-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-7-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-8-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-9-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-10-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-11-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-12-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-13-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-14-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-15-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-16-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-17-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-18-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-19-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-20-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-21-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-22-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-23-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-24-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-25-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-26-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-27-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-28-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-29-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-30-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-31-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-32-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-33-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-34-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-35-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-36-git-send-email-khilman@deeprootsystems.com> MIME-Version: 1.0 X-Reverse-DNS: mail-ew0-f220.google.com Cc: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 35/46] 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 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),