3 * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved.
5 * This program is free software and is provided to you under the terms of the
6 * GNU General Public License version 2 as published by the Free Software
7 * Foundation, and any use by you of this program is subject to the terms
10 * A copy of the licence is included with the program, and can also be obtained
11 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12 * Boston, MA 02110-1301, USA.
20 * @file mali_kbase_hwaccess_pm.h
21 * HW access power manager common APIs
24 #ifndef _KBASE_HWACCESS_PM_H_
25 #define _KBASE_HWACCESS_PM_H_
27 #include <mali_midg_regmap.h>
28 #include <linux/atomic.h>
30 #include <mali_kbase_pm_defs.h>
32 /* Forward definition - see mali_kbase.h */
35 /* Functions common to all HW access backends */
38 * Initialize the power management framework.
40 * Must be called before any other power management function
42 * @param kbdev The kbase device structure for the device (must be a valid
45 * @return 0 if the power management framework was successfully
48 int kbase_hwaccess_pm_init(struct kbase_device *kbdev);
51 * Terminate the power management framework.
53 * No power management functions may be called after this (except
56 * @param kbdev The kbase device structure for the device (must be a valid
59 void kbase_hwaccess_pm_term(struct kbase_device *kbdev);
62 * kbase_hwaccess_pm_powerup - Power up the GPU.
63 * @kbdev: The kbase device structure for the device (must be a valid pointer)
64 * @flags: Flags to pass on to kbase_pm_init_hw
66 * Power up GPU after all modules have been initialized and interrupt handlers
69 * Return: 0 if powerup was successful.
71 int kbase_hwaccess_pm_powerup(struct kbase_device *kbdev,
75 * Halt the power management framework.
77 * Should ensure that no new interrupts are generated, but allow any currently
78 * running interrupt handlers to complete successfully. The GPU is forced off by
79 * the time this function returns, regardless of whether or not the active power
80 * policy asks for the GPU to be powered off.
82 * @param kbdev The kbase device structure for the device (must be a valid
85 void kbase_hwaccess_pm_halt(struct kbase_device *kbdev);
88 * Perform any backend-specific actions to suspend the GPU
90 * @param kbdev The kbase device structure for the device (must be a valid
93 void kbase_hwaccess_pm_suspend(struct kbase_device *kbdev);
96 * Perform any backend-specific actions to resume the GPU from a suspend
98 * @param kbdev The kbase device structure for the device (must be a valid
101 void kbase_hwaccess_pm_resume(struct kbase_device *kbdev);
104 * Perform any required actions for activating the GPU. Called when the first
105 * context goes active.
107 * @param kbdev The kbase device structure for the device (must be a valid
110 void kbase_hwaccess_pm_gpu_active(struct kbase_device *kbdev);
113 * Perform any required actions for idling the GPU. Called when the last
116 * @param kbdev The kbase device structure for the device (must be a valid
119 void kbase_hwaccess_pm_gpu_idle(struct kbase_device *kbdev);
123 * Set the debug core mask.
125 * This determines which cores the power manager is allowed to use.
127 * @param kbdev The kbase device structure for the device (must be a
129 * @param new_core_mask_js0 The core mask to use for job slot 0
130 * @param new_core_mask_js0 The core mask to use for job slot 1
131 * @param new_core_mask_js0 The core mask to use for job slot 2
133 void kbase_pm_set_debug_core_mask(struct kbase_device *kbdev,
134 u64 new_core_mask_js0, u64 new_core_mask_js1,
135 u64 new_core_mask_js2);
139 * Get the current policy.
141 * Returns the policy that is currently active.
143 * @param kbdev The kbase device structure for the device (must be a valid
146 * @return The current policy
148 const struct kbase_pm_ca_policy
149 *kbase_pm_ca_get_policy(struct kbase_device *kbdev);
152 * Change the policy to the one specified.
154 * @param kbdev The kbase device structure for the device (must be a valid
156 * @param policy The policy to change to (valid pointer returned from
157 * @ref kbase_pm_ca_list_policies)
159 void kbase_pm_ca_set_policy(struct kbase_device *kbdev,
160 const struct kbase_pm_ca_policy *policy);
163 * Retrieve a static list of the available policies.
165 * @param[out] policies An array pointer to take the list of policies. This may
166 * be NULL. The contents of this array must not be
169 * @return The number of policies
172 kbase_pm_ca_list_policies(const struct kbase_pm_ca_policy * const **policies);
176 * Get the current policy.
178 * Returns the policy that is currently active.
180 * @param kbdev The kbase device structure for the device (must be a valid
183 * @return The current policy
185 const struct kbase_pm_policy *kbase_pm_get_policy(struct kbase_device *kbdev);
188 * Change the policy to the one specified.
190 * @param kbdev The kbase device structure for the device (must be a valid
192 * @param policy The policy to change to (valid pointer returned from
193 * @ref kbase_pm_list_policies)
195 void kbase_pm_set_policy(struct kbase_device *kbdev,
196 const struct kbase_pm_policy *policy);
199 * Retrieve a static list of the available policies.
201 * @param[out] policies An array pointer to take the list of policies. This may
202 * be NULL. The contents of this array must not be
205 * @return The number of policies
207 int kbase_pm_list_policies(const struct kbase_pm_policy * const **policies);
209 #endif /* _KBASE_HWACCESS_PM_H_ */