[Freedreno] [DPU PATCH 03/15] drm/msm: Move dpu_dbg init/destroy into dpu_kms

Sean Paul seanpaul at chromium.org
Thu Jun 28 18:28:54 UTC 2018


No need to have this in msm_drv, so move it into dpu. While we're at
it, remove the other CONFIG_DRM_MSM_DPU ifdef gates.

Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 18 ++++++++++-
 drivers/gpu/drm/msm/msm_drv.c           | 41 -------------------------
 2 files changed, 17 insertions(+), 42 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 3003176e731d..0b813a089cba 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -279,6 +279,12 @@ static int _dpu_debugfs_init(struct dpu_kms *dpu_kms)
 	if (!debugfs_root)
 		return -EINVAL;
 
+	rc = dpu_dbg_debugfs_register(debugfs_root);
+	if (rc) {
+		DRM_ERROR("failed to reg dpu dbg debugfs: %d\n", rc);
+		return rc;
+	}
+
 	/* allow debugfs_root to be NULL */
 	debugfs_create_x32(DPU_DEBUGFS_HWMASKNAME, 0600, debugfs_root, p);
 
@@ -1072,6 +1078,8 @@ static void dpu_kms_destroy(struct msm_kms *kms)
 	}
 
 	dpu_kms = to_dpu_kms(kms);
+
+	dpu_dbg_destroy();
 	_dpu_kms_hw_destroy(dpu_kms);
 }
 
@@ -1401,10 +1409,16 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 		goto end;
 	}
 
+	rc = dpu_dbg_init(&dpu_kms->pdev->dev);
+	if (rc) {
+		DRM_ERROR("failed to init dpu dbg: %d\n", rc);
+		goto end;
+	}
+
 	priv = dev->dev_private;
 	if (!priv) {
 		DPU_ERROR("invalid private data\n");
-		goto end;
+		goto dbg_destroy;
 	}
 
 	dpu_kms->mmio = msm_ioremap(dpu_kms->pdev, "mdp_phys", "mdp_phys");
@@ -1592,6 +1606,8 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 	pm_runtime_put_sync(&dpu_kms->pdev->dev);
 error:
 	_dpu_kms_hw_destroy(dpu_kms);
+dbg_destroy:
+	dpu_dbg_destroy();
 end:
 	return rc;
 }
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 51d6b310ca33..6177b3f18912 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -26,9 +26,6 @@
 #include "msm_fence.h"
 #include "msm_gpu.h"
 #include "msm_kms.h"
-#ifdef CONFIG_DRM_MSM_DPU
-#include "dpu_dbg.h"
-#endif
 
 /*
  * MSM driver version:
@@ -307,10 +304,6 @@ static int msm_drm_uninit(struct device *dev)
 
 	component_unbind_all(dev, ddev);
 
-#ifdef CONFIG_DRM_MSM_DPU
-	dpu_dbg_destroy();
-#endif
-
 	debugfs_remove_recursive(priv->debug_root);
 
 	if (mdss && mdss->funcs)
@@ -485,14 +478,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
 
 	drm_mode_config_init(ddev);
 
-#ifdef CONFIG_DRM_MSM_DPU
-	ret = dpu_dbg_init(&pdev->dev);
-	if (ret) {
-		dev_err(dev, "failed to init dpu dbg: %d\n", ret);
-		goto dbg_init_fail;
-	}
-#endif
-
 	msm_gem_shrinker_init(ddev);
 
 	ret = msm_init_vram(ddev);
@@ -511,11 +496,9 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
 	case KMS_MDP5:
 		kms = mdp5_kms_init(ddev);
 		break;
-#ifdef CONFIG_DRM_MSM_DPU
 	case KMS_DPU:
 		kms = dpu_kms_init(ddev);
 		break;
-#endif
 	default:
 		kms = ERR_PTR(-ENODEV);
 		break;
@@ -665,14 +648,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
 		goto fail;
 	}
 
-#ifdef CONFIG_DRM_MSM_DPU
-	ret = dpu_dbg_debugfs_register(priv->debug_root);
-	if (ret) {
-		dev_err(dev, "failed to reg dpu dbg debugfs: %d\n", ret);
-		goto fail;
-	}
-#endif
-
 	/* perform subdriver post initialization */
 	if (kms && kms->funcs && kms->funcs->postinit) {
 		ret = kms->funcs->postinit(kms);
@@ -690,10 +665,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
 	msm_drm_uninit(dev);
 	return ret;
 bind_fail:
-#ifdef CONFIG_DRM_MSM_DPU
-	dpu_dbg_destroy();
-dbg_init_fail:
-#endif
 	if (mdss && mdss->funcs)
 		mdss->funcs->destroy(ddev);
 mdss_init_fail:
@@ -1413,9 +1384,7 @@ static int msm_pdev_remove(struct platform_device *pdev)
 static const struct of_device_id dt_match[] = {
 	{ .compatible = "qcom,mdp4", .data = (void *)KMS_MDP4 },
 	{ .compatible = "qcom,mdss", .data = (void *)KMS_MDP5 },
-#ifdef CONFIG_DRM_MSM_DPU
 	{ .compatible = "qcom,dpu-mdss", .data = (void *)KMS_DPU },
-#endif
 	{}
 };
 MODULE_DEVICE_TABLE(of, dt_match);
@@ -1430,16 +1399,6 @@ static struct platform_driver msm_platform_driver = {
 	},
 };
 
-#ifdef CONFIG_QCOM_KGSL
-void __init adreno_register(void)
-{
-}
-
-void __exit adreno_unregister(void)
-{
-}
-#endif
-
 static int __init msm_drm_register(void)
 {
 	if (!modeset)
-- 
Sean Paul, Software Engineer, Google / Chromium OS



More information about the Freedreno mailing list