]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/msm: a6xx: Refactor a6xx_sptprac_enable()
authorAkhil P Oommen <akhilpo@oss.qualcomm.com>
Mon, 8 Sep 2025 08:26:58 +0000 (13:56 +0530)
committerRob Clark <robin.clark@oss.qualcomm.com>
Mon, 8 Sep 2025 14:24:59 +0000 (07:24 -0700)
A minor refactor to combine the subroutines for legacy a6xx GMUs under
a single check. This helps to avoid an unnecessary check and return
early from the subroutine for majority of a6xx gpus.

Also, document an intermediate unknown low power state which is not
exposed by the GMU firmware.

Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/673364/
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
drivers/gpu/drm/msm/adreno/a6xx_gmu.c
drivers/gpu/drm/msm/adreno/a6xx_gmu.h

index 5594499ad2d1fd2bd9da63c172410975d6fd2b90..da339459ae4b896e6284b710c5a4068fd9906d36 100644 (file)
@@ -412,7 +412,10 @@ int a6xx_sptprac_enable(struct a6xx_gmu *gmu)
        int ret;
        u32 val;
 
-       if (!gmu->legacy)
+       WARN_ON(!gmu->legacy);
+
+       /* Nothing to do if GMU does the power management */
+       if (gmu->idle_level > GMU_IDLE_STATE_ACTIVE)
                return 0;
 
        gmu_write(gmu, REG_A6XX_GMU_GX_SPTPRAC_POWER_CONTROL, 0x778000);
@@ -936,10 +939,7 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state)
                ret = a6xx_gmu_gfx_rail_on(gmu);
                if (ret)
                        return ret;
-       }
 
-       /* Enable SPTP_PC if the CPU is responsible for it */
-       if (gmu->idle_level < GMU_IDLE_STATE_SPTP) {
                ret = a6xx_sptprac_enable(gmu);
                if (ret)
                        return ret;
index 069a8c9474e8beb4ebe84d1609a8d38b44314125..9494bbed9a1ff86b19acec139d7ab27697d7ec8a 100644 (file)
@@ -50,6 +50,9 @@ struct a6xx_bcm {
 /* The GMU does not do any idle state management */
 #define GMU_IDLE_STATE_ACTIVE 0
 
+/* Unknown power state. Not exposed by the firmware. For documentation purpose only */
+#define GMU_IDLE_STATE_RESERVED 1
+
 /* The GMU manages SPTP power collapse */
 #define GMU_IDLE_STATE_SPTP 2