diff options
author | Qiang Yu <yuq825@gmail.com> | 2020-04-21 16:35:51 +0300 |
---|---|---|
committer | Qiang Yu <yuq825@gmail.com> | 2020-04-24 15:51:24 +0300 |
commit | 50de2e9ebbc08e1ca27f9b3f0471d92abaaf834a (patch) | |
tree | fd7f824c060e7385a2b2f9631a3e5622d268df67 /drivers/gpu/drm/lima/lima_drv.c | |
parent | 63945d51490f16aede6d635e785faf56521e5e4a (diff) | |
download | linux-50de2e9ebbc08e1ca27f9b3f0471d92abaaf834a.tar.xz |
drm/lima: enable runtime pm
Enable runtime pm by default so GPU suspend when idle
for 200ms. This value can be changed by
autosuspend_delay_ms in device's power sysfs dir.
On Allwinner H3 lima_device_resume takes ~40us and
lima_device_suspend takes ~20us.
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-11-yuq825@gmail.com
Diffstat (limited to 'drivers/gpu/drm/lima/lima_drv.c')
-rw-r--r-- | drivers/gpu/drm/lima/lima_drv.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c index f3fe0a2f764b..a831565af813 100644 --- a/drivers/gpu/drm/lima/lima_drv.c +++ b/drivers/gpu/drm/lima/lima_drv.c @@ -404,6 +404,12 @@ static int lima_pdev_probe(struct platform_device *pdev) goto err_out2; } + pm_runtime_set_active(ldev->dev); + pm_runtime_mark_last_busy(ldev->dev); + pm_runtime_set_autosuspend_delay(ldev->dev, 200); + pm_runtime_use_autosuspend(ldev->dev); + pm_runtime_enable(ldev->dev); + /* * Register the DRM device with the core and the connectors with * sysfs. @@ -412,17 +418,16 @@ static int lima_pdev_probe(struct platform_device *pdev) if (err < 0) goto err_out3; - platform_set_drvdata(pdev, ldev); - if (sysfs_create_bin_file(&ldev->dev->kobj, &lima_error_state_attr)) dev_warn(ldev->dev, "fail to create error state sysfs\n"); return 0; err_out3: - lima_device_fini(ldev); -err_out2: + pm_runtime_disable(ldev->dev); lima_devfreq_fini(ldev); +err_out2: + lima_device_fini(ldev); err_out1: drm_dev_put(ddev); err_out0: @@ -436,10 +441,16 @@ static int lima_pdev_remove(struct platform_device *pdev) struct drm_device *ddev = ldev->ddev; sysfs_remove_bin_file(&ldev->dev->kobj, &lima_error_state_attr); - platform_set_drvdata(pdev, NULL); + drm_dev_unregister(ddev); + + /* stop autosuspend to make sure device is in active state */ + pm_runtime_set_autosuspend_delay(ldev->dev, -1); + pm_runtime_disable(ldev->dev); + lima_devfreq_fini(ldev); lima_device_fini(ldev); + drm_dev_put(ddev); lima_sched_slab_fini(); return 0; |