2 * Copyright (C) 2010-2012 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"
24 } mali_pm_domain_state;
26 struct mali_pm_domain {
27 mali_pm_domain_state state;
28 _mali_osk_spinlock_irq_t *lock;
35 struct mali_group *group_list;
37 struct mali_l2_cache_core *l2;
40 struct mali_pm_domain *mali_pm_domain_create(u32 pmu_mask);
42 void mali_pm_domain_add_group(u32 mask, struct mali_group *group);
44 void mali_pm_domain_add_l2(u32 mask, struct mali_l2_cache_core *l2);
45 void mali_pm_domain_delete(struct mali_pm_domain *domain);
47 void mali_pm_domain_terminate(void);
49 /** Get PM domain from domain ID
51 struct mali_pm_domain *mali_pm_domain_get_from_mask(u32 mask);
52 struct mali_pm_domain *mali_pm_domain_get_from_index(u32 id);
55 void mali_pm_domain_ref_get(struct mali_pm_domain *domain);
56 void mali_pm_domain_ref_put(struct mali_pm_domain *domain);
58 MALI_STATIC_INLINE struct mali_l2_cache_core *mali_pm_domain_l2_get(struct mali_pm_domain *domain)
63 MALI_STATIC_INLINE mali_pm_domain_state mali_pm_domain_state_get(struct mali_pm_domain *domain)
68 mali_bool mali_pm_domain_lock_state(struct mali_pm_domain *domain);
69 void mali_pm_domain_unlock_state(struct mali_pm_domain *domain);
71 #define MALI_PM_DOMAIN_FOR_EACH_GROUP(group, domain) for ((group) = (domain)->group_list;\
72 NULL != (group); (group) = (group)->pm_domain_list)
74 #endif /* __MALI_PM_DOMAIN_H__ */