diff options
| -rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 43 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/powerdomain.h | 18 |
2 files changed, 50 insertions, 11 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index eaed0df16699..a11be81997c5 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * OMAP powerdomain control | 2 | * OMAP powerdomain control |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007-2008 Texas Instruments, Inc. | 4 | * Copyright (C) 2007-2008 Texas Instruments, Inc. |
| 5 | * Copyright (C) 2007-2009 Nokia Corporation | 5 | * Copyright (C) 2007-2011 Nokia Corporation |
| 6 | * | 6 | * |
| 7 | * Written by Paul Walmsley | 7 | * Written by Paul Walmsley |
| 8 | * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> | 8 | * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> |
| @@ -938,3 +938,44 @@ u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm) | |||
| 938 | 938 | ||
| 939 | return count; | 939 | return count; |
| 940 | } | 940 | } |
| 941 | |||
| 942 | /** | ||
| 943 | * pwrdm_can_ever_lose_context - can this powerdomain ever lose context? | ||
| 944 | * @pwrdm: struct powerdomain * | ||
| 945 | * | ||
| 946 | * Given a struct powerdomain * @pwrdm, returns 1 if the powerdomain | ||
| 947 | * can lose either memory or logic context or if @pwrdm is invalid, or | ||
| 948 | * returns 0 otherwise. This function is not concerned with how the | ||
| 949 | * powerdomain registers are programmed (i.e., to go off or not); it's | ||
| 950 | * concerned with whether it's ever possible for this powerdomain to | ||
| 951 | * go off while some other part of the chip is active. This function | ||
| 952 | * assumes that every powerdomain can go to either ON or INACTIVE. | ||
| 953 | */ | ||
| 954 | bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm) | ||
| 955 | { | ||
| 956 | int i; | ||
| 957 | |||
| 958 | if (IS_ERR_OR_NULL(pwrdm)) { | ||
| 959 | pr_debug("powerdomain: %s: invalid powerdomain pointer\n", | ||
| 960 | __func__); | ||
| 961 | return 1; | ||
| 962 | } | ||
| 963 | |||
| 964 | if (pwrdm->pwrsts & PWRSTS_OFF) | ||
| 965 | return 1; | ||
| 966 | |||
| 967 | if (pwrdm->pwrsts & PWRSTS_RET) { | ||
| 968 | if (pwrdm->pwrsts_logic_ret & PWRSTS_OFF) | ||
| 969 | return 1; | ||
| 970 | |||
| 971 | for (i = 0; i < pwrdm->banks; i++) | ||
| 972 | if (pwrdm->pwrsts_mem_ret[i] & PWRSTS_OFF) | ||
| 973 | return 1; | ||
| 974 | } | ||
| 975 | |||
| 976 | for (i = 0; i < pwrdm->banks; i++) | ||
| 977 | if (pwrdm->pwrsts_mem_on[i] & PWRSTS_OFF) | ||
| 978 | return 1; | ||
| 979 | |||
| 980 | return 0; | ||
| 981 | } | ||
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h index c66431edfeb7..af4f23c73c7a 100644 --- a/arch/arm/mach-omap2/powerdomain.h +++ b/arch/arm/mach-omap2/powerdomain.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * OMAP2/3/4 powerdomain control | 2 | * OMAP2/3/4 powerdomain control |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007-2008, 2010 Texas Instruments, Inc. | 4 | * Copyright (C) 2007-2008, 2010 Texas Instruments, Inc. |
| 5 | * Copyright (C) 2007-2010 Nokia Corporation | 5 | * Copyright (C) 2007-2011 Nokia Corporation |
| 6 | * | 6 | * |
| 7 | * Paul Walmsley | 7 | * Paul Walmsley |
| 8 | * | 8 | * |
| @@ -34,17 +34,14 @@ | |||
| 34 | 34 | ||
| 35 | /* Powerdomain allowable state bitfields */ | 35 | /* Powerdomain allowable state bitfields */ |
| 36 | #define PWRSTS_ON (1 << PWRDM_POWER_ON) | 36 | #define PWRSTS_ON (1 << PWRDM_POWER_ON) |
| 37 | #define PWRSTS_INACTIVE (1 << PWRDM_POWER_INACTIVE) | ||
| 38 | #define PWRSTS_RET (1 << PWRDM_POWER_RET) | ||
| 37 | #define PWRSTS_OFF (1 << PWRDM_POWER_OFF) | 39 | #define PWRSTS_OFF (1 << PWRDM_POWER_OFF) |
| 38 | #define PWRSTS_OFF_ON ((1 << PWRDM_POWER_OFF) | \ | ||
| 39 | (1 << PWRDM_POWER_ON)) | ||
| 40 | 40 | ||
| 41 | #define PWRSTS_OFF_RET ((1 << PWRDM_POWER_OFF) | \ | 41 | #define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON) |
| 42 | (1 << PWRDM_POWER_RET)) | 42 | #define PWRSTS_OFF_RET (PWRSTS_OFF | PWRSTS_RET) |
| 43 | 43 | #define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON) | |
| 44 | #define PWRSTS_RET_ON ((1 << PWRDM_POWER_RET) | \ | 44 | #define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON) |
| 45 | (1 << PWRDM_POWER_ON)) | ||
| 46 | |||
| 47 | #define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | (1 << PWRDM_POWER_ON)) | ||
| 48 | 45 | ||
| 49 | 46 | ||
| 50 | /* Powerdomain flags */ | 47 | /* Powerdomain flags */ |
| @@ -212,6 +209,7 @@ int pwrdm_pre_transition(void); | |||
| 212 | int pwrdm_post_transition(void); | 209 | int pwrdm_post_transition(void); |
| 213 | int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm); | 210 | int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm); |
| 214 | u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm); | 211 | u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm); |
| 212 | bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm); | ||
| 215 | 213 | ||
| 216 | extern void omap2xxx_powerdomains_init(void); | 214 | extern void omap2xxx_powerdomains_init(void); |
| 217 | extern void omap3xxx_powerdomains_init(void); | 215 | extern void omap3xxx_powerdomains_init(void); |
