[PATCH v3 07/11] drm: omapdrm: Register omapdrm platform device in omapdss driver

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Aug 11 13:49:08 UTC 2017


The omapdrm platform device is a virtual device created for the sole
purpose of handling the omapdss/omapdrm driver split. It should
eventually be removed. As a first step to ease refactoring move its
registration from platform code to driver code.

The omapdrm driver name must be changed internally to avoid probing both
the device registered in platform code and the device registered in the
omapdss driver, as that would otherwise break bisection.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
---
Changes since v1:

- Drop the CONFIG_DRM_OMAP conditional compilation
- Unregister the platform device at exit time
---
 drivers/gpu/drm/omapdrm/dss/core.c | 15 +++++++++++++++
 drivers/gpu/drm/omapdrm/omap_drv.c |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/core.c b/drivers/gpu/drm/omapdrm/dss/core.c
index 4dabe32c7098..8678d8b4efce 100644
--- a/drivers/gpu/drm/omapdrm/dss/core.c
+++ b/drivers/gpu/drm/omapdrm/dss/core.c
@@ -22,6 +22,7 @@
 
 #define DSS_SUBSYS_NAME "CORE"
 
+#include <linux/dma-mapping.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/clk.h>
@@ -103,6 +104,14 @@ static void (*dss_output_drv_unreg_funcs[])(void) = {
 	dss_uninit_platform_driver,
 };
 
+static struct platform_device omap_drm_device = {
+	.dev = {
+		.coherent_dma_mask = DMA_BIT_MASK(32),
+	},
+	.name = "omapdrm_",
+	.id = 0,
+};
+
 static int __init omap_dss_init(void)
 {
 	int r;
@@ -118,6 +127,10 @@ static int __init omap_dss_init(void)
 			goto err_reg;
 	}
 
+	r = platform_device_register(&omap_drm_device);
+	if (r)
+		goto err_reg;
+
 	return 0;
 
 err_reg:
@@ -135,6 +148,8 @@ static void __exit omap_dss_exit(void)
 {
 	int i;
 
+	platform_device_unregister(&omap_drm_device);
+
 	for (i = 0; i < ARRAY_SIZE(dss_output_drv_unreg_funcs); ++i)
 		dss_output_drv_unreg_funcs[i]();
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 022029ea6972..9ab22e0c0b84 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -734,7 +734,7 @@ static SIMPLE_DEV_PM_OPS(omapdrm_pm_ops, omap_drm_suspend, omap_drm_resume);
 
 static struct platform_driver pdev = {
 	.driver = {
-		.name = DRIVER_NAME,
+		.name = "omapdrm_",
 		.pm = &omapdrm_pm_ops,
 	},
 	.probe = pdev_probe,
-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list