[PATCH v6 16/35] drm/mcde: Migrate to aggregate driver
From: Stephen Boyd
Date: Thu Jan 27 2022 - 15:02:40 EST
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.
Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
Cc: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
Cc: Rob Clark <robdclark@xxxxxxxxx>
Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
Cc: Saravana Kannan <saravanak@xxxxxxxxxx>
Tested-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
---
drivers/gpu/drm/mcde/mcde_drv.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
index 5b5afc6aaf8e..b8479355844e 100644
--- a/drivers/gpu/drm/mcde/mcde_drv.c
+++ b/drivers/gpu/drm/mcde/mcde_drv.c
@@ -215,8 +215,9 @@ static const struct drm_driver mcde_drm_driver = {
DRM_GEM_CMA_DRIVER_OPS,
};
-static int mcde_drm_bind(struct device *dev)
+static int mcde_drm_bind(struct aggregate_device *adev)
{
+ struct device *dev = aggregate_device_parent(adev);
struct drm_device *drm = dev_get_drvdata(dev);
int ret;
@@ -247,8 +248,9 @@ static int mcde_drm_bind(struct device *dev)
return ret;
}
-static void mcde_drm_unbind(struct device *dev)
+static void mcde_drm_unbind(struct aggregate_device *adev)
{
+ struct device *dev = aggregate_device_parent(adev);
struct drm_device *drm = dev_get_drvdata(dev);
drm_dev_unregister(drm);
@@ -256,9 +258,13 @@ static void mcde_drm_unbind(struct device *dev)
component_unbind_all(drm->dev, drm);
}
-static const struct component_master_ops mcde_drm_comp_ops = {
- .bind = mcde_drm_bind,
- .unbind = mcde_drm_unbind,
+static struct aggregate_driver mcde_drm_comp_driver = {
+ .probe = mcde_drm_bind,
+ .remove = mcde_drm_unbind,
+ .driver = {
+ .name = "mcde_drm",
+ .owner = THIS_MODULE,
+ },
};
static struct platform_driver *const mcde_component_drivers[] = {
@@ -419,7 +425,7 @@ static int mcde_probe(struct platform_device *pdev)
* Perform an invasive reset of the MCDE and all blocks by
* cutting the power to the subsystem, then bring it back up
* later when we enable the display as a result of
- * component_master_add_with_match().
+ * component_aggregate_register().
*/
ret = regulator_disable(mcde->epod);
if (ret) {
@@ -429,8 +435,7 @@ static int mcde_probe(struct platform_device *pdev)
/* Wait 50 ms so we are sure we cut the power */
usleep_range(50000, 70000);
- ret = component_master_add_with_match(&pdev->dev, &mcde_drm_comp_ops,
- match);
+ ret = component_aggregate_register(&pdev->dev, &mcde_drm_comp_driver, match);
if (ret) {
dev_err(dev, "failed to add component master\n");
/*
@@ -459,7 +464,7 @@ static int mcde_remove(struct platform_device *pdev)
struct drm_device *drm = platform_get_drvdata(pdev);
struct mcde *mcde = to_mcde(drm);
- component_master_del(&pdev->dev, &mcde_drm_comp_ops);
+ component_aggregate_unregister(&pdev->dev, &mcde_drm_comp_driver);
clk_disable_unprepare(mcde->mcde_clk);
regulator_disable(mcde->vana);
regulator_disable(mcde->epod);
--
https://chromeos.dev