summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/msm/msm_submitqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/msm/msm_submitqueue.c')
-rw-r--r--drivers/gpu/drm/msm/msm_submitqueue.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c
index 7cb158bcbcf6..79b6ccd6ce64 100644
--- a/drivers/gpu/drm/msm/msm_submitqueue.c
+++ b/drivers/gpu/drm/msm/msm_submitqueue.c
@@ -7,6 +7,45 @@
#include "msm_gpu.h"
+int msm_file_private_set_sysprof(struct msm_file_private *ctx,
+ struct msm_gpu *gpu, int sysprof)
+{
+ /*
+ * Since pm_runtime and sysprof_active are both refcounts, we
+ * call apply the new value first, and then unwind the previous
+ * value
+ */
+
+ switch (sysprof) {
+ default:
+ return -EINVAL;
+ case 2:
+ pm_runtime_get_sync(&gpu->pdev->dev);
+ fallthrough;
+ case 1:
+ refcount_inc(&gpu->sysprof_active);
+ fallthrough;
+ case 0:
+ break;
+ }
+
+ /* unwind old value: */
+ switch (ctx->sysprof) {
+ case 2:
+ pm_runtime_put_autosuspend(&gpu->pdev->dev);
+ fallthrough;
+ case 1:
+ refcount_dec(&gpu->sysprof_active);
+ fallthrough;
+ case 0:
+ break;
+ }
+
+ ctx->sysprof = sysprof;
+
+ return 0;
+}
+
void __msm_file_private_destroy(struct kref *kref)
{
struct msm_file_private *ctx = container_of(kref,