[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1418226513-14105-12-git-send-email-a.hajda@samsung.com>
Date: Wed, 10 Dec 2014 16:48:29 +0100
From: Andrzej Hajda <a.hajda@...sung.com>
To: linux-kernel@...r.kernel.org (open list)
Cc: Andrzej Hajda <a.hajda@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mike Turquette <mturquette@...aro.org>,
Russell King <linux@....linux.org.uk>,
Linus Walleij <linus.walleij@...aro.org>,
Alexandre Courbot <gnurou@...il.com>,
Thierry Reding <thierry.reding@...il.com>,
Inki Dae <inki.dae@...sung.com>,
Kishon Vijay Abraham I <kishon@...com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Grant Likely <grant.likely@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
linux-arm-kernel@...ts.infradead.org (moderated list:ARM/CLKDEV SUPPORT),
linux-gpio@...r.kernel.org (open list:GPIO SUBSYSTEM),
dri-devel@...ts.freedesktop.org (open list:DRM PANEL DRIVERS),
linux-samsung-soc@...r.kernel.org (moderated list:ARM/S5P EXYNOS AR...),
devicetree@...r.kernel.org (open list:OPEN FIRMWARE AND...),
boris.brezillon@...e-electrons.com
Subject: [RFC 11/15] drm/exynos/dsi: convert to restrack API
Convert exynos_dsi driver to use restrack API.
As a result driver have following advantages:
- correctly handles removal of resources,
- do not need to defer probing, so as a result the whole drm system
initialization will not be postponed to late initcall, unless other
components delays it,
- simplified initialization.
Signed-off-by: Andrzej Hajda <a.hajda@...sung.com>
---
drivers/gpu/drm/exynos/exynos_drm_dsi.c | 52 +++++++++++++--------------------
1 file changed, 21 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 8201d79..53ac467 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -23,7 +23,7 @@
#include <linux/phy/phy.h>
#include <linux/regulator/consumer.h>
#include <linux/component.h>
-
+#include <linux/restrack.h>
#include <video/mipi_display.h>
#include <video/videomode.h>
@@ -1690,9 +1690,18 @@ static const struct component_ops exynos_dsi_component_ops = {
.unbind = exynos_dsi_unbind,
};
+void exynos_dsi_restrack_cb(struct device *dev, int ret)
+{
+ if (ret)
+ component_del(dev, &exynos_dsi_component_ops);
+ else
+ component_add(dev, &exynos_dsi_component_ops);
+}
+
static int exynos_dsi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct restrack_ctx *rtrack;
struct resource *res;
struct exynos_dsi *dsi;
int ret;
@@ -1728,26 +1737,6 @@ static int exynos_dsi_probe(struct platform_device *pdev)
dsi->supplies[0].supply = "vddcore";
dsi->supplies[1].supply = "vddio";
- ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(dsi->supplies),
- dsi->supplies);
- if (ret) {
- dev_info(dev, "failed to get regulators: %d\n", ret);
- return -EPROBE_DEFER;
- }
-
- dsi->pll_clk = devm_clk_get(dev, "pll_clk");
- if (IS_ERR(dsi->pll_clk)) {
- dev_info(dev, "failed to get dsi pll input clock\n");
- ret = PTR_ERR(dsi->pll_clk);
- goto err_del_component;
- }
-
- dsi->bus_clk = devm_clk_get(dev, "bus_clk");
- if (IS_ERR(dsi->bus_clk)) {
- dev_info(dev, "failed to get dsi bus clock\n");
- ret = PTR_ERR(dsi->bus_clk);
- goto err_del_component;
- }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
dsi->reg_base = devm_ioremap_resource(dev, res);
@@ -1757,13 +1746,6 @@ static int exynos_dsi_probe(struct platform_device *pdev)
goto err_del_component;
}
- dsi->phy = devm_phy_get(dev, "dsim");
- if (IS_ERR(dsi->phy)) {
- dev_info(dev, "failed to get dsim phy\n");
- ret = PTR_ERR(dsi->phy);
- goto err_del_component;
- }
-
dsi->irq = platform_get_irq(pdev, 0);
if (dsi->irq < 0) {
dev_err(dev, "failed to request dsi irq resource\n");
@@ -1782,11 +1764,20 @@ static int exynos_dsi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, &dsi->display);
- ret = component_add(dev, &exynos_dsi_component_ops);
+ rtrack = devm_restrack_register(dsi->dev, exynos_dsi_restrack_cb,
+ regulator_bulk_restrack_desc(&dsi->supplies[0]),
+ regulator_bulk_restrack_desc(&dsi->supplies[1]),
+ clk_restrack_desc(&dsi->pll_clk, "pll_clk"),
+ clk_restrack_desc(&dsi->bus_clk, "bus_clk"),
+ phy_restrack_desc(&dsi->phy, "dsim"),
+ );
+
+ ret = PTR_ERR_OR_ZERO(rtrack);
+
if (ret)
goto err_del_component;
- return ret;
+ return 0;
err_del_component:
exynos_drm_component_del(dev, EXYNOS_DEVICE_TYPE_CONNECTOR);
@@ -1795,7 +1786,6 @@ err_del_component:
static int exynos_dsi_remove(struct platform_device *pdev)
{
- component_del(&pdev->dev, &exynos_dsi_component_ops);
exynos_drm_component_del(&pdev->dev, EXYNOS_DEVICE_TYPE_CONNECTOR);
return 0;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists