2 * Copyright (C) 2013-2015 ARM Limited. All rights reserved.
4 * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5 * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
7 * A copy of the licence is included with the program, and can also be obtained from Free Software
8 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
11 #ifndef __MALI_PM_DOMAIN_H__
12 #define __MALI_PM_DOMAIN_H__
14 #include "mali_kernel_common.h"
17 #include "mali_l2_cache.h"
18 #include "mali_group.h"
21 /* Instances are protected by PM state lock */
22 struct mali_pm_domain {
23 mali_bool power_is_on;
27 /* Zero or more groups can belong to this domain */
28 _mali_osk_list_t group_list;
30 /* Zero or more L2 caches can belong to this domain */
31 _mali_osk_list_t l2_cache_list;
35 void mali_pm_domain_initialize(void);
36 void mali_pm_domain_terminate(void);
38 struct mali_pm_domain *mali_pm_domain_create(u32 pmu_mask);
39 void mali_pm_domain_delete(struct mali_pm_domain *domain);
41 void mali_pm_domain_add_l2_cache(
42 struct mali_pm_domain *domain,
43 struct mali_l2_cache_core *l2_cache);
44 void mali_pm_domain_add_group(struct mali_pm_domain *domain,
45 struct mali_group *group);
47 struct mali_pm_domain *mali_pm_domain_get_from_mask(u32 mask);
48 struct mali_pm_domain *mali_pm_domain_get_from_index(u32 id);
51 u32 mali_pm_domain_ref_get(struct mali_pm_domain *domain);
52 u32 mali_pm_domain_ref_put(struct mali_pm_domain *domain);
54 MALI_STATIC_INLINE _mali_osk_list_t *mali_pm_domain_get_group_list(
55 struct mali_pm_domain *domain)
57 MALI_DEBUG_ASSERT_POINTER(domain);
58 return &domain->group_list;
61 MALI_STATIC_INLINE _mali_osk_list_t *mali_pm_domain_get_l2_cache_list(
62 struct mali_pm_domain *domain)
64 MALI_DEBUG_ASSERT_POINTER(domain);
65 return &domain->l2_cache_list;
68 MALI_STATIC_INLINE mali_bool mali_pm_domain_power_is_on(
69 struct mali_pm_domain *domain)
71 MALI_DEBUG_ASSERT_POINTER(domain);
72 return domain->power_is_on;
75 MALI_STATIC_INLINE void mali_pm_domain_set_power_on(
76 struct mali_pm_domain *domain,
77 mali_bool power_is_on)
79 MALI_DEBUG_ASSERT_POINTER(domain);
80 domain->power_is_on = power_is_on;
83 MALI_STATIC_INLINE u32 mali_pm_domain_get_use_count(
84 struct mali_pm_domain *domain)
86 MALI_DEBUG_ASSERT_POINTER(domain);
87 return domain->use_count;
90 #if MALI_STATE_TRACKING
91 u32 mali_pm_domain_get_id(struct mali_pm_domain *domain);
93 MALI_STATIC_INLINE u32 mali_pm_domain_get_mask(struct mali_pm_domain *domain)
95 MALI_DEBUG_ASSERT_POINTER(domain);
96 return domain->pmu_mask;
101 mali_bool mali_pm_domain_all_unused(void);
104 #endif /* __MALI_PM_DOMAIN_H__ */