From patchwork Wed Aug 18 11:20:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 120134 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7IBKRtG019571 for ; Wed, 18 Aug 2010 11:20:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816Ab0HRLU2 (ORCPT ); Wed, 18 Aug 2010 07:20:28 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:41229 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752792Ab0HRLUY (ORCPT ); Wed, 18 Aug 2010 07:20:24 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o7IBKKO4020709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 18 Aug 2010 06:20:22 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o7IBKGpA022576; Wed, 18 Aug 2010 16:50:18 +0530 (IST) From: Thara Gopinath To: linux-omap@vger.kernel.org Cc: khilman@deeprootsystems.com, paul@pwsan.com, vishwanath.bs@ti.com, sawant@ti.com, b-cousson@ti.com, Thara Gopinath Subject: [PATCH 04/13] OMAP: Introduce API to return a device list associated with a voltage domain Date: Wed, 18 Aug 2010 16:50:03 +0530 Message-Id: <1282130412-12027-5-git-send-email-thara@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1282130412-12027-1-git-send-email-thara@ti.com> References: <1282130412-12027-1-git-send-email-thara@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 18 Aug 2010 11:20:29 +0000 (UTC) diff --git a/arch/arm/plat-omap/include/plat/opp.h b/arch/arm/plat-omap/include/plat/opp.h index 0e580ed..a4c1669 100644 --- a/arch/arm/plat-omap/include/plat/opp.h +++ b/arch/arm/plat-omap/include/plat/opp.h @@ -18,6 +18,7 @@ #include #include +#include /** * struct omap_opp_def - OMAP OPP Definition @@ -86,6 +87,9 @@ int opp_disable(struct omap_opp *opp); void opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table); + +struct device **opp_init_voltage_params(struct voltagedomain *voltdm, + int *dev_count); #else static inline unsigned long opp_get_voltage(const struct omap_opp *opp) { @@ -149,5 +153,10 @@ void opp_init_cpufreq_table(struct omap_opp *opps, { } +static inline struct device **opp_init_voltage_params( + struct voltagedomain *voltdm, int *dev_count) +{ +} + #endif /* CONFIG_PM */ #endif /* __ASM_ARM_OMAP_OPP_H */ diff --git a/arch/arm/plat-omap/opp.c b/arch/arm/plat-omap/opp.c index a3dea82..72dd62a 100644 --- a/arch/arm/plat-omap/opp.c +++ b/arch/arm/plat-omap/opp.c @@ -502,3 +502,31 @@ void opp_init_cpufreq_table(struct device *dev, *table = &freq_table[0]; } + +struct device **opp_init_voltage_params(struct voltagedomain *voltdm, + int *dev_count) +{ + struct device_opp *dev_opp; + struct device **dev_list; + int count = 0, i = 0; + + list_for_each_entry(dev_opp, &dev_opp_list, node) { + if (!dev_opp->oh->vdd_name) + continue; + + if (!strcmp(dev_opp->oh->vdd_name, voltdm->name)) { + dev_opp->oh->voltdm = voltdm; + count++; + } + } + + dev_list = kzalloc(sizeof(struct device *) * count, GFP_KERNEL); + + list_for_each_entry(dev_opp, &dev_opp_list, node) { + if (dev_opp->oh->voltdm == voltdm) + dev_list[i++] = dev_opp->dev; + } + + *dev_count = count; + return dev_list; +}