2 * Copyright (C) 2011-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.
12 * @file mali_platform.h
13 * Platform specific Mali driver functions
16 #ifndef __MALI_PLATFORM_H__
17 #define __MALI_PLATFORM_H__
21 #ifdef CONFIG_CPU_EXYNOS4210
22 #define MALI_DVFS_STEPS 2
24 #define MALI_DVFS_STEPS 5
27 /* @Enable or Disable Mali GPU Bottom Lock feature */
28 #define MALI_GPU_BOTTOM_LOCK 1
30 #define MALI_VOLTAGE_LOCK 1
32 /* @Enable or Disable the CPU frequency lock when the GPU clock is 440 Mhz */
33 #define CPUFREQ_LOCK_DURING_440 0
39 /** @brief description of power change reasons
41 typedef enum mali_power_mode_tag
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 */
48 /** @brief Platform specific setup and initialisation of MALI
50 * This is called from the entrypoint of the driver to initialize the platform
52 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
54 _mali_osk_errcode_t mali_platform_init(void);
56 /** @brief Platform specific deinitialisation of MALI
58 * This is called on the exit of the driver to terminate the platform
60 * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
62 _mali_osk_errcode_t mali_platform_deinit(void);
64 /** @brief Platform specific powerdown sequence of MALI
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.
71 _mali_osk_errcode_t mali_platform_power_mode_change(mali_power_mode power_mode);
74 /** @brief Platform specific handling of GPU utilization data
76 * When GPU utilization data is enabled, this function will be
77 * periodically called.
79 * @param utilization The workload utilization of the Mali GPU. 0 = no utilization, 256 = full utilization.
81 void mali_gpu_utilization_handler(u32 utilization);
83 /** @brief Setting the power domain of MALI
85 * This function sets the power domain of MALI if Linux run time power management is enabled
87 * @param dev Reference to struct platform_device (defined in linux) used by MALI GPU
89 //void set_mali_parent_power_domain(void* dev);
90 void mali_utilization_suspend(void);
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);
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);
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);
109 #if MALI_POWER_MGMT_TEST_SUITE
110 /** @brief function to get status of individual cores
112 * This function is used by power management test suite to get the status of powered up/down the number
114 * @param utilization The workload utilization of the Mali GPU. 0 = no utilization, 256 = full utilization.
116 u32 pmu_get_power_up_down_info(void);
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);
136 int mali_dvfs_bottom_lock_push(int lock_step);
137 int mali_dvfs_bottom_lock_pop(void);
141 int mali_dvfs_get_vol(int step);
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);