aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/powerdomain.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2011-03-16 18:52:47 -0400
committerKevin Hilman <khilman@ti.com>2011-09-15 14:39:10 -0400
commit048a7034f1044e69868df70bff32d8d67974e1b8 (patch)
tree0a0de2cfd9d7d5b645c36c2cf6670678842d2e0f /arch/arm/mach-omap2/powerdomain.c
parent7e1b94059cea39218071fdb78c4075b83d52e222 (diff)
OMAP2+: powerdomain: add voltage domain lookup during register
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>
Diffstat (limited to 'arch/arm/mach-omap2/powerdomain.c')
-rw-r--r--arch/arm/mach-omap2/powerdomain.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 896cb4c5eb1a..984457d612b7 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)
77static int _pwrdm_register(struct powerdomain *pwrdm) 77static int _pwrdm_register(struct powerdomain *pwrdm)
78{ 78{
79 int i; 79 int i;
80 struct voltagedomain *voltdm;
80 81
81 if (!pwrdm || !pwrdm->name) 82 if (!pwrdm || !pwrdm->name)
82 return -EINVAL; 83 return -EINVAL;
@@ -91,6 +92,14 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
91 if (_pwrdm_lookup(pwrdm->name)) 92 if (_pwrdm_lookup(pwrdm->name))
92 return -EEXIST; 93 return -EEXIST;
93 94
95 voltdm = voltdm_lookup(pwrdm->voltdm.name);
96 if (!voltdm) {
97 pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
98 pwrdm->name, pwrdm->voltdm.name);
99 return -EINVAL;
100 }
101 pwrdm->voltdm.ptr = voltdm;
102
94 list_add(&pwrdm->node, &pwrdm_list); 103 list_add(&pwrdm->node, &pwrdm_list);
95 104
96 /* Initialize the powerdomain's state counter */ 105 /* Initialize the powerdomain's state counter */
@@ -427,6 +436,18 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
427} 436}
428 437
429/** 438/**
439 * pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
440 * @pwrdm: struct powerdomain *
441 *
442 * Return a pointer to the struct voltageomain that the specified powerdomain
443 * @pwrdm exists in.
444 */
445struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm)
446{
447 return pwrdm->voltdm.ptr;
448}
449
450/**
430 * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain 451 * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
431 * @pwrdm: struct powerdomain * 452 * @pwrdm: struct powerdomain *
432 * 453 *