hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/arm/bifrost/mali_kbase_config.h
....@@ -1,7 +1,7 @@
11 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
22 /*
33 *
4
- * (C) COPYRIGHT 2010-2017, 2019-2021 ARM Limited. All rights reserved.
4
+ * (C) COPYRIGHT 2010-2017, 2019-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
....@@ -170,6 +170,12 @@
170170 * the clocks to the GPU, or to completely power down the GPU.
171171 * The platform specific private pointer kbase_device::platform_context can be accessed and modified in here. It is the
172172 * platform \em callbacks responsibility to initialize and terminate this pointer if used (see @ref kbase_platform_funcs_conf).
173
+ *
174
+ * If runtime PM is enabled and @power_runtime_gpu_idle_callback is used
175
+ * then this callback should power off the GPU (or switch off the clocks
176
+ * to GPU) immediately. If @power_runtime_gpu_idle_callback is not used,
177
+ * then this callback can set the autosuspend timeout (if desired) and
178
+ * let the GPU be powered down later.
173179 */
174180 void (*power_off_callback)(struct kbase_device *kbdev);
175181
....@@ -240,8 +246,6 @@
240246 *
241247 * For linux this callback will be called by the kernel runtime_suspend callback.
242248 * Note: for linux the kernel must have CONFIG_PM_RUNTIME enabled to use this feature.
243
- *
244
- * @return 0 on success, else OS error code.
245249 */
246250 void (*power_runtime_off_callback)(struct kbase_device *kbdev);
247251
....@@ -249,6 +253,8 @@
249253 *
250254 * For linux this callback will be called by the kernel runtime_resume callback.
251255 * Note: for linux the kernel must have CONFIG_PM_RUNTIME enabled to use this feature.
256
+ *
257
+ * @return 0 on success, else OS error code.
252258 */
253259 int (*power_runtime_on_callback)(struct kbase_device *kbdev);
254260
....@@ -289,6 +295,49 @@
289295 * be raised. On error, return the corresponding OS error code.
290296 */
291297 int (*soft_reset_callback)(struct kbase_device *kbdev);
298
+
299
+ /*
300
+ * Optional callback invoked after GPU becomes idle, not supported on
301
+ * JM GPUs.
302
+ *
303
+ * This callback will be invoked by the Kbase when GPU becomes idle.
304
+ * For JM GPUs or when runtime PM is disabled, Kbase will not invoke
305
+ * this callback and @power_off_callback will be invoked directly.
306
+ *
307
+ * This callback is supposed to decrement the runtime PM core reference
308
+ * count to zero and trigger the auto-suspend timer, which implies that
309
+ * @power_off_callback shouldn't initiate the runtime suspend.
310
+ *
311
+ * GPU registers still remain accessible until @power_off_callback gets
312
+ * invoked later on the expiry of auto-suspend timer.
313
+ *
314
+ * Note: The Linux kernel must have CONFIG_PM_RUNTIME enabled to use
315
+ * this feature.
316
+ */
317
+ void (*power_runtime_gpu_idle_callback)(struct kbase_device *kbdev);
318
+
319
+ /*
320
+ * Optional callback invoked to change the runtime PM core state to
321
+ * active.
322
+ *
323
+ * This callback will be invoked by Kbase when GPU needs to be
324
+ * reactivated, but only if @power_runtime_gpu_idle_callback was invoked
325
+ * previously. So both @power_runtime_gpu_idle_callback and this
326
+ * callback needs to be implemented at the same time.
327
+ *
328
+ * Kbase will invoke @power_on_callback first before invoking this
329
+ * callback if the GPU was powered down previously, otherwise directly.
330
+ *
331
+ * This callback is supposed to increment the runtime PM core reference
332
+ * count to 1, which implies that @power_on_callback shouldn't initiate
333
+ * the runtime resume. The runtime resume may not happen synchronously
334
+ * to avoid a potential deadlock due to the runtime suspend happening
335
+ * simultaneously from some other thread.
336
+ *
337
+ * Note: The Linux kernel must have CONFIG_PM_RUNTIME enabled to use
338
+ * this feature.
339
+ */
340
+ void (*power_runtime_gpu_active_callback)(struct kbase_device *kbdev);
292341 };
293342
294343 /* struct kbase_gpu_clk_notifier_data - Data for clock rate change notifier.
....@@ -406,7 +455,7 @@
406455 /**
407456 * kbase_get_platform_config - Gets the pointer to platform config.
408457 *
409
- * @return Pointer to the platform config
458
+ * Return: Pointer to the platform config
410459 */
411460 struct kbase_platform_config *kbase_get_platform_config(void);
412461
....@@ -515,7 +564,6 @@
515564 #ifndef CONFIG_OF
516565 /**
517566 * kbase_platform_register - Register a platform device for the GPU
518
- *
519567 * This can be used to register a platform device on systems where device tree
520568 * is not enabled and the platform initialisation code in the kernel doesn't
521569 * create the GPU device. Where possible device tree should be used instead.