Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros
powerdomain.h File Reference
#include <linux/types.h>
#include <linux/list.h>
#include <linux/atomic.h>
#include <plat/cpu.h>
#include "voltage.h"

Go to the source code of this file.

Data Structures

struct  powerdomain
 
struct  pwrdm_ops
 

Macros

#define PWRDM_POWER_OFF   0x0
 
#define PWRDM_POWER_RET   0x1
 
#define PWRDM_POWER_INACTIVE   0x2
 
#define PWRDM_POWER_ON   0x3
 
#define PWRDM_MAX_PWRSTS   4
 
#define PWRSTS_ON   (1 << PWRDM_POWER_ON)
 
#define PWRSTS_INACTIVE   (1 << PWRDM_POWER_INACTIVE)
 
#define PWRSTS_RET   (1 << PWRDM_POWER_RET)
 
#define PWRSTS_OFF   (1 << PWRDM_POWER_OFF)
 
#define PWRSTS_OFF_ON   (PWRSTS_OFF | PWRSTS_ON)
 
#define PWRSTS_OFF_RET   (PWRSTS_OFF | PWRSTS_RET)
 
#define PWRSTS_RET_ON   (PWRSTS_RET | PWRSTS_ON)
 
#define PWRSTS_OFF_RET_ON   (PWRSTS_OFF_RET | PWRSTS_ON)
 
#define PWRDM_HAS_HDWR_SAR   (1 << 0) /* hardware save-and-restore support */
 
#define PWRDM_HAS_MPU_QUIRK
 
#define PWRDM_HAS_LOWPOWERSTATECHANGE
 
#define PWRDM_MAX_MEM_BANKS   5
 
#define PWRDM_MAX_CLKDMS   11
 
#define PWRDM_TRANSITION_BAILOUT   100000
 

: Powerdomain name

struct powerdomain - OMAP powerdomain

: voltagedomain containing this powerdomain : the address offset from CM_BASE/PRM_BASE : (OMAP4 only) the PRCM partition ID containing : Possible powerdomain power states : Possible logic power states when pwrdm in RETENTION : Powerdomain flags : Number of software-controllable memory banks in this powerdomain : Possible memory bank pwrstates when pwrdm in RETENTION : Possible memory bank pwrstates when pwrdm in ON : Clockdomains in this powerdomain : list_head linking all powerdomains : list_head linking all powerdomains in a voltagedomain : (AM33XX only) XXX_PWRSTCTRL reg offset from prcm_offs : (AM33XX only) XXX_PWRSTST reg offset from prcm_offs : (AM33XX only) mask for logic retention bitfield in : (AM33XX only) mask for mem on bitfield in : (AM33XX only) mask for mem ret bitfield in : (AM33XX only) mask for mem state bitfield in : (AM33XX only) mask for mem retention state bitfield in : : : :

possible values are defined in mach-omap2/prcm44xx.h.

struct pwrdm_ops omap2_pwrdm_operations
 
struct pwrdm_ops omap3_pwrdm_operations
 
struct pwrdm_ops am33xx_pwrdm_operations
 
struct pwrdm_ops omap4_pwrdm_operations
 
struct powerdomain wkup_omap2_pwrdm
 
struct powerdomain gfx_omap2_pwrdm
 
int pwrdm_register_platform_funcs (struct pwrdm_ops *custom_funcs)
 
int pwrdm_register_pwrdms (struct powerdomain **pwrdm_list)
 
int pwrdm_complete_init (void)
 
struct powerdomainpwrdm_lookup (const char *name)
 
int pwrdm_for_each (int(*fn)(struct powerdomain *pwrdm, void *user), void *user)
 
int pwrdm_for_each_nolock (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_clear_all_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_enable_hdwr_sar (struct powerdomain *pwrdm)
 
int pwrdm_disable_hdwr_sar (struct powerdomain *pwrdm)
 
bool pwrdm_has_hdwr_sar (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_set_lowpwrstchange (struct powerdomain *pwrdm)
 
int pwrdm_get_context_loss_count (struct powerdomain *pwrdm)
 
bool pwrdm_can_ever_lose_context (struct powerdomain *pwrdm)
 
void omap242x_powerdomains_init (void)
 
void omap243x_powerdomains_init (void)
 
void omap3xxx_powerdomains_init (void)
 
void am33xx_powerdomains_init (void)
 
void omap44xx_powerdomains_init (void)
 
u32 omap2_pwrdm_get_mem_bank_onstate_mask (u8 bank)
 
u32 omap2_pwrdm_get_mem_bank_retst_mask (u8 bank)
 
u32 omap2_pwrdm_get_mem_bank_stst_mask (u8 bank)
 

Macro Definition Documentation

#define PWRDM_HAS_HDWR_SAR   (1 << 0) /* hardware save-and-restore support */

Definition at line 50 of file powerdomain.h.

#define PWRDM_HAS_LOWPOWERSTATECHANGE
Value:
(1 << 2) /*
* support to transition from a
* sleep state to a lower sleep
* state without waking up the
* powerdomain
*/

Definition at line 52 of file powerdomain.h.

#define PWRDM_HAS_MPU_QUIRK
Value:
(1 << 1) /* MPU pwr domain has MEM bank 0 bits
* in MEM bank 1 position. This is
* true for OMAP3430
*/

Definition at line 51 of file powerdomain.h.

#define PWRDM_MAX_CLKDMS   11

Definition at line 64 of file powerdomain.h.

#define PWRDM_MAX_MEM_BANKS   5

Definition at line 58 of file powerdomain.h.

#define PWRDM_MAX_PWRSTS   4

Definition at line 35 of file powerdomain.h.

#define PWRDM_POWER_INACTIVE   0x2

Definition at line 32 of file powerdomain.h.

#define PWRDM_POWER_OFF   0x0

Definition at line 30 of file powerdomain.h.

#define PWRDM_POWER_ON   0x3

Definition at line 33 of file powerdomain.h.

#define PWRDM_POWER_RET   0x1

Definition at line 31 of file powerdomain.h.

#define PWRDM_TRANSITION_BAILOUT   100000

Definition at line 67 of file powerdomain.h.

#define PWRSTS_INACTIVE   (1 << PWRDM_POWER_INACTIVE)

Definition at line 39 of file powerdomain.h.

#define PWRSTS_OFF   (1 << PWRDM_POWER_OFF)

Definition at line 41 of file powerdomain.h.

#define PWRSTS_OFF_ON   (PWRSTS_OFF | PWRSTS_ON)

Definition at line 43 of file powerdomain.h.

#define PWRSTS_OFF_RET   (PWRSTS_OFF | PWRSTS_RET)

Definition at line 44 of file powerdomain.h.

#define PWRSTS_OFF_RET_ON   (PWRSTS_OFF_RET | PWRSTS_ON)

Definition at line 46 of file powerdomain.h.

#define PWRSTS_ON   (1 << PWRDM_POWER_ON)

Definition at line 38 of file powerdomain.h.

#define PWRSTS_RET   (1 << PWRDM_POWER_RET)

Definition at line 40 of file powerdomain.h.

#define PWRSTS_RET_ON   (PWRSTS_RET | PWRSTS_ON)

Definition at line 45 of file powerdomain.h.

Function Documentation

void am33xx_powerdomains_init ( void  )

Definition at line 180 of file powerdomains33xx_data.c.

void omap242x_powerdomains_init ( void  )

Definition at line 116 of file powerdomains2xxx_data.c.

void omap243x_powerdomains_init ( void  )

Definition at line 126 of file powerdomains2xxx_data.c.

u32 omap2_pwrdm_get_mem_bank_onstate_mask ( u8  bank)

Definition at line 51 of file powerdomain-common.c.

u32 omap2_pwrdm_get_mem_bank_retst_mask ( u8  bank)

Definition at line 71 of file powerdomain-common.c.

u32 omap2_pwrdm_get_mem_bank_stst_mask ( u8  bank)

Definition at line 91 of file powerdomain-common.c.

void omap3xxx_powerdomains_init ( void  )

Definition at line 396 of file powerdomains3xxx_data.c.

void omap44xx_powerdomains_init ( void  )

Definition at line 353 of file powerdomains44xx_data.c.

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_for_each_nolock ( int(*)(struct powerdomain *pwrdm, void *user fn,
void user 
)
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.

Variable Documentation

struct pwrdm_ops am33xx_pwrdm_operations

Definition at line 214 of file powerdomain33xx.c.

struct powerdomain gfx_omap2_pwrdm

Definition at line 45 of file powerdomains2xxx_3xxx_data.c.

struct pwrdm_ops omap2_pwrdm_operations

Definition at line 212 of file powerdomain2xxx_3xxx.c.

struct pwrdm_ops omap3_pwrdm_operations

Definition at line 224 of file powerdomain2xxx_3xxx.c.

struct pwrdm_ops omap4_pwrdm_operations

Definition at line 268 of file powerdomain44xx.c.

struct powerdomain wkup_omap2_pwrdm

Definition at line 60 of file powerdomains2xxx_3xxx_data.c.