aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>2023-03-03 20:16:58 +0300
committerDmitry Baryshkov <dmitry.baryshkov@linaro.org>2023-03-03 20:16:58 +0300
commit698ff50f398356c76fd075bb363d29305a20bb5f (patch)
treee299fdabb9e5f5f6a46bd3b76188f88320f0e5ef
parenta0fddcd2953f674e3c460cb75a3b922c46bd96f5 (diff)
drm/msm/gpu: scale MX domain following the frequncy changesrelease/db820c/qcomlt-5.15
Make sure that the MX domain is resumed and scaled to the proper performance state following the desired frequency. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-rw-r--r--drivers/gpu/drm/msm/adreno/a5xx_gpu.c13
-rw-r--r--drivers/gpu/drm/msm/adreno/a5xx_gpu.h3
2 files changed, 13 insertions, 3 deletions
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index da79ee74cff6..83f836668fd2 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1053,6 +1053,9 @@ static void a5xx_destroy(struct msm_gpu *gpu)
adreno_gpu_cleanup(adreno_gpu);
+ if (a5xx_gpu->mx_link)
+ device_link_del(a5xx_gpu->mx_link);
+
if (a5xx_gpu->gxpd)
dev_pm_domain_detach(a5xx_gpu->gxpd, true);
@@ -1792,6 +1795,7 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
* If the device has several power domain (gx and cpr3), none are attached by the core.
*/
if (!pdev->dev.pm_domain) {
+ struct device **opp_virt_dev;
struct device *pd;
static const char *cpr_genpd_names[] = { "cpr", "mx", NULL };
@@ -1806,11 +1810,18 @@ struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
a5xx_gpu->gxpd = pd;
- ret = devm_pm_opp_attach_genpd(&pdev->dev, cpr_genpd_names, NULL);
+ ret = devm_pm_opp_attach_genpd(&pdev->dev, cpr_genpd_names, &opp_virt_dev);
if (ret) {
dev_pm_domain_detach(a5xx_gpu->gxpd, true);
return ERR_PTR(ret);
}
+
+ a5xx_gpu->mx_link = device_link_add(&pdev->dev, opp_virt_dev[1],
+ DL_FLAG_RPM_ACTIVE |
+ DL_FLAG_PM_RUNTIME |
+ DL_FLAG_STATELESS);
+ if (!a5xx_gpu->mx_link)
+ return ERR_PTR(-ENODEV);
}
check_speed_bin(&pdev->dev);
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.h b/drivers/gpu/drm/msm/adreno/a5xx_gpu.h
index f3fd8826d1ee..36e910397c14 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.h
@@ -46,8 +46,7 @@ struct a5xx_gpu {
bool has_whereami;
struct device *gxpd;
- struct device *mxpd;
- struct device *cprpd;
+ struct device_link *mx_link;
};
#define to_a5xx_gpu(x) container_of(x, struct a5xx_gpu, base)