bbf837f7afa9ecb5af6a3919b49c633664f768ae
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / platform / rk30 / mali_dvfs.h
1 /*
2  * Rockchip SoC Mali-450 DVFS driver
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software FoundatIon.
7  */
8 #include <linux/workqueue.h>
9 #include <linux/types.h>
10 #include <linux/device.h>
11
12 #ifndef _MALI_DVFS_H_
13 #define _MALI_DVFS_H_
14
15
16 /**
17  * mali_dvfs_context_t, context of mali_dvfs_facility.
18  */
19 struct mali_dvfs {
20         /**
21          * work_to_handle_mali_utilization_event.
22          */
23         struct work_struct work;
24         /**
25          * current_mali_utilization.
26          */
27         unsigned int utilisation;
28         /**
29          * index_of_current_dvfs_level.
30          * current_dvfs_level 在 available_dvfs_level_list 中的 index.
31          */
32         unsigned int current_level;
33
34         /**
35          * mali_dvfs_facility 是否被使能.
36          */
37         bool enabled;
38
39         /**
40          * count_of_continuous_requests_to_jump_up_in_dvfs_level_table.
41          * 对 "连续" 的 requests_to_jump_up_in_dvfs_level_table 计数.
42          */
43         unsigned int m_count_of_requests_to_jump_up;
44
45         /**
46          * count_of_continuous_requests_to_jump_down_in_dvfs_level_table.
47          * 对 "连续" 的 requests_to_jump_down_in_dvfs_level_table 计数.
48          */
49         unsigned int m_count_of_requests_to_jump_down;
50 };
51
52 int mali_dvfs_init(struct device *dev);
53
54 void mali_dvfs_term(struct device *dev);
55
56 bool mali_dvfs_is_enabled(struct device *dev);
57
58 void mali_dvfs_enable(struct device *dev);
59
60 void mali_dvfs_disable(struct device *dev);
61
62 unsigned int mali_dvfs_utilisation(struct device *dev);
63
64 int mali_dvfs_event(struct device *dev, u32 utilisation);
65
66 #endif          /*_MALI_DVFS_H_*/