This patch makes sure that mipi dsi driver makes it re-probe
in case that panel driver isn't probed yet.

For this, it checks if panel driver is probed or not before
component_add() is called.

Signed-off-by: Inki Dae <inki....@samsung.com>
Acked-by: Kyungmin Park <kyungmin.p...@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c |   38 +++++++++++++++----------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 1421d9b..22503f3 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1166,11 +1166,8 @@ exynos_dsi_detect(struct drm_connector *connector, bool 
force)
 {
        struct exynos_dsi *dsi = connector_to_dsi(connector);
 
-       if (!dsi->panel) {
-               dsi->panel = of_drm_find_panel(dsi->panel_node);
-               if (dsi->panel)
-                       drm_panel_attach(dsi->panel, &dsi->connector);
-       } else if (!dsi->panel_node) {
+        /* Power off if panel driver is removed. */
+       if (!dsi->panel_node) {
                struct exynos_drm_display *display;
 
                display = platform_get_drvdata(to_platform_device(dsi->dev));
@@ -1383,19 +1380,8 @@ static int exynos_dsi_bind(struct device *dev, struct 
device *master,
                                void *data)
 {
        struct drm_device *drm_dev = data;
-       struct exynos_dsi *dsi;
-       int ret;
 
-       ret = exynos_drm_create_enc_conn(drm_dev, &exynos_dsi_display);
-       if (ret) {
-               DRM_ERROR("Encoder create [%d] failed with %d\n",
-                               exynos_dsi_display.type, ret);
-               return ret;
-       }
-
-       dsi = exynos_dsi_display.ctx;
-
-       return mipi_dsi_host_register(&dsi->dsi_host);
+       return exynos_drm_create_enc_conn(drm_dev, &exynos_dsi_display);
 }
 
 static void exynos_dsi_unbind(struct device *dev, struct device *master,
@@ -1406,8 +1392,6 @@ static void exynos_dsi_unbind(struct device *dev, struct 
device *master,
 
        exynos_dsi_dpms(&exynos_dsi_display, DRM_MODE_DPMS_OFF);
 
-       mipi_dsi_host_unregister(&dsi->dsi_host);
-
        encoder->funcs->destroy(encoder);
        drm_connector_cleanup(&dsi->connector);
 }
@@ -1502,6 +1486,18 @@ static int exynos_dsi_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, &exynos_dsi_display);
 
+       ret = mipi_dsi_host_register(&dsi->dsi_host);
+       if (ret)
+               goto err_del_component;
+
+       dsi->panel = of_drm_find_panel(dsi->panel_node);
+       if (!dsi->panel) {
+               mipi_dsi_host_unregister(&dsi->dsi_host);
+               return -EPROBE_DEFER;
+       }
+
+       drm_panel_attach(dsi->panel, &dsi->connector);
+
        ret = component_add(&pdev->dev, &exynos_dsi_component_ops);
        if (ret)
                goto err_del_component;
@@ -1515,6 +1511,10 @@ err_del_component:
 
 static int exynos_dsi_remove(struct platform_device *pdev)
 {
+       struct exynos_dsi *dsi = exynos_dsi_display.ctx;
+
+       mipi_dsi_host_unregister(&dsi->dsi_host);
+
        component_del(&pdev->dev, &exynos_dsi_component_ops);
        exynos_drm_component_del(&pdev->dev);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to