linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 12/17] OMAP2+: powerdomain: add voltage domain lookup during register
Date: Wed, 30 Mar 2011 17:16:15 -0700	[thread overview]
Message-ID: <1301530580-12046-13-git-send-email-khilman@ti.com> (raw)
In-Reply-To: <1301530580-12046-1-git-send-email-khilman@ti.com>

When a powerdomain is registered, lookup the voltage domain by name
and keep a pointer to the containing voltagedomain in the powerdomain
structure.

Modeled after similar method between powerdomain and clockdomain layers.

Signed-off-by: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-omap2/powerdomain.c |   21 +++++++++++++++++++++
 arch/arm/mach-omap2/powerdomain.h |    1 +
 arch/arm/mach-omap2/voltage.h     |    1 +
 3 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 49c6513..8fccd4b 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -77,6 +77,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
 static int _pwrdm_register(struct powerdomain *pwrdm)
 {
 	int i;
+	struct voltagedomain *voltdm;
 
 	if (!pwrdm || !pwrdm->name)
 		return -EINVAL;
@@ -94,6 +95,14 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
 	if (_pwrdm_lookup(pwrdm->name))
 		return -EEXIST;
 
+	voltdm = voltdm_lookup(pwrdm->voltdm.name);
+	if (!voltdm) {
+		pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
+		       pwrdm->name, pwrdm->voltdm.name);
+		return -EINVAL;
+	}
+	pwrdm->voltdm.ptr = voltdm;
+
 	list_add(&pwrdm->node, &pwrdm_list);
 
 	/* Initialize the powerdomain's state counter */
@@ -383,6 +392,18 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
 }
 
 /**
+ * pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
+ * @pwrdm: struct powerdomain *
+ *
+ * Return a pointer to the struct voltageomain that the specified powerdomain
+ * @pwrdm exists in.
+ */
+struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm)
+{
+	return pwrdm->voltdm.ptr;
+}
+
+/**
  * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
  * @pwrdm: struct powerdomain *
  *
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index cc03a0d..3a1ec37 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -183,6 +183,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
 int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
 			 int (*fn)(struct powerdomain *pwrdm,
 				   struct clockdomain *clkdm));
+struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm);
 
 int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
 
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index cacd76e..966aa88 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -186,4 +186,5 @@ extern void omap44xx_voltagedomains_init(void);
 
 struct voltagedomain *voltdm_lookup(const char *name);
 void voltdm_init(struct voltagedomain **voltdm_list);
+int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
 #endif
-- 
1.7.4


  parent reply	other threads:[~2011-03-31  0:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31  0:16 [PATCH 00/17] OMAP: voltage layer cleanup and restructure: part 1 Kevin Hilman
2011-03-31  0:16 ` [PATCH 01/17] OMAP2+: hwmod: remove unused voltagedomain pointer Kevin Hilman
2011-03-31  0:16 ` [PATCH 02/17] OMAP2+: voltage: move PRCM mod offets into VC/VP structures Kevin Hilman
2011-03-31  0:16 ` [PATCH 03/17] OMAP2+: voltage: move prm_irqst_reg from VP into voltage domain Kevin Hilman
2011-03-31  0:16 ` [PATCH 04/17] OMAP2+: voltage: start towards a new voltagedomain layer Kevin Hilman
2011-03-31  0:16 ` [PATCH 05/17] OMAP3: voltage: rename "mpu" voltagedomain to "mpu_iva" Kevin Hilman
2011-03-31  0:16 ` [PATCH 06/17] OMAP3: voltagedomain data: add wakeup domain Kevin Hilman
2011-03-31  0:16 ` [PATCH 07/17] OMAP3+: voltage: add scalable flag to voltagedomain Kevin Hilman
2011-03-31  0:16 ` [PATCH 08/17] OMAP2+: powerdomain: add voltagedomain to struct powerdomain Kevin Hilman
2011-03-31  0:16 ` [PATCH 09/17] OMAP2: add voltage domains and connect to powerdomains Kevin Hilman
2011-03-31  0:16 ` [PATCH 10/17] OMAP3: powerdomain data: add voltage domains Kevin Hilman
2011-03-31  0:16 ` [PATCH 11/17] OMAP4: " Kevin Hilman
2011-03-31  0:16 ` Kevin Hilman [this message]
2011-03-31  0:16 ` [PATCH 13/17] OMAP2+: voltage: keep track of powerdomains in each voltagedomain Kevin Hilman
2011-03-31  0:16 ` [PATCH 14/17] OMAP2+: voltage: split voltage controller (VC) code into dedicated layer Kevin Hilman
2011-03-31  0:16 ` [PATCH 15/17] OMAP2+: voltage: move VC into struct voltagedomain, misc. renames Kevin Hilman
2011-03-31  0:16 ` [PATCH 16/17] OMAP2+: voltage: split out voltage processor (VP) code into new layer Kevin Hilman
2011-03-31  0:16 ` [PATCH 17/17] OMAP2+: VC: support PMICs with separate voltage and command registers Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1301530580-12046-13-git-send-email-khilman@ti.com \
    --to=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).