summaryrefslogtreecommitdiff
path: root/mali-midgard-16.0/mali_kbase_hwaccess_pm.h
blob: 71c7d495c40ab924f6ec9fe01ffd2fd9d1263fd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
 *
 * (C) COPYRIGHT 2014-2015 ARM Limited. All rights reserved.
 *
 * This program is free software and is provided to you under the terms of the
 * GNU General Public License version 2 as published by the Free Software
 * Foundation, and any use by you of this program is subject to the terms
 * of such GNU licence.
 *
 * A copy of the licence is included with the program, and can also be obtained
 * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 *
 */




/**
 * @file mali_kbase_hwaccess_pm.h
 * HW access power manager common APIs
 */

#ifndef _KBASE_HWACCESS_PM_H_
#define _KBASE_HWACCESS_PM_H_

#include <mali_midg_regmap.h>
#include <linux/atomic.h>

#include <mali_kbase_pm_defs.h>

/* Forward definition - see mali_kbase.h */
struct kbase_device;

/* Functions common to all HW access backends */

/**
 * Initialize the power management framework.
 *
 * Must be called before any other power management function
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 *
 * @return 0 if the power management framework was successfully
 *         initialized.
 */
int kbase_hwaccess_pm_init(struct kbase_device *kbdev);

/**
 * Terminate the power management framework.
 *
 * No power management functions may be called after this (except
 * @ref kbase_pm_init)
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 */
void kbase_hwaccess_pm_term(struct kbase_device *kbdev);

/**
 * kbase_hwaccess_pm_powerup - Power up the GPU.
 * @kbdev: The kbase device structure for the device (must be a valid pointer)
 * @flags: Flags to pass on to kbase_pm_init_hw
 *
 * Power up GPU after all modules have been initialized and interrupt handlers
 * installed.
 *
 * Return: 0 if powerup was successful.
 */
int kbase_hwaccess_pm_powerup(struct kbase_device *kbdev,
		unsigned int flags);

/**
 * Halt the power management framework.
 *
 * Should ensure that no new interrupts are generated, but allow any currently
 * running interrupt handlers to complete successfully. The GPU is forced off by
 * the time this function returns, regardless of whether or not the active power
 * policy asks for the GPU to be powered off.
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 */
void kbase_hwaccess_pm_halt(struct kbase_device *kbdev);

/**
 * Perform any backend-specific actions to suspend the GPU
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 */
void kbase_hwaccess_pm_suspend(struct kbase_device *kbdev);

/**
 * Perform any backend-specific actions to resume the GPU from a suspend
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 */
void kbase_hwaccess_pm_resume(struct kbase_device *kbdev);

/**
 * Perform any required actions for activating the GPU. Called when the first
 * context goes active.
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 */
void kbase_hwaccess_pm_gpu_active(struct kbase_device *kbdev);

/**
 * Perform any required actions for idling the GPU. Called when the last
 * context goes idle.
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 */
void kbase_hwaccess_pm_gpu_idle(struct kbase_device *kbdev);


/**
 * Set the debug core mask.
 *
 * This determines which cores the power manager is allowed to use.
 *
 * @param kbdev         The kbase device structure for the device (must be a
 *                      valid pointer)
 * @param new_core_mask_js0 The core mask to use for job slot 0
 * @param new_core_mask_js0 The core mask to use for job slot 1
 * @param new_core_mask_js0 The core mask to use for job slot 2
 */
void kbase_pm_set_debug_core_mask(struct kbase_device *kbdev,
		u64 new_core_mask_js0, u64 new_core_mask_js1,
		u64 new_core_mask_js2);


/**
 * Get the current policy.
 *
 * Returns the policy that is currently active.
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 *
 * @return The current policy
 */
const struct kbase_pm_ca_policy
*kbase_pm_ca_get_policy(struct kbase_device *kbdev);

/**
 * Change the policy to the one specified.
 *
 * @param kbdev  The kbase device structure for the device (must be a valid
 *               pointer)
 * @param policy The policy to change to (valid pointer returned from
 *               @ref kbase_pm_ca_list_policies)
 */
void kbase_pm_ca_set_policy(struct kbase_device *kbdev,
				const struct kbase_pm_ca_policy *policy);

/**
 * Retrieve a static list of the available policies.
 *
 * @param[out] policies An array pointer to take the list of policies. This may
 *                      be NULL. The contents of this array must not be
 *                      modified.
 *
 * @return The number of policies
 */
int
kbase_pm_ca_list_policies(const struct kbase_pm_ca_policy * const **policies);


/**
 * Get the current policy.
 *
 * Returns the policy that is currently active.
 *
 * @param kbdev The kbase device structure for the device (must be a valid
 *              pointer)
 *
 * @return The current policy
 */
const struct kbase_pm_policy *kbase_pm_get_policy(struct kbase_device *kbdev);

/**
 * Change the policy to the one specified.
 *
 * @param kbdev  The kbase device structure for the device (must be a valid
 *               pointer)
 * @param policy The policy to change to (valid pointer returned from
 *               @ref kbase_pm_list_policies)
 */
void kbase_pm_set_policy(struct kbase_device *kbdev,
					const struct kbase_pm_policy *policy);

/**
 * Retrieve a static list of the available policies.
 *
 * @param[out] policies An array pointer to take the list of policies. This may
 *                      be NULL. The contents of this array must not be
 *                      modified.
 *
 * @return The number of policies
 */
int kbase_pm_list_policies(const struct kbase_pm_policy * const **policies);

#endif /* _KBASE_HWACCESS_PM_H_ */