From patchwork Thu Nov 19 11:24:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "G.N, Vijayakumar" X-Patchwork-Id: 61275 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAJBP89V004999 for ; Thu, 19 Nov 2009 11:25:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751369AbZKSLZB (ORCPT ); Thu, 19 Nov 2009 06:25:01 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751011AbZKSLZB (ORCPT ); Thu, 19 Nov 2009 06:25:01 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:59233 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750830AbZKSLZA convert rfc822-to-8bit (ORCPT ); Thu, 19 Nov 2009 06:25:00 -0500 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id nAJBP358001954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 19 Nov 2009 05:25:05 -0600 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id nAJBP2iQ003204; Thu, 19 Nov 2009 16:55:02 +0530 (IST) Received: from dbde02.ent.ti.com ([172.24.170.145]) by dbde70.ent.ti.com ([172.24.170.148]) with mapi; Thu, 19 Nov 2009 16:55:02 +0530 From: "G.N, Vijayakumar" To: "khilman@deeprootsystems.com" , "linux-omap@vger.kernel.org" Date: Thu, 19 Nov 2009 16:54:27 +0530 Subject: [PATCH 1/3] omap3: pm: removes hardcoded VDD1/2 OPP values and make threshold generic Thread-Topic: [PATCH 1/3] omap3: pm: removes hardcoded VDD1/2 OPP values and make threshold generic Thread-Index: AcpiJScoehTmBzjdTlSovq1LrOQUJwG3tlSgAAGrD6A= Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index da5bc1f..9cfc7a0 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c @@ -1042,7 +1042,7 @@ static unsigned long omap3_clkoutx2_recalc(struct clk *clk) #if defined(CONFIG_ARCH_OMAP3) #ifdef CONFIG_CPU_FREQ -static struct cpufreq_frequency_table freq_table[MAX_VDD1_OPP+1]; +static struct cpufreq_frequency_table freq_table[MAX_VDD1_OPPS+1]; void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table) { diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index b324315..ba018f8 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c @@ -14,6 +14,7 @@ #include #include +#include #include "pm.h" @@ -92,13 +93,13 @@ static ssize_t vdd_opp_store(struct kobject *kobj, struct kobj_attribute *attr, } if (attr == &vdd1_opp_attr) { - if (value < 1 || value > 5) { + if (value < MIN_VDD1_OPP || value > MAX_VDD1_OPP) { printk(KERN_ERR "vdd_opp_store: Invalid value\n"); return -EINVAL; } resource_set_opp_level(VDD1_OPP, value, flags); } else if (attr == &vdd2_opp_attr) { - if (value < 2 || value > 3) { + if (value < MIN_VDD2_OPP || value > 3) { printk(KERN_ERR "vdd_opp_store: Invalid value\n"); return -EINVAL; } diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index c328164..1ed7f53 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -1059,6 +1059,45 @@ void omap3_pm_init_vc(struct prm_setup_vc *setup_vc) prm_setup.vdd1_off = setup_vc->vdd1_off; } +int omap3_get_max_vdd1_opp(void) +{ + if (cpu_is_omap3630()) + return VDD1_OPP4; + else /* Place holder for other 34xx (3430/3440) */ + return VDD1_OPP5; +} +EXPORT_SYMBOL(omap3_get_max_vdd1_opp); + +int omap3_get_min_vdd1_opp(void) +{ + if (cpu_is_omap3630()) + return VDD1_OPP1; + else /* Place holder for other 34xx (3430/3440) */ + return VDD1_OPP1; +} +EXPORT_SYMBOL(omap3_get_min_vdd1_opp); + +int omap3_get_max_vdd2_opp(void) +{ + if (cpu_is_omap3630()) + return VDD2_OPP3; + else /* Place holder for other 34xx (3430/3440) */ + return VDD2_OPP3; + +} +EXPORT_SYMBOL(omap3_get_max_vdd2_opp); + +int omap3_get_min_vdd2_opp(void) +{ + if (cpu_is_omap3630()) + return VDD2_OPP2; + else /* Place holder for other 34xx (3430/3440) */ + return VDD2_OPP1; + +} +EXPORT_SYMBOL(omap3_get_min_vdd2_opp); + + static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) { struct power_state *pwrst; diff --git a/arch/arm/mach-omap2/resource34xx.c b/arch/arm/mach-omap2/resource34xx.c index 04be4d2..cc85601 100644 --- a/arch/arm/mach-omap2/resource34xx.c +++ b/arch/arm/mach-omap2/resource34xx.c @@ -382,7 +382,8 @@ int set_opp(struct shared_resource *resp, u32 target_level) * throughput in KiB/s for 100 Mhz = 100 * 1000 * 4. */ if (target_level >= 3) - resource_request("vdd2_opp", &vdd2_dev, 400000); + resource_request("vdd2_opp", &vdd2_dev, + (4 * (l3_opps + MAX_VDD2_OPP)->rate / 1000)); } else if (resp == vdd2_resp) { tput = target_level; diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h index 583e540..b089ccc 100644 --- a/arch/arm/plat-omap/include/plat/omap-pm.h +++ b/arch/arm/plat-omap/include/plat/omap-pm.h @@ -322,5 +322,32 @@ unsigned long omap_pm_cpu_get_freq(void); */ int omap_pm_get_dev_context_loss_count(struct device *dev); +/** + * omap3_get_max_opp - report Max OPP entries available for supplied VDD1 resource + * + * Returns the Max OPP entries available for supplied VDD resource. + */ +int omap3_get_max_vdd1_opp(void); + +/** + * omap3_get_min_opp - report Min OPP entries available for supplied VDD1 resource + * + * Returns the Min OPP entries available for supplied VDD resource. + */ +int omap3_get_min_vdd1_opp(void); + +/** + * omap3_get_max_opp - report Max OPP entries available for supplied VDD2 resource + * + * Returns the Max OPP entries available for supplied VDD resource. + */ +int omap3_get_max_vdd2_opp(void); + +/** + * omap3_get_min_opp - report Min OPP entries available for supplied VDD2 resource + * + * Returns the Min OPP entries available for supplied VDD resource. + */ +int omap3_get_min_vdd2_opp(void); #endif diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h b/arch/arm/plat-omap/include/plat/omap34xx.h index 6b849e5..a4a7bd9 100644 --- a/arch/arm/plat-omap/include/plat/omap34xx.h +++ b/arch/arm/plat-omap/include/plat/omap34xx.h @@ -98,10 +98,13 @@ #define VDD2_OPP2 0x2 #define VDD2_OPP3 0x3 -#define MIN_VDD1_OPP VDD1_OPP1 -#define MAX_VDD1_OPP VDD1_OPP5 -#define MIN_VDD2_OPP VDD2_OPP1 -#define MAX_VDD2_OPP VDD2_OPP3 +#define MIN_VDD1_OPP omap3_get_min_vdd1_opp() +#define MAX_VDD1_OPP omap3_get_max_vdd1_opp() +#define MIN_VDD2_OPP omap3_get_min_vdd2_opp() +#define MAX_VDD2_OPP omap3_get_max_vdd2_opp() + +/* Max OPP's Available among chips that comes under OMAP34xx configuration */ +#define MAX_VDD1_OPPS VDD1_OPP5 #endif /* __ASM_ARCH_OMAP34XX_H */