]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-3.0/pm-wip/voltdm/0107-OMAP2-powerdomain-add-voltage-domain-lookup-during-r.patch
linux 3.0: updates
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / voltdm / 0107-OMAP2-powerdomain-add-voltage-domain-lookup-during-r.patch
1 From 73e5197e2861d26462a67d9796bedd7d84c81687 Mon Sep 17 00:00:00 2001
2 From: Kevin Hilman <khilman@ti.com>
3 Date: Wed, 16 Mar 2011 15:52:47 -0700
4 Subject: [PATCH 107/149] OMAP2+: powerdomain: add voltage domain lookup during register
6 When a powerdomain is registered, lookup the voltage domain by name
7 and keep a pointer to the containing voltagedomain in the powerdomain
8 structure.
10 Modeled after similar method between powerdomain and clockdomain layers.
12 Signed-off-by: Kevin Hilman <khilman@ti.com>
13 ---
14  arch/arm/mach-omap2/powerdomain.c |   21 +++++++++++++++++++++
15  arch/arm/mach-omap2/powerdomain.h |    1 +
16  arch/arm/mach-omap2/voltage.h     |    1 +
17  3 files changed, 23 insertions(+), 0 deletions(-)
19 diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
20 index 9af0847..1d3013d 100644
21 --- a/arch/arm/mach-omap2/powerdomain.c
22 +++ b/arch/arm/mach-omap2/powerdomain.c
23 @@ -77,6 +77,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
24  static int _pwrdm_register(struct powerdomain *pwrdm)
25  {
26         int i;
27 +       struct voltagedomain *voltdm;
28  
29         if (!pwrdm || !pwrdm->name)
30                 return -EINVAL;
31 @@ -94,6 +95,14 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
32         if (_pwrdm_lookup(pwrdm->name))
33                 return -EEXIST;
34  
35 +       voltdm = voltdm_lookup(pwrdm->voltdm.name);
36 +       if (!voltdm) {
37 +               pr_err("powerdomain: %s: voltagedomain %s does not exist\n",
38 +                      pwrdm->name, pwrdm->voltdm.name);
39 +               return -EINVAL;
40 +       }
41 +       pwrdm->voltdm.ptr = voltdm;
42 +
43         list_add(&pwrdm->node, &pwrdm_list);
44  
45         /* Initialize the powerdomain's state counter */
46 @@ -383,6 +392,18 @@ int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
47  }
48  
49  /**
50 + * pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in
51 + * @pwrdm: struct powerdomain *
52 + *
53 + * Return a pointer to the struct voltageomain that the specified powerdomain
54 + * @pwrdm exists in.
55 + */
56 +struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm)
57 +{
58 +       return pwrdm->voltdm.ptr;
59 +}
60 +
61 +/**
62   * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain
63   * @pwrdm: struct powerdomain *
64   *
65 diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
66 index 9ce920d..25bef48 100644
67 --- a/arch/arm/mach-omap2/powerdomain.h
68 +++ b/arch/arm/mach-omap2/powerdomain.h
69 @@ -183,6 +183,7 @@ int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
70  int pwrdm_for_each_clkdm(struct powerdomain *pwrdm,
71                          int (*fn)(struct powerdomain *pwrdm,
72                                    struct clockdomain *clkdm));
73 +struct voltagedomain *pwrdm_get_voltdm(struct powerdomain *pwrdm);
74  
75  int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm);
76  
77 diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
78 index cacd76e..966aa88 100644
79 --- a/arch/arm/mach-omap2/voltage.h
80 +++ b/arch/arm/mach-omap2/voltage.h
81 @@ -186,4 +186,5 @@ extern void omap44xx_voltagedomains_init(void);
82  
83  struct voltagedomain *voltdm_lookup(const char *name);
84  void voltdm_init(struct voltagedomain **voltdm_list);
85 +int voltdm_add_pwrdm(struct voltagedomain *voltdm, struct powerdomain *pwrdm);
86  #endif
87 -- 
88 1.6.6.1