[Freedreno] [PATCH v5 17/32] drm/mediatek: Migrate to aggregate driver
Stephen Boyd
swboyd at chromium.org
Thu Jan 6 21:45:40 UTC 2022
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: Chun-Kuang Hu <chunkuang.hu at kernel.org>
Cc: Philipp Zabel <p.zabel at pengutronix.de>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: "Rafael J. Wysocki" <rafael at kernel.org>
Cc: Rob Clark <robdclark at gmail.com>
Cc: Russell King <rmk+kernel at arm.linux.org.uk>
Cc: Saravana Kannan <saravanak at google.com>
Signed-off-by: Stephen Boyd <swboyd at chromium.org>
---
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index aec39724ebeb..a3f27b8c9769 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -348,8 +348,9 @@ static int compare_of(struct device *dev, void *data)
return dev->of_node == data;
}
-static int mtk_drm_bind(struct device *dev)
+static int mtk_drm_bind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct mtk_drm_private *private = dev_get_drvdata(dev);
struct drm_device *drm;
int ret;
@@ -380,8 +381,9 @@ static int mtk_drm_bind(struct device *dev)
return ret;
}
-static void mtk_drm_unbind(struct device *dev)
+static void mtk_drm_unbind(struct aggregate_device *adev)
{
+ struct device *dev = adev->parent;
struct mtk_drm_private *private = dev_get_drvdata(dev);
drm_dev_unregister(private->drm);
@@ -391,9 +393,13 @@ static void mtk_drm_unbind(struct device *dev)
private->drm = NULL;
}
-static const struct component_master_ops mtk_drm_ops = {
- .bind = mtk_drm_bind,
- .unbind = mtk_drm_unbind,
+static struct aggregate_driver mtk_drm_aggregate_driver = {
+ .probe = mtk_drm_bind,
+ .remove = mtk_drm_unbind,
+ .driver = {
+ .name = "mtk_drm",
+ .owner = THIS_MODULE,
+ },
};
static const struct of_device_id mtk_ddp_comp_dt_ids[] = {
@@ -593,7 +599,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, private);
- ret = component_master_add_with_match(dev, &mtk_drm_ops, match);
+ ret = component_aggregate_register(dev, &mtk_drm_aggregate_driver, match);
if (ret)
goto err_pm;
@@ -616,7 +622,7 @@ static int mtk_drm_remove(struct platform_device *pdev)
struct mtk_drm_private *private = platform_get_drvdata(pdev);
int i;
- component_master_del(&pdev->dev, &mtk_drm_ops);
+ component_aggregate_unregister(&pdev->dev, &mtk_drm_aggregate_driver);
pm_runtime_disable(&pdev->dev);
of_node_put(private->mutex_node);
for (i = 0; i < DDP_COMPONENT_ID_MAX; i++)
--
https://chromeos.dev
More information about the Freedreno
mailing list