drm/etnaviv: make clock handling symetric between runtime resume and suspend
authorLucas Stach <l.stach@pengutronix.de>
Wed, 7 Jun 2023 13:02:19 +0000 (15:02 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Mon, 17 Jul 2023 09:32:17 +0000 (11:32 +0200)
Currently the clock is enabled in the runtime resume function, but are
disabled a level further down in the callstack in the suspend function.
Move the clock disable into the suspend function to make handling
symmetrical between resume and suspend.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
drivers/gpu/drm/etnaviv/etnaviv_gpu.c

index ba8c43bfc94eda316cee1656335feff025bf6ab9..73ce95df4cc0b85af490c1f9275a9550766bea0d 100644 (file)
@@ -1640,7 +1640,7 @@ int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms)
        } while (1);
 }
 
-static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
+static void etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
 {
        if (gpu->initialized && gpu->fe_running) {
                /* Replace the last WAIT with END */
@@ -1659,8 +1659,6 @@ static int etnaviv_gpu_hw_suspend(struct etnaviv_gpu *gpu)
        }
 
        gpu->exec_state = -1;
-
-       return etnaviv_gpu_clk_disable(gpu);
 }
 
 static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)
@@ -1797,6 +1795,7 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
                pm_runtime_put_sync_suspend(gpu->dev);
        } else {
                etnaviv_gpu_hw_suspend(gpu);
+               etnaviv_gpu_clk_disable(gpu);
        }
 
        if (gpu->mmu_context)
@@ -1930,7 +1929,9 @@ static int etnaviv_gpu_rpm_suspend(struct device *dev)
                return -EBUSY;
        }
 
-       return etnaviv_gpu_hw_suspend(gpu);
+       etnaviv_gpu_hw_suspend(gpu);
+
+       return etnaviv_gpu_clk_disable(gpu);
 }
 
 static int etnaviv_gpu_rpm_resume(struct device *dev)