Right now, because of an apparent bug in the management of runtime PM,
the device remains powered on at all times. This was causing three
different issues:

- Because MMU interrupts are only enabled when the device resets, the very
first job targeting the tiler heap would always time out, as a device reset
is only performed during a runtime resume operation.
- Devfreq OPP transition notifications would be printed all the time, even
when the device is meant to be idle, which polute the kernel ring buffer.
- PM refcnt would eventually underflow.

Signed-off-by: Adrián Larumbe <[email protected]>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c 
b/drivers/gpu/drm/panfrost/panfrost_drv.c
index cb8e5015847f..68b831add0bb 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -986,9 +986,8 @@ static int panfrost_probe(struct platform_device *pdev)
                goto err_out0;
        }
 
-       pm_runtime_set_active(pfdev->base.dev);
-       pm_runtime_mark_last_busy(pfdev->base.dev);
        pm_runtime_enable(pfdev->base.dev);
+       pm_runtime_resume_and_get(pfdev->base.dev);
        pm_runtime_set_autosuspend_delay(pfdev->base.dev, 50); /* ~3 frames */
        pm_runtime_use_autosuspend(pfdev->base.dev);
 
@@ -1004,6 +1003,8 @@ static int panfrost_probe(struct platform_device *pdev)
        if (err)
                goto err_out2;
 
+       pm_runtime_put_sync_suspend(pfdev->base.dev);
+
        return 0;
 
 err_out2:
@@ -1024,8 +1025,9 @@ static void panfrost_remove(struct platform_device *pdev)
        panfrost_gem_shrinker_cleanup(&pfdev->base);
 
        pm_runtime_get_sync(pfdev->base.dev);
-       pm_runtime_disable(pfdev->base.dev);
        panfrost_device_fini(pfdev);
+       pm_runtime_put_sync(pfdev->base.dev);
+       pm_runtime_disable(pfdev->base.dev);
        pm_runtime_set_suspended(pfdev->base.dev);
 }
 

-- 
2.53.0

Reply via email to