Linux Samsung SOC development
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org
Cc: linux-samsung-soc@vger.kernel.org, a.hajda@samsung.com,
	rmk+kernel@arm.linux.org.uk, Inki Dae <inki.dae@samsung.com>
Subject: [PATCH 2/2] drm/exynos: mipi-dsi: consider panel driver-deferred probe
Date: Tue, 27 May 2014 21:42:43 +0900	[thread overview]
Message-ID: <1401194563-803-3-git-send-email-inki.dae@samsung.com> (raw)
In-Reply-To: <1401194563-803-1-git-send-email-inki.dae@samsung.com>

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.dae@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@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

  parent reply	other threads:[~2014-05-27 12:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-27 12:42 [PATCH 0/2] drm/exynos: consider deferred probe case Inki Dae
2014-05-27 12:42 ` [PATCH 1/2] " Inki Dae
2014-05-28 11:22   ` Andrzej Hajda
2014-05-27 12:42 ` Inki Dae [this message]
2014-05-28  7:58   ` [PATCH 2/2] drm/exynos: mipi-dsi: consider panel driver-deferred probe Andrzej Hajda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401194563-803-3-git-send-email-inki.dae@samsung.com \
    --to=inki.dae@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox