[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211202222732.2453851-18-swboyd@chromium.org>
Date: Thu, 2 Dec 2021 14:27:15 -0800
From: Stephen Boyd <swboyd@...omium.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
dri-devel@...ts.freedesktop.org, freedreno@...ts.freedesktop.org,
Daniel Vetter <daniel.vetter@...ll.ch>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Rob Clark <robdclark@...il.com>,
Russell King <rmk+kernel@....linux.org.uk>,
Saravana Kannan <saravanak@...gle.com>
Subject: [PATCH v4 17/34] drm/mcde: Migrate to aggregate driver
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@...ll.ch>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Rob Clark <robdclark@...il.com>
Cc: Russell King <rmk+kernel@....linux.org.uk>
Cc: Saravana Kannan <saravanak@...gle.com>
Signed-off-by: Stephen Boyd <swboyd@...omium.org>
---
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..1652f9e0601d 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 = adev->parent;
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 = adev->parent;
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
Powered by blists - more mailing lists