Commit 6aa89ae1 authored by Rob Clark's avatar Rob Clark

drm/msm/gpu: Cancel idle/boost work on suspend

With system suspend using pm_runtime_force_suspend() we can't rely on
the pm_runtime_get_if_in_use() trick to deal with devfreq callbacks
after (or racing with) suspend.  So flush any pending idle or boost
work in the suspend path.
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
Link: https://lore.kernel.org/r/20220108180913.814448-3-robdclark@gmail.comSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 167a668a
...@@ -133,6 +133,18 @@ void msm_devfreq_init(struct msm_gpu *gpu) ...@@ -133,6 +133,18 @@ void msm_devfreq_init(struct msm_gpu *gpu)
CLOCK_MONOTONIC, HRTIMER_MODE_REL); CLOCK_MONOTONIC, HRTIMER_MODE_REL);
} }
static void cancel_idle_work(struct msm_gpu_devfreq *df)
{
hrtimer_cancel(&df->idle_work.timer);
kthread_cancel_work_sync(&df->idle_work.work);
}
static void cancel_boost_work(struct msm_gpu_devfreq *df)
{
hrtimer_cancel(&df->boost_work.timer);
kthread_cancel_work_sync(&df->boost_work.work);
}
void msm_devfreq_cleanup(struct msm_gpu *gpu) void msm_devfreq_cleanup(struct msm_gpu *gpu)
{ {
struct msm_gpu_devfreq *df = &gpu->devfreq; struct msm_gpu_devfreq *df = &gpu->devfreq;
...@@ -152,7 +164,12 @@ void msm_devfreq_resume(struct msm_gpu *gpu) ...@@ -152,7 +164,12 @@ void msm_devfreq_resume(struct msm_gpu *gpu)
void msm_devfreq_suspend(struct msm_gpu *gpu) void msm_devfreq_suspend(struct msm_gpu *gpu)
{ {
devfreq_suspend_device(gpu->devfreq.devfreq); struct msm_gpu_devfreq *df = &gpu->devfreq;
devfreq_suspend_device(df->devfreq);
cancel_idle_work(df);
cancel_boost_work(df);
} }
static void msm_devfreq_boost_work(struct kthread_work *work) static void msm_devfreq_boost_work(struct kthread_work *work)
...@@ -196,7 +213,7 @@ void msm_devfreq_active(struct msm_gpu *gpu) ...@@ -196,7 +213,7 @@ void msm_devfreq_active(struct msm_gpu *gpu)
/* /*
* Cancel any pending transition to idle frequency: * Cancel any pending transition to idle frequency:
*/ */
hrtimer_cancel(&df->idle_work.timer); cancel_idle_work(df);
idle_time = ktime_to_ms(ktime_sub(ktime_get(), df->idle_time)); idle_time = ktime_to_ms(ktime_sub(ktime_get(), df->idle_time));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment