Skip to content

Commit 5184df5

Browse files
author
Christoph Rudorff
committed
drm/msm/gpu: fix clk lockup PM suspend/resume handler
testing freq. transitions on MSM8916 Samsung J5 "a3xx": locks up when gpu was on 310MHz: resume handler was setting opp rate that will do clk_set_rate before the clk was enabled. devfreq can do this job if opp-suspend was defined in dt. changed resume so clk gets enabled first and let devfreq setting it changed suspend aswell Signed-off-by: Christoph Rudorff <[email protected]>
1 parent 10a4487 commit 5184df5

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

drivers/gpu/drm/msm/msm_gpu.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,31 +57,44 @@ static int disable_pwrrail(struct msm_gpu *gpu)
5757

5858
static int enable_clk(struct msm_gpu *gpu)
5959
{
60-
if (gpu->core_clk && gpu->fast_rate)
60+
int ret;
61+
ret = clk_bulk_prepare_enable(gpu->nr_clocks, gpu->grp_clks);
62+
if (ret)
63+
return ret;
64+
/*
65+
devfreq_resume_device() will do set_rate
66+
if an "opp-suspend" exists
67+
*/
68+
if (gpu->core_clk && gpu->fast_rate &&
69+
dev_pm_opp_get_suspend_opp_freq(&gpu->pdev->dev) == 0)
6170
dev_pm_opp_set_rate(&gpu->pdev->dev, gpu->fast_rate);
6271

6372
/* Set the RBBM timer rate to 19.2Mhz */
6473
if (gpu->rbbmtimer_clk)
6574
clk_set_rate(gpu->rbbmtimer_clk, 19200000);
6675

67-
return clk_bulk_prepare_enable(gpu->nr_clocks, gpu->grp_clks);
76+
return 0;
6877
}
6978

7079
static int disable_clk(struct msm_gpu *gpu)
7180
{
72-
clk_bulk_disable_unprepare(gpu->nr_clocks, gpu->grp_clks);
73-
7481
/*
7582
* Set the clock to a deliberately low rate. On older targets the clock
7683
* speed had to be non zero to avoid problems. On newer targets this
7784
* will be rounded down to zero anyway so it all works out.
85+
86+
* skip this if an "opp-suspend" exists:
87+
* devfreq_suspend_device() has done this
7888
*/
79-
if (gpu->core_clk)
80-
dev_pm_opp_set_rate(&gpu->pdev->dev, 27000000);
89+
if (gpu->core_clk &&
90+
dev_pm_opp_get_suspend_opp_freq(&gpu->pdev->dev) == 0)
91+
dev_pm_opp_set_rate(&gpu->pdev->dev, 1);
8192

8293
if (gpu->rbbmtimer_clk)
8394
clk_set_rate(gpu->rbbmtimer_clk, 0);
8495

96+
clk_bulk_disable_unprepare(gpu->nr_clocks, gpu->grp_clks);
97+
8598
return 0;
8699
}
87100

drivers/gpu/drm/msm/msm_gpu_devfreq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@ void msm_devfreq_suspend(struct msm_gpu *gpu)
247247
df->suspended = true;
248248
mutex_unlock(&df->lock);
249249

250-
devfreq_suspend_device(df->devfreq);
251-
252250
cancel_idle_work(df);
253251
cancel_boost_work(df);
252+
253+
devfreq_suspend_device(df->devfreq);
254254
}
255255

256256
static void msm_devfreq_boost_work(struct kthread_work *work)

0 commit comments

Comments
 (0)