summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2018-01-24 15:30:29 +0100
committerLucas Stach <l.stach@pengutronix.de>2018-02-12 16:31:04 +0100
commit246774d17fc05a9b33c769c937003cc73d258674 (patch)
tree8b3d61c7d9c280270bdeb6da1f5194264264e004 /drivers/gpu/drm
parentdt-bindings: etnaviv: add slave interface clock (diff)
downloadlinux-246774d17fc05a9b33c769c937003cc73d258674.tar.xz
linux-246774d17fc05a9b33c769c937003cc73d258674.zip
drm/etnaviv: remove the need for a gpu-subsystem DT node
The module autoloading can be triggered through the GPU core nodes and the necessary platform device for the DRM toplevel device will be instantiated on module init. Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_drv.c36
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c1
2 files changed, 20 insertions, 17 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 8a73414682b2..ab50090d066c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -653,25 +653,21 @@ static int compare_str(struct device *dev, void *data)
static int etnaviv_pdev_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct device_node *node = dev->of_node;
struct component_match *match = NULL;
dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
- if (node) {
+ if (!dev->platform_data) {
struct device_node *core_node;
- int i;
- for (i = 0; ; i++) {
- core_node = of_parse_phandle(node, "cores", i);
- if (!core_node)
- break;
+ for_each_compatible_node(core_node, NULL, "vivante,gc") {
+ if (!of_device_is_available(core_node))
+ continue;
drm_of_component_match_add(&pdev->dev, &match,
compare_of, core_node);
- of_node_put(core_node);
}
- } else if (dev->platform_data) {
+ } else {
char **names = dev->platform_data;
unsigned i;
@@ -689,25 +685,18 @@ static int etnaviv_pdev_remove(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id dt_match[] = {
- { .compatible = "fsl,imx-gpu-subsystem" },
- { .compatible = "marvell,dove-gpu-subsystem" },
- {}
-};
-MODULE_DEVICE_TABLE(of, dt_match);
-
static struct platform_driver etnaviv_platform_driver = {
.probe = etnaviv_pdev_probe,
.remove = etnaviv_pdev_remove,
.driver = {
.name = "etnaviv",
- .of_match_table = dt_match,
},
};
static int __init etnaviv_init(void)
{
int ret;
+ struct device_node *np;
etnaviv_validate_init();
@@ -719,6 +708,19 @@ static int __init etnaviv_init(void)
if (ret != 0)
platform_driver_unregister(&etnaviv_gpu_driver);
+ /*
+ * If the DT contains at least one available GPU device, instantiate
+ * the DRM platform device.
+ */
+ for_each_compatible_node(np, NULL, "vivante,gc") {
+ if (!of_device_is_available(np))
+ continue;
+
+ platform_device_register_simple("etnaviv", -1, NULL, 0);
+ of_node_put(np);
+ break;
+ }
+
return ret;
}
module_init(etnaviv_init);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 1309de3c7190..94fa3d3244fb 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1637,6 +1637,7 @@ static const struct of_device_id etnaviv_gpu_match[] = {
},
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, etnaviv_gpu_match);
static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
{