MALI: utgard: upgrade DDK to r7p0-00rel0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / common / mali_osk_mali.h
1 /*
2  * Copyright (C) 2010-2016 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_osk_mali.h
13  * Defines the OS abstraction layer which is specific for the Mali kernel device driver (OSK)
14  */
15
16 #ifndef __MALI_OSK_MALI_H__
17 #define __MALI_OSK_MALI_H__
18
19 #include <linux/mali/mali_utgard.h>
20 #include <mali_osk.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #ifdef CONFIG_MALI_DEVFREQ
27 struct mali_device {
28         struct device *dev;
29 #ifdef CONFIG_HAVE_CLK
30         struct clk *clock;
31 #endif
32 #ifdef CONFIG_REGULATOR
33         struct regulator *regulator;
34 #endif
35 #ifdef CONFIG_PM_DEVFREQ
36         struct devfreq_dev_profile devfreq_profile;
37         struct devfreq *devfreq;
38         unsigned long current_freq;
39         unsigned long current_voltage;
40 #ifdef CONFIG_DEVFREQ_THERMAL
41         struct thermal_cooling_device *devfreq_cooling;
42 #endif
43 #endif
44         struct mali_pm_metrics_data mali_metrics;
45 };
46 #endif
47
48 /** @addtogroup _mali_osk_miscellaneous
49  * @{ */
50
51 /** @brief Struct with device specific configuration data
52  */
53 typedef struct mali_gpu_device_data _mali_osk_device_data;
54
55 #ifdef CONFIG_MALI_DT
56 /** @brief Initialize those device resources when we use device tree
57  *
58  * @return _MALI_OSK_ERR_OK on success, otherwise failure.
59  */
60 _mali_osk_errcode_t _mali_osk_resource_initialize(void);
61 #endif
62
63 /** @brief Find Mali GPU HW resource
64  *
65  * @param addr Address of Mali GPU resource to find
66  * @param res Storage for resource information if resource is found.
67  * @return _MALI_OSK_ERR_OK on success, _MALI_OSK_ERR_ITEM_NOT_FOUND if resource is not found
68  */
69 _mali_osk_errcode_t _mali_osk_resource_find(u32 addr, _mali_osk_resource_t *res);
70
71
72 /** @brief Find Mali GPU HW base address
73  *
74  * @return 0 if resources are found, otherwise the Mali GPU component with lowest address.
75  */
76 uintptr_t _mali_osk_resource_base_address(void);
77
78 /** @brief Find the specific GPU resource.
79  *
80  * @return value
81  * 0x400 if Mali 400 specific GPU resource identified
82  * 0x450 if Mali 450 specific GPU resource identified
83  * 0x470 if Mali 470 specific GPU resource identified
84  *
85  */
86 u32 _mali_osk_identify_gpu_resource(void);
87
88 /** @brief Retrieve the Mali GPU specific data
89  *
90  * @return _MALI_OSK_ERR_OK on success, otherwise failure.
91  */
92 _mali_osk_errcode_t _mali_osk_device_data_get(_mali_osk_device_data *data);
93
94 /** @brief Find the pmu domain config from device data.
95  *
96  * @param domain_config_array used to store pmu domain config found in device data.
97  * @param array_size is the size of array domain_config_array.
98  */
99 void _mali_osk_device_data_pmu_config_get(u16 *domain_config_array, int array_size);
100
101 /** @brief Get Mali PMU switch delay
102  *
103  *@return pmu switch delay if it is configured
104  */
105 u32 _mali_osk_get_pmu_switch_delay(void);
106
107 /** @brief Determines if Mali GPU has been configured with shared interrupts.
108  *
109  * @return MALI_TRUE if shared interrupts, MALI_FALSE if not.
110  */
111 mali_bool _mali_osk_shared_interrupts(void);
112
113 /** @brief Initialize the gpu secure mode.
114  * The gpu secure mode will initially be in a disabled state.
115  * @return _MALI_OSK_ERR_OK on success, otherwise failure.
116  */
117 _mali_osk_errcode_t _mali_osk_gpu_secure_mode_init(void);
118
119 /** @brief Deinitialize the gpu secure mode.
120  * @return _MALI_OSK_ERR_OK on success, otherwise failure.
121  */
122 _mali_osk_errcode_t _mali_osk_gpu_secure_mode_deinit(void);
123
124 /** @brief Reset GPU and enable the gpu secure mode.
125  * @return _MALI_OSK_ERR_OK on success, otherwise failure.
126  */
127 _mali_osk_errcode_t _mali_osk_gpu_reset_and_secure_mode_enable(void);
128
129 /** @brief Reset GPU and disable the gpu secure mode.
130  * @return _MALI_OSK_ERR_OK on success, otherwise failure.
131  */
132 _mali_osk_errcode_t _mali_osk_gpu_reset_and_secure_mode_disable(void);
133
134 /** @brief Check if the gpu secure mode has been enabled.
135  * @return MALI_TRUE if enabled, otherwise MALI_FALSE.
136  */
137 mali_bool _mali_osk_gpu_secure_mode_is_enabled(void);
138
139 /** @brief Check if the gpu secure mode is supported.
140  * @return MALI_TRUE if supported, otherwise MALI_FALSE.
141  */
142 mali_bool _mali_osk_gpu_secure_mode_is_supported(void);
143
144
145 /** @} */ /* end group _mali_osk_miscellaneous */
146
147 #ifdef __cplusplus
148 }
149 #endif
150
151 #endif /* __MALI_OSK_MALI_H__ */