Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
powerdomain.c File Reference
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <trace/events/power.h>
#include "cm2xxx_3xxx.h"
#include "prcm44xx.h"
#include "cm44xx.h"
#include "prm2xxx_3xxx.h"
#include "prm44xx.h"
#include <asm/cpu.h>
#include <plat/prcm.h>
#include "powerdomain.h"
#include "clockdomain.h"
#include "soc.h"
#include "pm.h"

Go to the source code of this file.

Macros

#define PWRDM_TRACE_STATES_FLAG   (1<<31)
 

Enumerations

enum  { PWRDM_STATE_NOW = 0, PWRDM_STATE_PREV }
 

Functions

int pwrdm_register_platform_funcs (struct pwrdm_ops *po)
 
int pwrdm_register_pwrdms (struct powerdomain **ps)
 
int pwrdm_complete_init (void)
 
. Returns a pointer

to the struct powerdomain if found, or NULL otherwise.

struct powerdomainpwrdm_lookup (const char *name)
 
int pwrdm_for_each (int(*fn)(struct powerdomain *pwrdm, void *user), void *user)
 
int pwrdm_add_clkdm (struct powerdomain *pwrdm, struct clockdomain *clkdm)
 
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 voltagedomainpwrdm_get_voltdm (struct powerdomain *pwrdm)
 
int pwrdm_get_mem_bank_count (struct powerdomain *pwrdm)
 
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)
 
bool pwrdm_has_hdwr_sar (struct powerdomain *pwrdm)
 
int pwrdm_set_lowpwrstchange (struct powerdomain *pwrdm)
 
int pwrdm_wait_transition (struct powerdomain *pwrdm)
 
int pwrdm_state_switch (struct powerdomain *pwrdm)
 
int pwrdm_pre_transition (struct powerdomain *pwrdm)
 
int pwrdm_post_transition (struct powerdomain *pwrdm)
 
int pwrdm_get_context_loss_count (struct powerdomain *pwrdm)
 
bool pwrdm_can_ever_lose_context (struct powerdomain *pwrdm)
 

Macro Definition Documentation

#define PWRDM_TRACE_STATES_FLAG   (1<<31)

Definition at line 40 of file powerdomain.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
PWRDM_STATE_NOW 
PWRDM_STATE_PREV 

Definition at line 42 of file powerdomain.c.

Function Documentation

int pwrdm_add_clkdm ( struct powerdomain pwrdm,
struct clockdomain clkdm 
)

pwrdm_add_clkdm - add a clockdomain to a powerdomain : struct powerdomain * to add the clockdomain to : struct clockdomain * to associate with a powerdomain

Associate the clockdomain with a powerdomain . This enables the use of pwrdm_for_each_clkdm(). Returns -EINVAL if presented with invalid pointers; -ENOMEM if memory could not be allocated; or 0 upon success.

Definition at line 336 of file powerdomain.c.

bool pwrdm_can_ever_lose_context ( struct powerdomain pwrdm)

pwrdm_can_ever_lose_context - can this powerdomain ever lose context? : struct powerdomain *

Given a struct powerdomain * , returns 1 if the powerdomain can lose either memory or logic context or if is invalid, or returns 0 otherwise. This function is not concerned with how the powerdomain registers are programmed (i.e., to go off or not); it's concerned with whether it's ever possible for this powerdomain to go off while some other part of the chip is active. This function assumes that every powerdomain can go to either ON or INACTIVE.

Definition at line 1055 of file powerdomain.c.

int pwrdm_clear_all_prev_pwrst ( struct powerdomain pwrdm)

pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm : struct powerdomain * to clear

Clear the powerdomain's previous power state register . Clears the entire register, including logic and memory bank previous power states. Returns -EINVAL if the powerdomain pointer is null, or returns 0 upon success.

Definition at line 834 of file powerdomain.c.

int pwrdm_complete_init ( void  )

pwrdm_complete_init - set up the powerdomain layer

Do whatever is necessary to initialize registered powerdomains and powerdomain code. Currently, this programs the next power state for each powerdomain to ON. This prevents powerdomains from unexpectedly losing context or entering high wakeup latency modes with non-power-management-enabled kernels. Must be called after pwrdm_register_pwrdms(). Returns -EACCES if called before pwrdm_register_pwrdms(), or 0 upon success.

Definition at line 266 of file powerdomain.c.

int pwrdm_del_clkdm ( struct powerdomain pwrdm,
struct clockdomain clkdm 
)

pwrdm_del_clkdm - remove a clockdomain from a powerdomain : struct powerdomain * to add the clockdomain to : struct clockdomain * to associate with a powerdomain

Dissociate the clockdomain from the powerdomain . Returns -EINVAL if presented with invalid pointers; -ENOENT if was not associated with the powerdomain, or 0 upon success.

Definition at line 384 of file powerdomain.c.

int pwrdm_disable_hdwr_sar ( struct powerdomain pwrdm)

pwrdm_disable_hdwr_sar - disable automatic hardware SAR for a pwrdm : struct powerdomain *

Disable automatic context save-and-restore upon power state change for some devices in the powerdomain . Warning: this only affects a subset of devices in a powerdomain; check the TRM closely. Returns -EINVAL if the powerdomain pointer is null or if the powerdomain does not support automatic save-and-restore, or returns 0 upon success.

Definition at line 895 of file powerdomain.c.

int pwrdm_enable_hdwr_sar ( struct powerdomain pwrdm)

pwrdm_enable_hdwr_sar - enable automatic hardware SAR for a pwrdm : struct powerdomain *

Enable automatic context save-and-restore upon power state change for some devices in the powerdomain . Warning: this only affects a subset of devices in a powerdomain; check the TRM closely. Returns -EINVAL if the powerdomain pointer is null or if the powerdomain does not support automatic save-and-restore, or returns 0 upon success.

Definition at line 866 of file powerdomain.c.

int pwrdm_for_each ( int(*)(struct powerdomain *pwrdm, void *user fn,
void user 
)

Definition at line 308 of file powerdomain.c.

int pwrdm_for_each_clkdm ( struct powerdomain pwrdm,
int(*)(struct powerdomain *pwrdm, struct clockdomain *clkdm)  fn 
)

Definition at line 426 of file powerdomain.c.

int pwrdm_get_context_loss_count ( struct powerdomain pwrdm)

pwrdm_get_context_loss_count - get powerdomain's context loss count : struct powerdomain * to wait for

Context loss count is the sum of powerdomain off-mode counter, the logic off counter and the per-bank memory off counter. Returns negative (and WARNs) upon error, otherwise, returns the context loss count.

Definition at line 1016 of file powerdomain.c.

int pwrdm_get_mem_bank_count ( struct powerdomain pwrdm)

pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain : struct powerdomain *

Return the number of controllable memory banks in powerdomain , starting with 1. Returns -EINVAL if the powerdomain pointer is null.

Definition at line 461 of file powerdomain.c.

struct voltagedomain* pwrdm_get_voltdm ( struct powerdomain pwrdm)
read

pwrdm_get_voltdm - return a ptr to the voltdm that this pwrdm resides in : struct powerdomain *

Return a pointer to the struct voltageomain that the specified powerdomain exists in.

Definition at line 449 of file powerdomain.c.

bool pwrdm_has_hdwr_sar ( struct powerdomain pwrdm)

pwrdm_has_hdwr_sar - test whether powerdomain supports hardware SAR : struct powerdomain *

Returns 1 if powerdomain supports hardware save-and-restore for some devices, or 0 if it does not.

Definition at line 920 of file powerdomain.c.

struct powerdomain* pwrdm_lookup ( const char name)
read

Definition at line 286 of file powerdomain.c.

int pwrdm_post_transition ( struct powerdomain pwrdm)

Definition at line 998 of file powerdomain.c.

int pwrdm_pre_transition ( struct powerdomain pwrdm)

Definition at line 988 of file powerdomain.c.

int pwrdm_read_logic_pwrst ( struct powerdomain pwrdm)

pwrdm_read_logic_pwrst - get current powerdomain logic retention power state : struct powerdomain * to get current logic retention power state

Return the power state that the logic portion of powerdomain will enter when the powerdomain enters retention. Returns -EINVAL if the powerdomain pointer is null or returns the logic retention power state upon success.

Definition at line 685 of file powerdomain.c.

int pwrdm_read_logic_retst ( struct powerdomain pwrdm)

pwrdm_read_logic_retst - get next powerdomain logic power state : struct powerdomain * to get next logic power state

Return the powerdomain pwrdm's logic power state. Returns -EINVAL if the powerdomain pointer is null or returns the next logic power state upon success.

Definition at line 727 of file powerdomain.c.

int pwrdm_read_mem_pwrst ( struct powerdomain pwrdm,
u8  bank 
)

pwrdm_read_mem_pwrst - get current memory bank power state : struct powerdomain * to get current memory bank power state : memory bank number (0-3)

Return the powerdomain 's current memory power state for bank . Returns -EINVAL if the powerdomain pointer is null, -EEXIST if the target memory bank does not exist or is not controllable, or returns the current memory power state upon success.

Definition at line 750 of file powerdomain.c.

int pwrdm_read_mem_retst ( struct powerdomain pwrdm,
u8  bank 
)

pwrdm_read_mem_retst - get next memory bank power state : struct powerdomain * to get mext memory bank power state : memory bank number (0-3)

Return the powerdomain pwrdm's next memory power state for bank x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if the target memory bank does not exist or is not controllable, or returns the next memory power state upon success.

Definition at line 809 of file powerdomain.c.

int pwrdm_read_next_pwrst ( struct powerdomain pwrdm)

pwrdm_read_next_pwrst - get next powerdomain power state : struct powerdomain * to get power state

Return the powerdomain 's next power state. Returns -EINVAL if the powerdomain pointer is null or returns the next power state upon success.

Definition at line 512 of file powerdomain.c.

int pwrdm_read_prev_logic_pwrst ( struct powerdomain pwrdm)

pwrdm_read_prev_logic_pwrst - get previous powerdomain logic power state : struct powerdomain * to get previous logic power state

Return the powerdomain 's previous logic power state. Returns -EINVAL if the powerdomain pointer is null or returns the previous logic power state upon success.

Definition at line 706 of file powerdomain.c.

int pwrdm_read_prev_mem_pwrst ( struct powerdomain pwrdm,
u8  bank 
)

pwrdm_read_prev_mem_pwrst - get previous memory bank power state : struct powerdomain * to get previous memory bank power state : memory bank number (0-3)

Return the powerdomain 's previous memory power state for bank . Returns -EINVAL if the powerdomain pointer is null, -EEXIST if the target memory bank does not exist or is not controllable, or returns the previous memory power state upon success.

Definition at line 780 of file powerdomain.c.

int pwrdm_read_prev_pwrst ( struct powerdomain pwrdm)

pwrdm_read_prev_pwrst - get previous powerdomain power state : struct powerdomain * to get previous power state

Return the powerdomain 's previous power state. Returns -EINVAL if the powerdomain pointer is null or returns the previous power state upon success.

Definition at line 558 of file powerdomain.c.

int pwrdm_read_pwrst ( struct powerdomain pwrdm)

pwrdm_read_pwrst - get current powerdomain power state : struct powerdomain * to get power state

Return the powerdomain 's current power state. Returns -EINVAL if the powerdomain pointer is null or returns the current power state upon success. Note that if the power domain only supports the ON state then just return ON as the current state.

Definition at line 534 of file powerdomain.c.

int pwrdm_register_platform_funcs ( struct pwrdm_ops po)

pwrdm_register_platform_funcs - register powerdomain implementation fns : func pointers for arch specific implementations

Register the list of function pointers used to implement the powerdomain functions on different OMAP SoCs. Should be called before any other pwrdm_register*() function. Returns -EINVAL if is null, -EEXIST if platform functions have already been registered, or 0 upon success.

Definition at line 216 of file powerdomain.c.

int pwrdm_register_pwrdms ( struct powerdomain **  ps)

pwrdm_register_pwrdms - register SoC powerdomains : pointer to an array of struct powerdomain to register

Register the powerdomains available on a particular OMAP SoC. Must be called after pwrdm_register_platform_funcs(). May be called multiple times. Returns -EACCES if called before pwrdm_register_platform_funcs(); -EINVAL if the argument is null; or 0 upon success.

Definition at line 239 of file powerdomain.c.

int pwrdm_set_logic_retst ( struct powerdomain pwrdm,
u8  pwrst 
)

pwrdm_set_logic_retst - set powerdomain logic power state upon retention : struct powerdomain * to set : one of the PWRDM_POWER_* macros

Set the next power state that the logic portion of the powerdomain will enter when the powerdomain enters retention. This will be either RETENTION or OFF, if supported. Returns -EINVAL if the powerdomain pointer is null or the target power state is not not supported, or returns 0 upon success.

Definition at line 582 of file powerdomain.c.

int pwrdm_set_lowpwrstchange ( struct powerdomain pwrdm)

pwrdm_set_lowpwrstchange - Request a low power state change : struct powerdomain *

Allows a powerdomain to transtion to a lower power sleep state from an existing sleep state without waking up the powerdomain. Returns -EINVAL if the powerdomain pointer is null or if the powerdomain does not support LOWPOWERSTATECHANGE, or returns 0 upon success.

Definition at line 935 of file powerdomain.c.

int pwrdm_set_mem_onst ( struct powerdomain pwrdm,
u8  bank,
u8  pwrst 
)

pwrdm_set_mem_onst - set memory power state while powerdomain ON : struct powerdomain * to set : memory bank number to set (0-3) : one of the PWRDM_POWER_* macros

Set the next power state that memory bank of the powerdomain will enter when the powerdomain enters the ON state. will be a number from 0 to 3, and represents different types of memory, depending on the powerdomain. Returns -EINVAL if the powerdomain pointer is null or the target power state is not not supported for this memory bank, -EEXIST if the target memory bank does not exist or is not controllable, or returns 0 upon success.

Definition at line 616 of file powerdomain.c.

int pwrdm_set_mem_retst ( struct powerdomain pwrdm,
u8  bank,
u8  pwrst 
)

pwrdm_set_mem_retst - set memory power state while powerdomain in RET : struct powerdomain * to set : memory bank number to set (0-3) : one of the PWRDM_POWER_* macros

Set the next power state that memory bank of the powerdomain will enter when the powerdomain enters the RETENTION state. Bank will be a number from 0 to 3, and represents different types of memory, depending on the powerdomain. will be either RETENTION or OFF, if supported. Returns -EINVAL if the powerdomain pointer is null or the target power state is not not supported for this memory bank, -EEXIST if the target memory bank does not exist or is not controllable, or returns 0 upon success.

Definition at line 654 of file powerdomain.c.

int pwrdm_set_next_pwrst ( struct powerdomain pwrdm,
u8  pwrst 
)

pwrdm_set_next_pwrst - set next powerdomain power state : struct powerdomain * to set : one of the PWRDM_POWER_* macros

Set the powerdomain 's next power state to . The powerdomain may not enter this state immediately if the preconditions for this state have not been satisfied. Returns -EINVAL if the powerdomain pointer is null or if the power state is invalid for the powerdomin, or returns 0 upon success.

Definition at line 480 of file powerdomain.c.

int pwrdm_state_switch ( struct powerdomain pwrdm)

Definition at line 977 of file powerdomain.c.

int pwrdm_wait_transition ( struct powerdomain pwrdm)

pwrdm_wait_transition - wait for powerdomain power transition to finish : struct powerdomain * to wait for

If the powerdomain is in the process of a state transition, spin until it completes the power transition, or until an iteration bailout value is reached. Returns -EINVAL if the powerdomain pointer is null, -EAGAIN if the bailout value was reached, or returns 0 upon success.

Definition at line 964 of file powerdomain.c.