summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2018-06-24 14:03:31 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2019-11-29 10:33:30 +0000
commit98dff286fdec1079e1f8368554d5b21de753341d (patch)
tree0ff209e393d603b3c9622cadfed0e78f050bdd7e
parentc404a1ce365b33d37b6a442edd204ae405214b4d (diff)
drm/armada: add detection of DT LCD controllers for probing
Using a virtual device is deprecated, so we have no option but to detect the presence of available LCD controllers in DT and probe all LCD controllers together within one DRM device. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--drivers/gpu/drm/armada/armada_drv.c52
1 files changed, 45 insertions, 7 deletions
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index 2a84ca8f5795..3df2dacf4c94 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -270,11 +270,6 @@ static int armada_drm_probe(struct platform_device *pdev)
{
struct component_match *match = NULL;
struct device *dev = &pdev->dev;
- int ret;
-
- ret = drm_of_component_probe(dev, compare_dev_name, &armada_master_ops);
- if (ret != -EINVAL)
- return ret;
if (dev->platform_data) {
char **devices = dev->platform_data;
@@ -297,6 +292,22 @@ static int armada_drm_probe(struct platform_device *pdev)
armada_add_endpoints(dev, &match, d->of_node);
put_device(d);
}
+ } else {
+ struct device_node *np;
+
+ for_each_compatible_node(np, NULL, "marvell,armada-lcdc") {
+ if (!of_device_is_available(np))
+ continue;
+
+ drm_of_component_match_add(dev, &match, compare_of, np);
+ }
+
+ for_each_compatible_node(np, NULL, "marvell,armada-lcdc") {
+ if (!of_device_is_available(np))
+ continue;
+
+ armada_add_endpoints(dev, &match, np);
+ }
}
return component_master_add_with_match(&pdev->dev, &armada_master_ops,
@@ -328,24 +339,51 @@ static struct platform_driver armada_drm_platform_driver = {
.id_table = armada_drm_platform_ids,
};
+static struct platform_device *armada_device;
+
static int __init armada_drm_init(void)
{
+ struct device_node *np;
int ret;
armada_drm_driver.num_ioctls = ARRAY_SIZE(armada_ioctls);
ret = platform_driver_register(&armada_lcd_platform_driver);
if (ret)
- return ret;
+ goto err_lcd;
+
ret = platform_driver_register(&armada_drm_platform_driver);
if (ret)
- platform_driver_unregister(&armada_lcd_platform_driver);
+ goto err_drm;
+
+ for_each_compatible_node(np, NULL, "marvell,armada-lcdc") {
+ if (!of_device_is_available(np))
+ continue;
+
+ of_node_put(np);
+ armada_device = platform_device_register_simple(
+ "armada-drm", -1, NULL, 0);
+ if (IS_ERR(armada_device)) {
+ ret = PTR_ERR(armada_device);
+ goto err_dev;
+ }
+ break;
+ }
+ return 0;
+
+ err_dev:
+ platform_driver_unregister(&armada_drm_platform_driver);
+ err_drm:
+ platform_driver_unregister(&armada_lcd_platform_driver);
+ err_lcd:
return ret;
}
module_init(armada_drm_init);
static void __exit armada_drm_exit(void)
{
+ if (armada_device)
+ platform_device_unregister(armada_device);
platform_driver_unregister(&armada_drm_platform_driver);
platform_driver_unregister(&armada_lcd_platform_driver);
}