lkml.org 
[lkml]   [2022]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v5 09/32] drm/malidp: Migrate to aggregate driver
Date
Use an aggregate driver instead of component ops so that we can get
proper driver probe ordering of the aggregate device with respect to all
the component devices that make up the aggregate device.

TODO: This can be updated to move the drm helper logic into the
aggregate driver shutdown op.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
drivers/gpu/drm/arm/malidp_drv.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 78d15b04b105..e6ee4d1e3bb8 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -702,8 +702,9 @@ static int malidp_runtime_pm_resume(struct device *dev)
return 0;
}

-static int malidp_bind(struct device *dev)
+static int malidp_bind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct resource *res;
struct drm_device *drm;
struct malidp_drm *malidp;
@@ -894,8 +895,9 @@ static int malidp_bind(struct device *dev)
return ret;
}

-static void malidp_unbind(struct device *dev)
+static void malidp_unbind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct drm_device *drm = dev_get_drvdata(dev);
struct malidp_drm *malidp = drm->dev_private;
struct malidp_hw_device *hwdev = malidp->dev;
@@ -921,9 +923,13 @@ static void malidp_unbind(struct device *dev)
of_reserved_mem_device_release(dev);
}

-static const struct component_master_ops malidp_master_ops = {
- .bind = malidp_bind,
- .unbind = malidp_unbind,
+static struct aggregate_driver malidp_aggregate_driver = {
+ .probe = malidp_bind,
+ .remove = malidp_unbind,
+ .driver = {
+ .name = "malidp_drm",
+ .owner = THIS_MODULE,
+ },
};

static int malidp_compare_dev(struct device *dev, void *data)
@@ -949,13 +955,12 @@ static int malidp_platform_probe(struct platform_device *pdev)
drm_of_component_match_add(&pdev->dev, &match, malidp_compare_dev,
port);
of_node_put(port);
- return component_master_add_with_match(&pdev->dev, &malidp_master_ops,
- match);
+ return component_aggregate_register(&pdev->dev, &malidp_aggregate_driver, match);
}

static int malidp_platform_remove(struct platform_device *pdev)
{
- component_master_del(&pdev->dev, &malidp_master_ops);
+ component_aggregate_unregister(&pdev->dev, &malidp_aggregate_driver);
return 0;
}

--
https://chromeos.dev
\
 
 \ /
  Last update: 2022-01-06 22:47    [W:0.225 / U:1.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site