tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / platform / mali_platform.h
1 /*
2  * Copyright (C) 2011-2012 ARM Limited. All rights reserved.
3  *
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.
6  *
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.
9  */
10
11 /**
12  * @file mali_platform.h
13  * Platform specific Mali driver functions
14  */
15
16 #ifndef __MALI_PLATFORM_H__
17 #define __MALI_PLATFORM_H__
18
19 #include "mali_osk.h"
20
21 #ifdef CONFIG_CPU_EXYNOS4210
22 #define MALI_DVFS_STEPS 2
23 #else
24 #define MALI_DVFS_STEPS 5
25 #endif
26
27 /* @Enable or Disable Mali GPU Bottom Lock feature */
28 #define MALI_GPU_BOTTOM_LOCK 1
29
30 #define MALI_VOLTAGE_LOCK 1
31
32 /* @Enable or Disable the CPU frequency lock when the GPU clock is 440 Mhz */
33 #define CPUFREQ_LOCK_DURING_440 0
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /** @brief description of power change reasons
40  */
41 typedef enum mali_power_mode_tag
42 {
43         MALI_POWER_MODE_ON,           /**< Power Mali on */
44         MALI_POWER_MODE_LIGHT_SLEEP,  /**< Mali has been idle for a short time, or runtime PM suspend */
45         MALI_POWER_MODE_DEEP_SLEEP,   /**< Mali has been idle for a long time, or OS suspend */
46 } mali_power_mode;
47
48 /** @brief Platform specific setup and initialisation of MALI
49  *
50  * This is called from the entrypoint of the driver to initialize the platform
51  *
52  * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
53  */
54 _mali_osk_errcode_t mali_platform_init(void);
55
56 /** @brief Platform specific deinitialisation of MALI
57  *
58  * This is called on the exit of the driver to terminate the platform
59  *
60  * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
61  */
62 _mali_osk_errcode_t mali_platform_deinit(void);
63
64 /** @brief Platform specific powerdown sequence of MALI
65  *
66  * Notification from the Mali device driver stating the new desired power mode.
67  * MALI_POWER_MODE_ON must be obeyed, while the other modes are optional.
68  * @param power_mode defines the power modes
69  * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
70  */
71 _mali_osk_errcode_t mali_platform_power_mode_change(mali_power_mode power_mode);
72
73
74 /** @brief Platform specific handling of GPU utilization data
75  *
76  * When GPU utilization data is enabled, this function will be
77  * periodically called.
78  *
79  * @param utilization The workload utilization of the Mali GPU. 0 = no utilization, 256 = full utilization.
80  */
81 void mali_gpu_utilization_handler(u32 utilization);
82
83 /** @brief Setting the power domain of MALI
84  *
85  * This function sets the power domain of MALI if Linux run time power management is enabled
86  *
87  * @param dev Reference to struct platform_device (defined in linux) used by MALI GPU
88  */
89 //void set_mali_parent_power_domain(void* dev);
90 void mali_utilization_suspend(void);
91
92 #ifdef CONFIG_REGULATOR
93 int mali_regulator_get_usecount(void);
94 void mali_regulator_disable(void);
95 void mali_regulator_enable(void);
96 void mali_regulator_set_voltage(int min_uV, int max_uV);
97 #endif
98 mali_bool mali_clk_set_rate(unsigned int clk, unsigned int mhz);
99 unsigned long mali_clk_get_rate(void);
100 void mali_clk_put(mali_bool binc_mali_clk);
101
102 #if MALI_PMM_RUNTIME_JOB_CONTROL_ON
103 _mali_osk_errcode_t mali_platform_powerdown(u32 cores);
104 _mali_osk_errcode_t mali_platform_powerup(u32 cores);
105 #endif
106
107
108 #if USING_MALI_PMM
109 #if MALI_POWER_MGMT_TEST_SUITE
110 /** @brief function to get status of individual cores
111  *
112  * This function is used by power management test suite to get the status of powered up/down the number
113  * of cores
114  * @param utilization The workload utilization of the Mali GPU. 0 = no utilization, 256 = full utilization.
115  */
116 u32 pmu_get_power_up_down_info(void);
117 #endif
118 #endif
119
120 #if MALI_DVFS_ENABLED
121 mali_bool init_mali_dvfs_status(int step);
122 void deinit_mali_dvfs_status(void);
123 mali_bool mali_dvfs_handler(u32 utilization);
124 int mali_dvfs_is_running(void);
125 void mali_dvfs_late_resume(void);
126 int get_mali_dvfs_control_status(void);
127 mali_bool set_mali_dvfs_current_step(unsigned int step);
128 void mali_default_step_set(int step, mali_bool boostup);
129 int change_dvfs_tableset(int change_clk, int change_step);
130 #ifdef CONFIG_CPU_EXYNOS4210
131 #if MALI_GPU_BOTTOM_LOCK
132 int mali_dvfs_bottom_lock_push(void);
133 int mali_dvfs_bottom_lock_pop(void);
134 #endif
135 #else
136 int mali_dvfs_bottom_lock_push(int lock_step);
137 int mali_dvfs_bottom_lock_pop(void);
138 #endif
139 #endif
140
141 int mali_dvfs_get_vol(int step);
142
143 #if MALI_VOLTAGE_LOCK
144 int mali_voltage_lock_push(int lock_vol);
145 int mali_voltage_lock_pop(void);
146 int mali_voltage_lock_init(void);
147 int mali_vol_get_from_table(int vol);
148 #endif
149
150 #ifdef __cplusplus
151 }
152 #endif
153 #endif