Skip to content

Commit a40b139

Browse files
author
Christoph Rudorff
committed
drm/msm/gpu: fix clk lockup PM suspend/resume handler
gfx3d_clk_src rcg didn't update its configuration. set clk_enable before set_rate set "suspend rate" before clk_disable Signed-off-by: Christoph Rudorff <[email protected]>
1 parent 0be406c commit a40b139

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

drivers/gpu/drm/msm/msm_gpu.c

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

5858
static int enable_clk(struct msm_gpu *gpu)
5959
{
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() can do set_rate
66+
if an "opp-suspend" exists,
67+
I actually see no need ...
68+
6069
if (gpu->core_clk && gpu->fast_rate)
6170
dev_pm_opp_set_rate(&gpu->pdev->dev, gpu->fast_rate);
6271
72+
*/
73+
6374
/* Set the RBBM timer rate to 19.2Mhz */
6475
if (gpu->rbbmtimer_clk)
6576
clk_set_rate(gpu->rbbmtimer_clk, 19200000);
6677

67-
return clk_bulk_prepare_enable(gpu->nr_clocks, gpu->grp_clks);
78+
return 0;
6879
}
6980

7081
static int disable_clk(struct msm_gpu *gpu)
7182
{
72-
clk_bulk_disable_unprepare(gpu->nr_clocks, gpu->grp_clks);
73-
7483
/*
7584
* Set the clock to a deliberately low rate. On older targets the clock
7685
* speed had to be non zero to avoid problems. On newer targets this
7786
* will be rounded down to zero anyway so it all works out.
78-
*/
87+
88+
Can declare "opp-suspend" if theres need ...
89+
7990
if (gpu->core_clk)
80-
dev_pm_opp_set_rate(&gpu->pdev->dev, 27000000);
91+
dev_pm_opp_set_rate(&gpu->pdev->dev, 1);
92+
*/
8193

8294
if (gpu->rbbmtimer_clk)
8395
clk_set_rate(gpu->rbbmtimer_clk, 0);
8496

97+
clk_bulk_disable_unprepare(gpu->nr_clocks, gpu->grp_clks);
98+
8599
return 0;
86100
}
87101

drivers/gpu/drm/msm/msm_gpu_devfreq.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ void msm_devfreq_resume(struct msm_gpu *gpu)
239239
mutex_lock(&df->lock);
240240
df->busy_cycles = gpu->funcs->gpu_busy(gpu, &sample_rate);
241241
df->time = ktime_get();
242+
df->idle_freq = 0;
242243
df->suspended = false;
243244
mutex_unlock(&df->lock);
244245

@@ -256,10 +257,10 @@ void msm_devfreq_suspend(struct msm_gpu *gpu)
256257
df->suspended = true;
257258
mutex_unlock(&df->lock);
258259

259-
devfreq_suspend_device(df->devfreq);
260-
261260
cancel_idle_work(df);
262261
cancel_boost_work(df);
262+
263+
devfreq_suspend_device(df->devfreq);
263264
}
264265

265266
static void msm_devfreq_boost_work(struct kthread_work *work)

0 commit comments

Comments
 (0)