]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/lima: add lima_devfreq_resume/suspend
authorQiang Yu <yuq825@gmail.com>
Tue, 21 Apr 2020 13:35:46 +0000 (21:35 +0800)
committerQiang Yu <yuq825@gmail.com>
Fri, 24 Apr 2020 12:50:57 +0000 (20:50 +0800)
Used for device resume/suspend in the following commits.

Tested-by: Bhushan Shah <bshah@kde.org>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200421133551.31481-6-yuq825@gmail.com
drivers/gpu/drm/lima/lima_devfreq.c
drivers/gpu/drm/lima/lima_devfreq.h

index 1d479b5924fe90fab57d49dd7f77f21515a7d785..bbe02817721bcfe14ac9dc337e5adbf1de0ce608 100644 (file)
@@ -231,3 +231,27 @@ void lima_devfreq_record_idle(struct lima_devfreq *devfreq)
 
        spin_unlock_irqrestore(&devfreq->lock, irqflags);
 }
+
+int lima_devfreq_resume(struct lima_devfreq *devfreq)
+{
+       unsigned long irqflags;
+
+       if (!devfreq->devfreq)
+               return 0;
+
+       spin_lock_irqsave(&devfreq->lock, irqflags);
+
+       lima_devfreq_reset(devfreq);
+
+       spin_unlock_irqrestore(&devfreq->lock, irqflags);
+
+       return devfreq_resume_device(devfreq->devfreq);
+}
+
+int lima_devfreq_suspend(struct lima_devfreq *devfreq)
+{
+       if (!devfreq->devfreq)
+               return 0;
+
+       return devfreq_suspend_device(devfreq->devfreq);
+}
index 8d71ba9fb22ab090eed2b15fe56a53bfe373172a..5eed2975a3758040adb7e4f3b6300f81899d43c4 100644 (file)
@@ -38,4 +38,7 @@ void lima_devfreq_fini(struct lima_device *ldev);
 void lima_devfreq_record_busy(struct lima_devfreq *devfreq);
 void lima_devfreq_record_idle(struct lima_devfreq *devfreq);
 
+int lima_devfreq_resume(struct lima_devfreq *devfreq);
+int lima_devfreq_suspend(struct lima_devfreq *devfreq);
+
 #endif