2 * Copyright (C) 2010-2016 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_osk_mali.h
13 * Defines the OS abstraction layer which is specific for the Mali kernel device driver (OSK)
16 #ifndef __MALI_OSK_MALI_H__
17 #define __MALI_OSK_MALI_H__
19 #include <linux/mali/mali_utgard.h>
26 #ifdef CONFIG_MALI_DEVFREQ
29 #ifdef CONFIG_HAVE_CLK
32 #ifdef CONFIG_REGULATOR
33 struct regulator *regulator;
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;
44 struct mali_pm_metrics_data mali_metrics;
48 /** @addtogroup _mali_osk_miscellaneous
51 /** @brief Struct with device specific configuration data
53 typedef struct mali_gpu_device_data _mali_osk_device_data;
56 /** @brief Initialize those device resources when we use device tree
58 * @return _MALI_OSK_ERR_OK on success, otherwise failure.
60 _mali_osk_errcode_t _mali_osk_resource_initialize(void);
63 /** @brief Find Mali GPU HW resource
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
69 _mali_osk_errcode_t _mali_osk_resource_find(u32 addr, _mali_osk_resource_t *res);
72 /** @brief Find Mali GPU HW base address
74 * @return 0 if resources are found, otherwise the Mali GPU component with lowest address.
76 uintptr_t _mali_osk_resource_base_address(void);
78 /** @brief Find the specific GPU resource.
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
86 u32 _mali_osk_identify_gpu_resource(void);
88 /** @brief Retrieve the Mali GPU specific data
90 * @return _MALI_OSK_ERR_OK on success, otherwise failure.
92 _mali_osk_errcode_t _mali_osk_device_data_get(_mali_osk_device_data *data);
94 /** @brief Find the pmu domain config from device data.
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.
99 void _mali_osk_device_data_pmu_config_get(u16 *domain_config_array, int array_size);
101 /** @brief Get Mali PMU switch delay
103 *@return pmu switch delay if it is configured
105 u32 _mali_osk_get_pmu_switch_delay(void);
107 /** @brief Determines if Mali GPU has been configured with shared interrupts.
109 * @return MALI_TRUE if shared interrupts, MALI_FALSE if not.
111 mali_bool _mali_osk_shared_interrupts(void);
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.
117 _mali_osk_errcode_t _mali_osk_gpu_secure_mode_init(void);
119 /** @brief Deinitialize the gpu secure mode.
120 * @return _MALI_OSK_ERR_OK on success, otherwise failure.
122 _mali_osk_errcode_t _mali_osk_gpu_secure_mode_deinit(void);
124 /** @brief Reset GPU and enable the gpu secure mode.
125 * @return _MALI_OSK_ERR_OK on success, otherwise failure.
127 _mali_osk_errcode_t _mali_osk_gpu_reset_and_secure_mode_enable(void);
129 /** @brief Reset GPU and disable the gpu secure mode.
130 * @return _MALI_OSK_ERR_OK on success, otherwise failure.
132 _mali_osk_errcode_t _mali_osk_gpu_reset_and_secure_mode_disable(void);
134 /** @brief Check if the gpu secure mode has been enabled.
135 * @return MALI_TRUE if enabled, otherwise MALI_FALSE.
137 mali_bool _mali_osk_gpu_secure_mode_is_enabled(void);
139 /** @brief Check if the gpu secure mode is supported.
140 * @return MALI_TRUE if supported, otherwise MALI_FALSE.
142 mali_bool _mali_osk_gpu_secure_mode_is_supported(void);
145 /** @} */ /* end group _mali_osk_miscellaneous */
151 #endif /* __MALI_OSK_MALI_H__ */