All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda@samsung.com>
To: dri-devel@lists.freedesktop.org,
	linux-samsung-soc@vger.kernel.org,
	Inki Dae <inki.dae@samsung.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Rob Herring <robh+dt@kernel.org>,
	Maciej Purski <m.purski@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: [PATCH v5 2/9] drm/exynos: move connector creation to attach callback
Date: Wed, 25 Jul 2018 17:46:37 +0200	[thread overview]
Message-ID: <20180725154644.25412-3-a.hajda@samsung.com> (raw)
In-Reply-To: <20180725154644.25412-1-a.hajda@samsung.com>

From: Maciej Purski <m.purski@samsung.com>

The current implementation assumes that the only possible peripheral
device for DSIM is a panel. Using an output bridge child device
should also be possible.

If an output bridge is available, don't create a new connector.
Instead, call drm_bridge_attach() and set encoder's bridge to NULL
in order to avoid an out bridge from being visible by the framework, as
the DSI bus needs control on enabling its child output bridge.

Such sequence is required by Toshiba TC358764 bridge, which is a DSI
peripheral bridge device.

changed in v5:
- detach bridge in mipi_dsi detach callback

Signed-off-by: Maciej Purski <m.purski@samsung.com>
[ a.hajda@samsung.com: v5 ]
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 50 ++++++++++++++++---------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 351403f9d245..f5f51f584fa0 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -255,6 +255,7 @@ struct exynos_dsi {
 	struct mipi_dsi_host dsi_host;
 	struct drm_connector connector;
 	struct drm_panel *panel;
+	struct drm_bridge *out_bridge;
 	struct device *dev;
 
 	void __iomem *reg_base;
@@ -1499,7 +1500,30 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
 				  struct mipi_dsi_device *device)
 {
 	struct exynos_dsi *dsi = host_to_dsi(host);
-	struct drm_device *drm = dsi->connector.dev;
+	struct drm_encoder *encoder = &dsi->encoder;
+	struct drm_device *drm = encoder->dev;
+	struct drm_bridge *out_bridge;
+
+	out_bridge  = of_drm_find_bridge(device->dev.of_node);
+	if (out_bridge) {
+		drm_bridge_attach(encoder, out_bridge, NULL);
+		dsi->out_bridge = out_bridge;
+		encoder->bridge = NULL;
+	} else {
+		int ret = exynos_dsi_create_connector(encoder);
+
+		if (ret) {
+			DRM_ERROR("failed to create connector ret = %d\n", ret);
+			drm_encoder_cleanup(encoder);
+			return ret;
+		}
+
+		dsi->panel = of_drm_find_panel(device->dev.of_node);
+		if (dsi->panel) {
+			drm_panel_attach(dsi->panel, &dsi->connector);
+			dsi->connector.status = connector_status_connected;
+		}
+	}
 
 	/*
 	 * This is a temporary solution and should be made by more generic way.
@@ -1518,11 +1542,6 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
 	dsi->lanes = device->lanes;
 	dsi->format = device->format;
 	dsi->mode_flags = device->mode_flags;
-	dsi->panel = of_drm_find_panel(device->dev.of_node);
-	if (dsi->panel) {
-		drm_panel_attach(dsi->panel, &dsi->connector);
-		dsi->connector.status = connector_status_connected;
-	}
 	exynos_drm_crtc_get_by_type(drm, EXYNOS_DISPLAY_TYPE_LCD)->i80_mode =
 			!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO);
 
@@ -1538,19 +1557,21 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host,
 				  struct mipi_dsi_device *device)
 {
 	struct exynos_dsi *dsi = host_to_dsi(host);
-	struct drm_device *drm = dsi->connector.dev;
-
-	mutex_lock(&drm->mode_config.mutex);
+	struct drm_device *drm = dsi->encoder.dev;
 
 	if (dsi->panel) {
+		mutex_lock(&drm->mode_config.mutex);
 		exynos_dsi_disable(&dsi->encoder);
 		drm_panel_detach(dsi->panel);
 		dsi->panel = NULL;
 		dsi->connector.status = connector_status_disconnected;
+		mutex_unlock(&drm->mode_config.mutex);
+	} else {
+		if (dsi->out_bridge->funcs->detach)
+			dsi->out_bridge->funcs->detach(dsi->out_bridge);
+		dsi->out_bridge = NULL;
 	}
 
-	mutex_unlock(&drm->mode_config.mutex);
-
 	if (drm->mode_config.poll_enabled)
 		drm_kms_helper_hotplug_event(drm);
 
@@ -1654,13 +1675,6 @@ static int exynos_dsi_bind(struct device *dev, struct device *master,
 	if (ret < 0)
 		return ret;
 
-	ret = exynos_dsi_create_connector(encoder);
-	if (ret) {
-		DRM_ERROR("failed to create connector ret = %d\n", ret);
-		drm_encoder_cleanup(encoder);
-		return ret;
-	}
-
 	if (dsi->in_bridge_node) {
 		in_bridge = of_drm_find_bridge(dsi->in_bridge_node);
 		if (in_bridge)
-- 
2.18.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-07-25 15:46 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180725154658eucas1p14acd753797d90debffca5b6ff6576b33@eucas1p1.samsung.com>
2018-07-25 15:46 ` [PATCH v5 0/9] Add TOSHIBA TC358764 DSI/LVDS bridge driver Andrzej Hajda
     [not found]   ` <CGME20180725154659eucas1p17b6862ede839fa0d091acff69090e87b@eucas1p1.samsung.com>
2018-07-25 15:46     ` [PATCH v5 1/9] drm/exynos: rename bridge_node to in_bridge_node Andrzej Hajda
     [not found]   ` <CGME20180725154659eucas1p116f3a5e735333b07bcf9808f00694f3c@eucas1p1.samsung.com>
2018-07-25 15:46     ` Andrzej Hajda [this message]
2018-08-07  8:53       ` [PATCH v5 2/9] drm/exynos: move connector creation to attach callback Inki Dae
2018-08-13 11:17         ` Andrzej Hajda
2018-08-17  1:56           ` Inki Dae
2018-08-20  9:00             ` Andrzej Hajda
2018-08-21  5:27               ` Inki Dae
2018-08-21 11:21                 ` Andrzej Hajda
2018-08-22  2:59                   ` Inki Dae
2018-08-23  9:50                     ` Andrzej Hajda
     [not found]   ` <CGME20180725154700eucas1p1ae0db40d64d3ccdd59ef992c9e02aa4b@eucas1p1.samsung.com>
2018-07-25 15:46     ` [PATCH v5 3/9] drm/exynos: enable out_bridge in exynos_dsi_enable Andrzej Hajda
     [not found]   ` <CGME20180725154700eucas1p148d715003b77bc3686e25ebd22a3e57a@eucas1p1.samsung.com>
2018-07-25 15:46     ` [PATCH v5 4/9] dt-bindings: tc358754: add DT bindings Andrzej Hajda
     [not found]   ` <CGME20180725154701eucas1p1301a4793a9d76f38cc75abbc40848164@eucas1p1.samsung.com>
2018-07-25 15:46     ` [PATCH v5 5/9] drm/bridge: tc358764: Add DSI to LVDS bridge driver Andrzej Hajda
2018-07-26  7:36       ` Archit Taneja
2018-07-27  7:17         ` Andrzej Hajda
2018-07-27 10:30           ` Laurent Pinchart
2018-07-27 11:06             ` Andrzej Hajda
     [not found]   ` <CGME20180725154701eucas1p1396ca9e1b9e93868a688b51ec9ca443f@eucas1p1.samsung.com>
2018-07-25 15:46     ` [PATCH v5 6/9] ARM: dts: exynos5250: add DSI node Andrzej Hajda
2018-07-26  7:48       ` Krzysztof Kozlowski
2018-08-29 18:51       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180725154702eucas1p1312eaf0253ce9c67de7d9cf3bf43e5f4@eucas1p1.samsung.com>
2018-07-25 15:46     ` [PATCH v5 7/9] ARM: dts: exynos5250-arndale: add DSI and panel nodes Andrzej Hajda
2018-07-26  7:48       ` Krzysztof Kozlowski
2018-08-29 18:54       ` Krzysztof Kozlowski
     [not found]   ` <CGME20180725154703eucas1p1e07c626c26a574ab19a8c0d73eacc1c3@eucas1p1.samsung.com>
2018-07-25 15:46     ` [PATCH v5 8/9] drm/panel: simple: fix BOE/HV070WSA-100 timings Andrzej Hajda
2018-09-27 11:51       ` Thierry Reding
     [not found]   ` <CGME20180725154703eucas1p1602a2f9aecfa0acadd80524e2341dede@eucas1p1.samsung.com>
2018-07-25 15:46     ` [PATCH v5 9/9] dt-bindings: exynos_dsim: update of graph bindings 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=20180725154644.25412-3-a.hajda@samsung.com \
    --to=a.hajda@samsung.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.purski@samsung.com \
    --cc=m.szyprowski@samsung.com \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.