Skip to content

Commit

Permalink
OMAP: powerdomain: Infrastructure to put arch specific code
Browse files Browse the repository at this point in the history
Put infrastructure in place, so arch specific func pointers
can be hooked up to the platform-independent part of the
framework.
This is in preparation of splitting the powerdomain framework into
platform-independent part (for all omaps) and platform-specific
parts.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Reviewed-by: Kevin Hilman <khilman@deeprootsystems.com>
Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Rajendra Nayak <rnayak@ti.com>
  • Loading branch information
Rajendra Nayak authored and Paul Walmsley committed Dec 22, 2010
1 parent 74bea6b commit 3b1e8b2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
11 changes: 9 additions & 2 deletions arch/arm/mach-omap2/powerdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ static u16 pwrstst_reg_offs;
/* pwrdm_list contains all registered struct powerdomains */
static LIST_HEAD(pwrdm_list);

static struct pwrdm_ops *arch_pwrdm;

/* Private functions */

static struct powerdomain *_pwrdm_lookup(const char *name)
Expand Down Expand Up @@ -211,14 +213,15 @@ static int _pwrdm_post_transition_cb(struct powerdomain *pwrdm, void *unused)
/**
* pwrdm_init - set up the powerdomain layer
* @pwrdm_list: array of struct powerdomain pointers to register
* @custom_funcs: func pointers for arch specfic implementations
*
* Loop through the array of powerdomains @pwrdm_list, registering all
* that are available on the current CPU. If pwrdm_list is supplied
* and not null, all of the referenced powerdomains will be
* registered. No return value. XXX pwrdm_list is not really a
* "list"; it is an array. Rename appropriately.
*/
void pwrdm_init(struct powerdomain **pwrdm_list)
void pwrdm_init(struct powerdomain **pwrdm_list, struct pwrdm_ops *custom_funcs)
{
struct powerdomain **p = NULL;

Expand All @@ -234,6 +237,11 @@ void pwrdm_init(struct powerdomain **pwrdm_list)
return;
}

if (!custom_funcs)
WARN(1, "powerdomain: No custom pwrdm functions registered\n");
else
arch_pwrdm = custom_funcs;

if (pwrdm_list) {
for (p = pwrdm_list; *p; p++)
_pwrdm_register(*p);
Expand Down Expand Up @@ -1074,4 +1082,3 @@ int pwrdm_post_transition(void)
pwrdm_for_each(_pwrdm_post_transition_cb, NULL);
return 0;
}

2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/powerdomains_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,5 @@ static struct powerdomain *powerdomains_omap[] __initdata = {

void pwrdm_fw_init(void)
{
pwrdm_init(powerdomains_omap);
pwrdm_init(powerdomains_omap, NULL);
}
43 changes: 42 additions & 1 deletion arch/arm/plat-omap/include/plat/powerdomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,50 @@ struct powerdomain {
#endif
};

/**
* struct pwrdm_ops - Arch specfic function implementations
* @pwrdm_set_next_pwrst: Set the target power state for a pd
* @pwrdm_read_next_pwrst: Read the target power state set for a pd
* @pwrdm_read_pwrst: Read the current power state of a pd
* @pwrdm_read_prev_pwrst: Read the prev power state entered by the pd
* @pwrdm_set_logic_retst: Set the logic state in RET for a pd
* @pwrdm_set_mem_onst: Set the Memory state in ON for a pd
* @pwrdm_set_mem_retst: Set the Memory state in RET for a pd
* @pwrdm_read_logic_pwrst: Read the current logic state of a pd
* @pwrdm_read_prev_logic_pwrst: Read the previous logic state entered by a pd
* @pwrdm_read_logic_retst: Read the logic state in RET for a pd
* @pwrdm_read_mem_pwrst: Read the current memory state of a pd
* @pwrdm_read_prev_mem_pwrst: Read the previous memory state entered by a pd
* @pwrdm_read_mem_retst: Read the memory state in RET for a pd
* @pwrdm_clear_all_prev_pwrst: Clear all previous power states logged for a pd
* @pwrdm_enable_hdwr_sar: Enable Hardware Save-Restore feature for the pd
* @pwrdm_disable_hdwr_sar: Disable Hardware Save-Restore feature for a pd
* @pwrdm_set_lowpwrstchange: Enable pd transitions from a shallow to deep sleep
* @pwrdm_wait_transition: Wait for a pd state transition to complete
*/
struct pwrdm_ops {
int (*pwrdm_set_next_pwrst)(struct powerdomain *pwrdm, u8 pwrst);
int (*pwrdm_read_next_pwrst)(struct powerdomain *pwrdm);
int (*pwrdm_read_pwrst)(struct powerdomain *pwrdm);
int (*pwrdm_read_prev_pwrst)(struct powerdomain *pwrdm);
int (*pwrdm_set_logic_retst)(struct powerdomain *pwrdm, u8 pwrst);
int (*pwrdm_set_mem_onst)(struct powerdomain *pwrdm, u8 bank, u8 pwrst);
int (*pwrdm_set_mem_retst)(struct powerdomain *pwrdm, u8 bank, u8 pwrst);
int (*pwrdm_read_logic_pwrst)(struct powerdomain *pwrdm);
int (*pwrdm_read_prev_logic_pwrst)(struct powerdomain *pwrdm);
int (*pwrdm_read_logic_retst)(struct powerdomain *pwrdm);
int (*pwrdm_read_mem_pwrst)(struct powerdomain *pwrdm, u8 bank);
int (*pwrdm_read_prev_mem_pwrst)(struct powerdomain *pwrdm, u8 bank);
int (*pwrdm_read_mem_retst)(struct powerdomain *pwrdm, u8 bank);
int (*pwrdm_clear_all_prev_pwrst)(struct powerdomain *pwrdm);
int (*pwrdm_enable_hdwr_sar)(struct powerdomain *pwrdm);
int (*pwrdm_disable_hdwr_sar)(struct powerdomain *pwrdm);
int (*pwrdm_set_lowpwrstchange)(struct powerdomain *pwrdm);
int (*pwrdm_wait_transition)(struct powerdomain *pwrdm);
};

void pwrdm_fw_init(void);
void pwrdm_init(struct powerdomain **pwrdm_list);
void pwrdm_init(struct powerdomain **pwrdm_list, struct pwrdm_ops *custom_funcs);

struct powerdomain *pwrdm_lookup(const char *name);

Expand Down

0 comments on commit 3b1e8b2

Please sign in to comment.