drm/msm/a6xx: Send ACD state to QMP at GMU resume
authorKonrad Dybcio <konrad.dybcio@linaro.org>
Mon, 25 Sep 2023 14:50:35 +0000 (16:50 +0200)
committerRob Clark <robdclark@chromium.org>
Mon, 9 Oct 2023 18:22:05 +0000 (11:22 -0700)
The QMP mailbox expects to be notified of the ACD (Adaptive Clock
Distribution) state. Get a handle to the mailbox at probe time and
poke it at GMU resume.

Since we don't fully support ACD yet, hardcode the message to "val: 0"
(state = disabled).

Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> # sm8450
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/559287/
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/adreno/a6xx_gmu.c
drivers/gpu/drm/msm/adreno/a6xx_gmu.h

index 15ab912d9c45169427c4b95148fe435f36331cc4..c1934d46c0d7f28d62244ed1119e48723796903d 100644 (file)
@@ -989,6 +989,14 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)
 
        gmu->hung = false;
 
+       /* Notify AOSS about the ACD state (unimplemented for now => disable it) */
+       if (!IS_ERR(gmu->qmp)) {
+               ret = qmp_send(gmu->qmp, "{class: gpu, res: acd, val: %d}",
+                              0 /* Hardcode ACD to be disabled for now */);
+               if (ret)
+                       dev_err(gmu->dev, "failed to send GPU ACD state\n");
+       }
+
        /* Turn on the resources */
        pm_runtime_get_sync(gmu->dev);
 
@@ -1741,6 +1749,10 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
                goto detach_cxpd;
        }
 
+       gmu->qmp = qmp_get(gmu->dev);
+       if (IS_ERR(gmu->qmp) && adreno_is_a7xx(adreno_gpu))
+               return PTR_ERR(gmu->qmp);
+
        init_completion(&gmu->pd_gate);
        complete_all(&gmu->pd_gate);
        gmu->pd_nb.notifier_call = cxpd_notifier_cb;
@@ -1764,6 +1776,9 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
 
        return 0;
 
+       if (!IS_ERR_OR_NULL(gmu->qmp))
+               qmp_put(gmu->qmp);
+
 detach_cxpd:
        dev_pm_domain_detach(gmu->cxpd, false);
 
index 236f81a43caa62b8574739e7723aeb9b8ada20d3..592b296aab22b1e3245b95450f05cceec66ac5a4 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/iopoll.h>
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
+#include <linux/soc/qcom/qcom_aoss.h>
 #include "msm_drv.h"
 #include "a6xx_hfi.h"
 
@@ -96,6 +97,8 @@ struct a6xx_gmu {
        /* For power domain callback */
        struct notifier_block pd_nb;
        struct completion pd_gate;
+
+       struct qmp *qmp;
 };
 
 static inline u32 gmu_read(struct a6xx_gmu *gmu, u32 offset)