Skip to content

Commit 6aa89ae

Browse files
committed
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: Rob Clark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Clark <[email protected]>
1 parent 167a668 commit 6aa89ae

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

drivers/gpu/drm/msm/msm_gpu_devfreq.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ void msm_devfreq_init(struct msm_gpu *gpu)
133133
CLOCK_MONOTONIC, HRTIMER_MODE_REL);
134134
}
135135

136+
static void cancel_idle_work(struct msm_gpu_devfreq *df)
137+
{
138+
hrtimer_cancel(&df->idle_work.timer);
139+
kthread_cancel_work_sync(&df->idle_work.work);
140+
}
141+
142+
static void cancel_boost_work(struct msm_gpu_devfreq *df)
143+
{
144+
hrtimer_cancel(&df->boost_work.timer);
145+
kthread_cancel_work_sync(&df->boost_work.work);
146+
}
147+
136148
void msm_devfreq_cleanup(struct msm_gpu *gpu)
137149
{
138150
struct msm_gpu_devfreq *df = &gpu->devfreq;
@@ -152,7 +164,12 @@ void msm_devfreq_resume(struct msm_gpu *gpu)
152164

153165
void msm_devfreq_suspend(struct msm_gpu *gpu)
154166
{
155-
devfreq_suspend_device(gpu->devfreq.devfreq);
167+
struct msm_gpu_devfreq *df = &gpu->devfreq;
168+
169+
devfreq_suspend_device(df->devfreq);
170+
171+
cancel_idle_work(df);
172+
cancel_boost_work(df);
156173
}
157174

158175
static void msm_devfreq_boost_work(struct kthread_work *work)
@@ -196,7 +213,7 @@ void msm_devfreq_active(struct msm_gpu *gpu)
196213
/*
197214
* Cancel any pending transition to idle frequency:
198215
*/
199-
hrtimer_cancel(&df->idle_work.timer);
216+
cancel_idle_work(df);
200217

201218
idle_time = ktime_to_ms(ktime_sub(ktime_get(), df->idle_time));
202219

0 commit comments

Comments
 (0)