e252859ee07c2c133941b2abfab96db0afeeff1f
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / t6xx / kbase / src / common / mali_kbase_pm_coarse_demand.c
1 /*
2  *
3  * (C) COPYRIGHT ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the
6  * GNU General Public License version 2 as published by the Free Software
7  * Foundation, and any use by you of this program is subject to the terms
8  * of such GNU licence.
9  *
10  * A copy of the licence is included with the program, and can also be obtained
11  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12  * Boston, MA  02110-1301, USA.
13  *
14  */
15
16
17
18
19
20 /**
21  * @file mali_kbase_pm_coarse_demand.c
22  * "Coarse Demand" power management policy
23  */
24
25 #include <kbase/src/common/mali_kbase.h>
26 #include <kbase/src/common/mali_kbase_pm.h>
27
28 static u64 coarse_demand_get_core_mask(struct kbase_device *kbdev)
29 {
30         if (kbdev->pm.active_count == 0)
31                 return 0;
32
33         return kbdev->shader_present_bitmap;
34 }
35
36 static mali_bool coarse_demand_get_core_active(struct kbase_device *kbdev)
37 {
38         if (kbdev->pm.active_count == 0)
39                 return MALI_FALSE;
40
41         return MALI_TRUE;
42 }
43
44 static void coarse_demand_init(struct kbase_device *kbdev)
45 {
46         CSTD_UNUSED(kbdev);
47 }
48
49 static void coarse_demand_term(struct kbase_device *kbdev)
50 {
51         CSTD_UNUSED(kbdev);
52 }
53
54 /** The @ref kbase_pm_policy structure for the demand power policy.
55  *
56  * This is the static structure that defines the demand power policy's callback and name.
57  */
58 const kbase_pm_policy kbase_pm_coarse_demand_policy_ops = {
59         "coarse_demand",                        /* name */
60         coarse_demand_init,                     /* init */
61         coarse_demand_term,                     /* term */
62         coarse_demand_get_core_mask,            /* get_core_mask */
63         coarse_demand_get_core_active,          /* get_core_active */
64         0u,                                     /* flags */
65         KBASE_PM_POLICY_ID_COARSE_DEMAND,       /* id */
66 };
67
68 KBASE_EXPORT_TEST_API(kbase_pm_coarse_demand_policy_ops)