summaryrefslogtreecommitdiff
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>2020-08-04 17:42:16 +0100
commit7dd85aac7fb8f5f66270a2a1d9a262914a7a2ae8 (patch)
tree770b434688ad60d673cb91a12891c48b735504da
parent92839b0f00d02b64eb87c1fa80fade781cfbba32 (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 12e641eb8548..11c3b261a2e6 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -272,11 +272,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;
@@ -299,6 +294,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,
@@ -330,24 +341,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);
}