| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2010-2017, 2019-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2010-2017, 2019-2022 ARM Limited. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * This program is free software and is provided to you under the terms of the |
|---|
| 7 | 7 | * GNU General Public License version 2 as published by the Free Software |
|---|
| .. | .. |
|---|
| 170 | 170 | * the clocks to the GPU, or to completely power down the GPU. |
|---|
| 171 | 171 | * The platform specific private pointer kbase_device::platform_context can be accessed and modified in here. It is the |
|---|
| 172 | 172 | * 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. |
|---|
| 173 | 179 | */ |
|---|
| 174 | 180 | void (*power_off_callback)(struct kbase_device *kbdev); |
|---|
| 175 | 181 | |
|---|
| .. | .. |
|---|
| 240 | 246 | * |
|---|
| 241 | 247 | * For linux this callback will be called by the kernel runtime_suspend callback. |
|---|
| 242 | 248 | * 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. |
|---|
| 245 | 249 | */ |
|---|
| 246 | 250 | void (*power_runtime_off_callback)(struct kbase_device *kbdev); |
|---|
| 247 | 251 | |
|---|
| .. | .. |
|---|
| 249 | 253 | * |
|---|
| 250 | 254 | * For linux this callback will be called by the kernel runtime_resume callback. |
|---|
| 251 | 255 | * 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. |
|---|
| 252 | 258 | */ |
|---|
| 253 | 259 | int (*power_runtime_on_callback)(struct kbase_device *kbdev); |
|---|
| 254 | 260 | |
|---|
| .. | .. |
|---|
| 289 | 295 | * be raised. On error, return the corresponding OS error code. |
|---|
| 290 | 296 | */ |
|---|
| 291 | 297 | 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); |
|---|
| 292 | 341 | }; |
|---|
| 293 | 342 | |
|---|
| 294 | 343 | /* struct kbase_gpu_clk_notifier_data - Data for clock rate change notifier. |
|---|
| .. | .. |
|---|
| 406 | 455 | /** |
|---|
| 407 | 456 | * kbase_get_platform_config - Gets the pointer to platform config. |
|---|
| 408 | 457 | * |
|---|
| 409 | | - * @return Pointer to the platform config |
|---|
| 458 | + * Return: Pointer to the platform config |
|---|
| 410 | 459 | */ |
|---|
| 411 | 460 | struct kbase_platform_config *kbase_get_platform_config(void); |
|---|
| 412 | 461 | |
|---|
| .. | .. |
|---|
| 515 | 564 | #ifndef CONFIG_OF |
|---|
| 516 | 565 | /** |
|---|
| 517 | 566 | * kbase_platform_register - Register a platform device for the GPU |
|---|
| 518 | | - * |
|---|
| 519 | 567 | * This can be used to register a platform device on systems where device tree |
|---|
| 520 | 568 | * is not enabled and the platform initialisation code in the kernel doesn't |
|---|
| 521 | 569 | * create the GPU device. Where possible device tree should be used instead. |
|---|