tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / r4p0_rel0 / platform / pegasus-m400 / exynos4_pmm.h
1 /* drivers/gpu/mali400/mali/platform/pegasus-m400/exynos4_pmm.h
2  *
3  * Copyright 2011 by S.LSI. Samsung Electronics Inc.
4  * San#24, Nongseo-Dong, Giheung-Gu, Yongin, Korea
5  *
6  * Samsung SoC Mali400 DVFS driver
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software FoundatIon.
11  */
12
13 /**
14  * @file exynos4_pmm.h
15  * Platform specific Mali driver functions for the exynos 4XXX based platforms
16  */
17
18 #ifndef __EXYNOS4_PMM_H__
19 #define __EXYNOS4_PMM_H__
20
21 #include "mali_utgard.h"
22 #include "mali_osk.h"
23 #include <linux/platform_device.h>
24 /* @Enable or Disable Mali GPU Bottom Lock feature */
25 #define MALI_GPU_BOTTOM_LOCK 1
26 #define MALI_VOLTAGE_LOCK 1
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /** @brief description of power change reasons
33  */
34 typedef enum mali_power_mode_tag
35 {
36         MALI_POWER_MODE_ON,
37         MALI_POWER_MODE_LIGHT_SLEEP,
38         MALI_POWER_MODE_DEEP_SLEEP,
39 } mali_power_mode;
40
41 /** @brief Platform specific setup and initialisation of MALI
42  *
43  * This is called from the entrypoint of the driver to initialize the platform
44  *
45  * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
46  */
47 _mali_osk_errcode_t mali_platform_init(struct device *dev);
48
49 /** @brief Platform specific deinitialisation of MALI
50  *
51  * This is called on the exit of the driver to terminate the platform
52  *
53  * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
54  */
55 _mali_osk_errcode_t mali_platform_deinit(struct device *dev);
56
57 /** @brief Platform specific powerdown sequence of MALI
58  *
59  * Call as part of platform init if there is no PMM support, else the
60  * PMM will call it.
61  * There are three power modes defined:
62  *  1) MALI_POWER_MODE_ON
63  *  2) MALI_POWER_MODE_LIGHT_SLEEP
64  *  3) MALI_POWER_MODE_DEEP_SLEEP
65  * MALI power management module transitions to MALI_POWER_MODE_LIGHT_SLEEP mode when MALI is idle
66  * for idle timer (software timer defined in mali_pmm_policy_jobcontrol.h) duration, MALI transitions
67  * to MALI_POWER_MODE_LIGHT_SLEEP mode during timeout if there are no more jobs queued.
68  * MALI power management module transitions to MALI_POWER_MODE_DEEP_SLEEP mode when OS does system power
69  * off.
70  * Customer has to add power down code when MALI transitions to MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP
71  * mode.
72  * MALI_POWER_MODE_ON mode is entered when the MALI is to powered up. Some customers want to control voltage regulators during
73  * the whole system powers on/off. Customer can track in this function whether the MALI is powered up from
74  * MALI_POWER_MODE_LIGHT_SLEEP or MALI_POWER_MODE_DEEP_SLEEP mode and manage the voltage regulators as well.
75  * @param power_mode defines the power modes
76  * @return _MALI_OSK_ERR_OK on success otherwise, a suitable _mali_osk_errcode_t error.
77  */
78 _mali_osk_errcode_t mali_platform_power_mode_change(struct device *dev, mali_power_mode power_mode);
79
80
81 /** @brief Platform specific handling of GPU utilization data
82  *
83  * When GPU utilization data is enabled, this function will be
84  * periodically called.
85  *
86  * @param utilization The workload utilization of the Mali GPU. 0 = no utilization, 256 = full utilization.
87  */
88 void mali_gpu_utilization_handler(struct mali_gpu_utilization_data *data);
89
90 _mali_osk_errcode_t g3d_power_domain_control(int bpower_on);
91
92 #ifdef CONFIG_REGULATOR
93 void mali_regulator_disable(void);
94 void mali_regulator_enable(void);
95 void mali_regulator_set_voltage(int min_uV, int max_uV);
96 #endif
97
98 #ifdef CONFIG_MALI_DVFS
99 ssize_t show_time_in_state(struct device *dev, struct device_attribute *attr, char *buf);
100 ssize_t set_time_in_state(struct device *dev, struct device_attribute *attr, const char *buf, size_t count);
101 #ifdef CONFIG_CPU_EXYNOS4210
102 #if MALI_GPU_BOTTOM_LOCK
103 int mali_dvfs_bottom_lock_push(void);
104 int mali_dvfs_bottom_lock_pop(void);
105 #endif
106 #else
107 int mali_dvfs_bottom_lock_push(int lock_step);
108 int mali_dvfs_bottom_lock_pop(void);
109 #endif
110 #endif
111
112 #if MALI_VOLTAGE_LOCK
113 int mali_voltage_lock_push(int lock_vol);
114 int mali_voltage_lock_pop(void);
115 int mali_voltage_lock_init(void);
116 int mali_vol_get_from_table(int vol);
117 #endif
118 #ifdef __cplusplus
119 }
120 #endif
121 #endif