| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2010-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2010-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 |
|---|
| .. | .. |
|---|
| 20 | 20 | */ |
|---|
| 21 | 21 | |
|---|
| 22 | 22 | /** |
|---|
| 23 | | - * Power management API definitions |
|---|
| 23 | + * DOC: Power management API definitions |
|---|
| 24 | 24 | */ |
|---|
| 25 | 25 | |
|---|
| 26 | 26 | #ifndef _KBASE_PM_H_ |
|---|
| .. | .. |
|---|
| 39 | 39 | #define PM_NO_RESET 0x04 |
|---|
| 40 | 40 | #endif |
|---|
| 41 | 41 | |
|---|
| 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) |
|---|
| 43 | 47 | * |
|---|
| 44 | 48 | * Must be called before any other power management function |
|---|
| 45 | 49 | * |
|---|
| 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. |
|---|
| 50 | 51 | */ |
|---|
| 51 | 52 | int kbase_pm_init(struct kbase_device *kbdev); |
|---|
| 52 | 53 | |
|---|
| 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. |
|---|
| 54 | 57 | * |
|---|
| 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 |
|---|
| 56 | 60 | * |
|---|
| 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. |
|---|
| 60 | 62 | */ |
|---|
| 61 | 63 | int kbase_pm_powerup(struct kbase_device *kbdev, unsigned int flags); |
|---|
| 62 | 64 | |
|---|
| 63 | 65 | /** |
|---|
| 64 | | - * Halt the power management framework. |
|---|
| 66 | + * kbase_pm_halt - Halt the power management framework. |
|---|
| 67 | + * |
|---|
| 65 | 68 | * @kbdev: The kbase device structure for the device (must be a valid pointer) |
|---|
| 66 | 69 | * |
|---|
| 67 | 70 | * Should ensure that no new interrupts are generated, |
|---|
| .. | .. |
|---|
| 71 | 74 | */ |
|---|
| 72 | 75 | void kbase_pm_halt(struct kbase_device *kbdev); |
|---|
| 73 | 76 | |
|---|
| 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) |
|---|
| 75 | 81 | * |
|---|
| 76 | 82 | * No power management functions may be called after this |
|---|
| 77 | 83 | * (except @ref kbase_pm_init) |
|---|
| 78 | | - * |
|---|
| 79 | | - * @param kbdev The kbase device structure for the device (must be a valid pointer) |
|---|
| 80 | 84 | */ |
|---|
| 81 | 85 | void kbase_pm_term(struct kbase_device *kbdev); |
|---|
| 82 | 86 | |
|---|
| 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) |
|---|
| 84 | 91 | * |
|---|
| 85 | 92 | * This function should be called when a context is about to submit a job. |
|---|
| 86 | 93 | * It informs the active power policy that the GPU is going to be in use shortly |
|---|
| .. | .. |
|---|
| 94 | 101 | * @note a Suspend is only visible to Kernel threads; user-space threads in a |
|---|
| 95 | 102 | * syscall cannot witness a suspend, because they are frozen before the suspend |
|---|
| 96 | 103 | * begins. |
|---|
| 97 | | - * |
|---|
| 98 | | - * @param kbdev The kbase device structure for the device (must be a valid pointer) |
|---|
| 99 | 104 | */ |
|---|
| 100 | 105 | void kbase_pm_context_active(struct kbase_device *kbdev); |
|---|
| 101 | 106 | |
|---|
| .. | .. |
|---|
| 123 | 128 | #endif /* CONFIG_MALI_ARBITER_SUPPORT */ |
|---|
| 124 | 129 | }; |
|---|
| 125 | 130 | |
|---|
| 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 |
|---|
| 127 | 136 | * |
|---|
| 128 | 137 | * If a suspend is in progress, this allows for various different ways of |
|---|
| 129 | 138 | * handling the suspend. Refer to @ref enum kbase_pm_suspend_handler for details. |
|---|
| .. | .. |
|---|
| 133 | 142 | * indicates a failure, the caller must abort whatever operation it was |
|---|
| 134 | 143 | * attempting, and potentially queue it up for after the OS has resumed. |
|---|
| 135 | 144 | * |
|---|
| 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. |
|---|
| 140 | 146 | */ |
|---|
| 141 | 147 | int kbase_pm_context_active_handle_suspend(struct kbase_device *kbdev, enum kbase_pm_suspend_handler suspend_handler); |
|---|
| 142 | 148 | |
|---|
| 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) |
|---|
| 144 | 153 | * |
|---|
| 145 | 154 | * This function should be called when a context becomes idle. |
|---|
| 146 | 155 | * After this call the GPU may be turned off by the power policy so the calling |
|---|
| 147 | 156 | * 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) |
|---|
| 150 | 157 | */ |
|---|
| 151 | 158 | void kbase_pm_context_idle(struct kbase_device *kbdev); |
|---|
| 152 | 159 | |
|---|
| .. | .. |
|---|
| 155 | 162 | */ |
|---|
| 156 | 163 | |
|---|
| 157 | 164 | /** |
|---|
| 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 | + * |
|---|
| 160 | 168 | * @kbdev: The kbase device structure for the device (must be a valid pointer) |
|---|
| 161 | 169 | * |
|---|
| 162 | 170 | * This is called in response to an OS suspend event, and calls into the various |
|---|
| .. | .. |
|---|
| 165 | 173 | * @note the mechanisms used here rely on all user-space threads being frozen |
|---|
| 166 | 174 | * by the OS before we suspend. Otherwise, an IOCTL could occur that powers up |
|---|
| 167 | 175 | * the GPU e.g. via atom submission. |
|---|
| 176 | + * |
|---|
| 177 | + * Return: 0 on success. |
|---|
| 168 | 178 | */ |
|---|
| 169 | | -void kbase_pm_suspend(struct kbase_device *kbdev); |
|---|
| 179 | +int kbase_pm_suspend(struct kbase_device *kbdev); |
|---|
| 170 | 180 | |
|---|
| 171 | 181 | /** |
|---|
| 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 | + * |
|---|
| 174 | 185 | * @kbdev: The kbase device structure for the device (must be a valid pointer) |
|---|
| 175 | 186 | * |
|---|
| 176 | 187 | * This is called in response to an OS resume event, and calls into the various |
|---|
| .. | .. |
|---|
| 207 | 218 | * @note the mechanisms used here rely on all user-space threads being frozen |
|---|
| 208 | 219 | * by the OS before we suspend. Otherwise, an IOCTL could occur that powers up |
|---|
| 209 | 220 | * the GPU e.g. via atom submission. |
|---|
| 221 | + * |
|---|
| 222 | + * Return: 0 on success. |
|---|
| 210 | 223 | */ |
|---|
| 211 | | -void kbase_pm_driver_suspend(struct kbase_device *kbdev); |
|---|
| 224 | +int kbase_pm_driver_suspend(struct kbase_device *kbdev); |
|---|
| 212 | 225 | |
|---|
| 213 | 226 | /** |
|---|
| 214 | 227 | * kbase_pm_driver_resume() - Put GPU and driver in resume |
|---|