diff options
Diffstat (limited to 'arch/arm/mach-omap2/powerdomain.c')
-rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 43 |
1 files changed, 42 insertions, 1 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 | } | ||