hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/drivers/gpu/arm/bifrost/mali_kbase_pm.h
....@@ -1,7 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 /*
33 *
4
- * (C) COPYRIGHT 2010-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2010-2022 ARM Limited. All rights reserved.
55 *
66 * This program is free software and is provided to you under the terms of the
77 * GNU General Public License version 2 as published by the Free Software
....@@ -20,7 +20,7 @@
2020 */
2121
2222 /**
23
- * Power management API definitions
23
+ * DOC: Power management API definitions
2424 */
2525
2626 #ifndef _KBASE_PM_H_
....@@ -39,29 +39,32 @@
3939 #define PM_NO_RESET 0x04
4040 #endif
4141
42
-/** Initialize the power management framework.
42
+/**
43
+ * kbase_pm_init - Initialize the power management framework.
44
+ *
45
+ * @kbdev: The kbase device structure for the device
46
+ * (must be a valid pointer)
4347 *
4448 * Must be called before any other power management function
4549 *
46
- * @param kbdev The kbase device structure for the device
47
- * (must be a valid pointer)
48
- *
49
- * @return 0 if the power management framework was successfully initialized.
50
+ * Return: 0 if the power management framework was successfully initialized.
5051 */
5152 int kbase_pm_init(struct kbase_device *kbdev);
5253
53
-/** Power up GPU after all modules have been initialized and interrupt handlers installed.
54
+/**
55
+ * kbase_pm_powerup - Power up GPU after all modules have been initialized
56
+ * and interrupt handlers installed.
5457 *
55
- * @param kbdev The kbase device structure for the device (must be a valid pointer)
58
+ * @kbdev: The kbase device structure for the device (must be a valid pointer)
59
+ * @flags: Flags to pass on to kbase_pm_init_hw
5660 *
57
- * @param flags Flags to pass on to kbase_pm_init_hw
58
- *
59
- * @return 0 if powerup was successful.
61
+ * Return: 0 if powerup was successful.
6062 */
6163 int kbase_pm_powerup(struct kbase_device *kbdev, unsigned int flags);
6264
6365 /**
64
- * Halt the power management framework.
66
+ * kbase_pm_halt - Halt the power management framework.
67
+ *
6568 * @kbdev: The kbase device structure for the device (must be a valid pointer)
6669 *
6770 * Should ensure that no new interrupts are generated,
....@@ -71,16 +74,20 @@
7174 */
7275 void kbase_pm_halt(struct kbase_device *kbdev);
7376
74
-/** Terminate the power management framework.
77
+/**
78
+ * kbase_pm_term - Terminate the power management framework.
79
+ *
80
+ * @kbdev: The kbase device structure for the device (must be a valid pointer)
7581 *
7682 * No power management functions may be called after this
7783 * (except @ref kbase_pm_init)
78
- *
79
- * @param kbdev The kbase device structure for the device (must be a valid pointer)
8084 */
8185 void kbase_pm_term(struct kbase_device *kbdev);
8286
83
-/** Increment the count of active contexts.
87
+/**
88
+ * kbase_pm_context_active - Increment the count of active contexts.
89
+ *
90
+ * @kbdev: The kbase device structure for the device (must be a valid pointer)
8491 *
8592 * This function should be called when a context is about to submit a job.
8693 * It informs the active power policy that the GPU is going to be in use shortly
....@@ -94,8 +101,6 @@
94101 * @note a Suspend is only visible to Kernel threads; user-space threads in a
95102 * syscall cannot witness a suspend, because they are frozen before the suspend
96103 * begins.
97
- *
98
- * @param kbdev The kbase device structure for the device (must be a valid pointer)
99104 */
100105 void kbase_pm_context_active(struct kbase_device *kbdev);
101106
....@@ -123,7 +128,11 @@
123128 #endif /* CONFIG_MALI_ARBITER_SUPPORT */
124129 };
125130
126
-/** Suspend 'safe' variant of kbase_pm_context_active()
131
+/**
132
+ * kbase_pm_context_active_handle_suspend - Suspend 'safe' variant of kbase_pm_context_active()
133
+ *
134
+ * @kbdev: The kbase device structure for the device (must be a valid pointer)
135
+ * @suspend_handler: The handler code for how to handle a suspend that might occur
127136 *
128137 * If a suspend is in progress, this allows for various different ways of
129138 * handling the suspend. Refer to @ref enum kbase_pm_suspend_handler for details.
....@@ -133,20 +142,18 @@
133142 * indicates a failure, the caller must abort whatever operation it was
134143 * attempting, and potentially queue it up for after the OS has resumed.
135144 *
136
- * @param kbdev The kbase device structure for the device (must be a valid pointer)
137
- * @param suspend_handler The handler code for how to handle a suspend that might occur
138
- * @return zero Indicates success
139
- * @return non-zero Indicates failure due to the system being suspending/suspended.
145
+ * Return: 0 on success, non-zero othrewise.
140146 */
141147 int kbase_pm_context_active_handle_suspend(struct kbase_device *kbdev, enum kbase_pm_suspend_handler suspend_handler);
142148
143
-/** Decrement the reference count of active contexts.
149
+/**
150
+ * kbase_pm_context_idle - Decrement the reference count of active contexts.
151
+ *
152
+ * @kbdev: The kbase device structure for the device (must be a valid pointer)
144153 *
145154 * This function should be called when a context becomes idle.
146155 * After this call the GPU may be turned off by the power policy so the calling
147156 * code should ensure that it does not access the GPU's registers.
148
- *
149
- * @param kbdev The kbase device structure for the device (must be a valid pointer)
150157 */
151158 void kbase_pm_context_idle(struct kbase_device *kbdev);
152159
....@@ -155,8 +162,9 @@
155162 */
156163
157164 /**
158
- * Suspend the GPU and prevent any further register accesses to it from Kernel
159
- * threads.
165
+ * kbase_pm_suspend - Suspend the GPU and prevent any further register accesses
166
+ * to it from Kernel threads.
167
+ *
160168 * @kbdev: The kbase device structure for the device (must be a valid pointer)
161169 *
162170 * This is called in response to an OS suspend event, and calls into the various
....@@ -165,12 +173,15 @@
165173 * @note the mechanisms used here rely on all user-space threads being frozen
166174 * by the OS before we suspend. Otherwise, an IOCTL could occur that powers up
167175 * the GPU e.g. via atom submission.
176
+ *
177
+ * Return: 0 on success.
168178 */
169
-void kbase_pm_suspend(struct kbase_device *kbdev);
179
+int kbase_pm_suspend(struct kbase_device *kbdev);
170180
171181 /**
172
- * Resume the GPU, allow register accesses to it, and resume running atoms on
173
- * the GPU.
182
+ * kbase_pm_resume - Resume the GPU, allow register accesses to it,
183
+ * and resume running atoms on the GPU.
184
+ *
174185 * @kbdev: The kbase device structure for the device (must be a valid pointer)
175186 *
176187 * This is called in response to an OS resume event, and calls into the various
....@@ -207,8 +218,10 @@
207218 * @note the mechanisms used here rely on all user-space threads being frozen
208219 * by the OS before we suspend. Otherwise, an IOCTL could occur that powers up
209220 * the GPU e.g. via atom submission.
221
+ *
222
+ * Return: 0 on success.
210223 */
211
-void kbase_pm_driver_suspend(struct kbase_device *kbdev);
224
+int kbase_pm_driver_suspend(struct kbase_device *kbdev);
212225
213226 /**
214227 * kbase_pm_driver_resume() - Put GPU and driver in resume