mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-24 02:18:54 +00:00
OMAP2+: powerdomain: add pwrdm_can_ever_lose_context()
Some drivers wish to know whether the device that they control can ever lose context, for example, when the device's enclosing powerdomain loses power. They can use this information to determine whether it is necessary to save and restore device context, or whether it can be skipped. Implement the powerdomain portion of this by adding the function pwrdm_can_ever_lose_context(). This is not for use directly from driver code, but instead is intended to be called from driver-subarch integration code (i.e., arch/arm/*omap* code). Currently, the result from this function should be passed into the driver code via struct platform_data, but at some point this should be part of some common or OMAP-specific device code. While here, update file copyrights. Signed-off-by: Paul Walmsley <paul@pwsan.com>
This commit is contained in:
parent
4cb49fec12
commit
694606c4ef
@ -2,7 +2,7 @@
|
|||||||
* OMAP powerdomain control
|
* OMAP powerdomain control
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 Texas Instruments, Inc.
|
* Copyright (C) 2007-2008 Texas Instruments, Inc.
|
||||||
* Copyright (C) 2007-2009 Nokia Corporation
|
* Copyright (C) 2007-2011 Nokia Corporation
|
||||||
*
|
*
|
||||||
* Written by Paul Walmsley
|
* Written by Paul Walmsley
|
||||||
* Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com>
|
* Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com>
|
||||||
@ -938,3 +938,44 @@ u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm)
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pwrdm_can_ever_lose_context - can this powerdomain ever lose context?
|
||||||
|
* @pwrdm: struct powerdomain *
|
||||||
|
*
|
||||||
|
* Given a struct powerdomain * @pwrdm, returns 1 if the powerdomain
|
||||||
|
* can lose either memory or logic context or if @pwrdm 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.
|
||||||
|
*/
|
||||||
|
bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (IS_ERR_OR_NULL(pwrdm)) {
|
||||||
|
pr_debug("powerdomain: %s: invalid powerdomain pointer\n",
|
||||||
|
__func__);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pwrdm->pwrsts & PWRSTS_OFF)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (pwrdm->pwrsts & PWRSTS_RET) {
|
||||||
|
if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
for (i = 0; i < pwrdm->banks; i++)
|
||||||
|
if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < pwrdm->banks; i++)
|
||||||
|
if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* OMAP2/3/4 powerdomain control
|
* OMAP2/3/4 powerdomain control
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008, 2010 Texas Instruments, Inc.
|
* Copyright (C) 2007-2008, 2010 Texas Instruments, Inc.
|
||||||
* Copyright (C) 2007-2010 Nokia Corporation
|
* Copyright (C) 2007-2011 Nokia Corporation
|
||||||
*
|
*
|
||||||
* Paul Walmsley
|
* Paul Walmsley
|
||||||
*
|
*
|
||||||
@ -34,17 +34,14 @@
|
|||||||
|
|
||||||
/* Powerdomain allowable state bitfields */
|
/* Powerdomain allowable state bitfields */
|
||||||
#define PWRSTS_ON (1 << PWRDM_POWER_ON)
|
#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 (1 << PWRDM_POWER_OFF)
|
||||||
#define PWRSTS_OFF_ON ((1 << PWRDM_POWER_OFF) | \
|
|
||||||
(1 << PWRDM_POWER_ON))
|
|
||||||
|
|
||||||
#define PWRSTS_OFF_RET ((1 << PWRDM_POWER_OFF) | \
|
#define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON)
|
||||||
(1 << PWRDM_POWER_RET))
|
#define PWRSTS_OFF_RET (PWRSTS_OFF | PWRSTS_RET)
|
||||||
|
#define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON)
|
||||||
#define PWRSTS_RET_ON ((1 << PWRDM_POWER_RET) | \
|
#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON)
|
||||||
(1 << PWRDM_POWER_ON))
|
|
||||||
|
|
||||||
#define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | (1 << PWRDM_POWER_ON))
|
|
||||||
|
|
||||||
|
|
||||||
/* Powerdomain flags */
|
/* Powerdomain flags */
|
||||||
@ -212,6 +209,7 @@ int pwrdm_pre_transition(void);
|
|||||||
int pwrdm_post_transition(void);
|
int pwrdm_post_transition(void);
|
||||||
int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
|
int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
|
||||||
u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
|
u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
|
||||||
|
bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
|
||||||
|
|
||||||
extern void omap2xxx_powerdomains_init(void);
|
extern void omap2xxx_powerdomains_init(void);
|
||||||
extern void omap3xxx_powerdomains_init(void);
|
extern void omap3xxx_powerdomains_init(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user