summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2018-06-24 14:03:31 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-10-30 13:21:46 +0000
commit3408ef26a44402a64475c498fb65ace792a3306d (patch)
tree558e47e41bac1cb0aa805c5928b91a7574300c64
parent87125ba103873bbdeb0e0f08d10ce8e1daf1709a (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 9200ede96427..ad3393f2c813 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -231,11 +231,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, component_compare_dev_name, &armada_master_ops);
- if (ret != -EINVAL)
- return ret;
if (dev->platform_data) {
char **devices = dev->platform_data;
@@ -258,6 +253,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, component_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,
@@ -289,8 +300,11 @@ 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;
if (drm_firmware_drivers_only())
@@ -298,16 +312,40 @@ static int __init armada_drm_init(void)
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);
}