update r7p0 ddk for mali450
[GitHub/LineageOS/G12/android_hardware_amlogic_kernel-modules_mali-driver.git] / t83x / kernel / drivers / gpu / arm / midgard / backend / gpu / mali_kbase_pm_coarse_demand.c
CommitLineData
d25bc64b
JY
1/*
2 *
51f89798 3 * (C) COPYRIGHT 2012-2016 ARM Limited. All rights reserved.
d25bc64b
JY
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 * "Coarse Demand" power management policy
22 */
23
24#include <mali_kbase.h>
25#include <mali_kbase_pm.h>
26
27static u64 coarse_demand_get_core_mask(struct kbase_device *kbdev)
28{
29 if (kbdev->pm.active_count == 0)
30 return 0;
31
32 return kbdev->gpu_props.props.raw_props.shader_present;
33}
34
35static bool coarse_demand_get_core_active(struct kbase_device *kbdev)
36{
37 if (0 == kbdev->pm.active_count && !(kbdev->shader_needed_bitmap |
51f89798
JY
38 kbdev->shader_inuse_bitmap) && !kbdev->tiler_needed_cnt
39 && !kbdev->tiler_inuse_cnt)
d25bc64b
JY
40 return false;
41
42 return true;
43}
44
45static void coarse_demand_init(struct kbase_device *kbdev)
46{
47 CSTD_UNUSED(kbdev);
48}
49
50static void coarse_demand_term(struct kbase_device *kbdev)
51{
52 CSTD_UNUSED(kbdev);
53}
54
55/* The struct kbase_pm_policy structure for the demand power policy.
56 *
57 * This is the static structure that defines the demand power policy's callback
58 * and name.
59 */
60const struct kbase_pm_policy kbase_pm_coarse_demand_policy_ops = {
61 "coarse_demand", /* name */
62 coarse_demand_init, /* init */
63 coarse_demand_term, /* term */
64 coarse_demand_get_core_mask, /* get_core_mask */
65 coarse_demand_get_core_active, /* get_core_active */
66 0u, /* flags */
67 KBASE_PM_POLICY_ID_COARSE_DEMAND, /* id */
68};
69
70KBASE_EXPORT_TEST_API(kbase_pm_coarse_demand_policy_ops);