All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: dri-devel@lists.freedesktop.org
Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com>,
	Jernej Skrabec <jernej.skrabec@siol.net>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Andrey Smirnov <andrew.smirnov@gmail.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Chris Healy <Chris.Healy@zii.aero>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	kernel@collabora.com, Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH v2 06/21] drm/exynos: Implement bridge_funcs instead of encoder_helper_funcs
Date: Mon, 26 Aug 2019 17:26:34 +0200	[thread overview]
Message-ID: <20190826152649.13820-7-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20190826152649.13820-1-boris.brezillon@collabora.com>

Those hooks are called exactly at the same time except the bridge
funcs have pre_enable()/post_disable() hooks which allows us to get
rid of the hack resetting encoder->bridge.next (was needed to control
the encoder/bridge enable/disable sequence).

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
Changes in v2:
* New patch (replacement for "drm/exynos: Get rid of exynos_dsi->out_bridge")
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 55 ++++++++++++++++---------
 1 file changed, 36 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index c555cecfe1f5..4f713b0ac244 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1374,40 +1374,48 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi)
 	}
 }
 
-static void exynos_dsi_enable(struct drm_encoder *encoder)
+static void exynos_dsi_pre_enable(struct drm_bridge *bridge)
 {
+	struct drm_encoder *encoder = bridge_to_encoder(bridge);
 	struct exynos_dsi *dsi = encoder_to_dsi(encoder);
-	int ret;
 
 	if (dsi->state & DSIM_STATE_ENABLED)
 		return;
 
 	pm_runtime_get_sync(dsi->dev);
-	dsi->state |= DSIM_STATE_ENABLED;
 
 	if (dsi->panel) {
+		int ret;
+
 		ret = drm_panel_prepare(dsi->panel);
 		WARN_ON(ret && ret != -ENOSYS);
-	} else {
-		drm_bridge_pre_enable(dsi->out_bridge);
 	}
+}
+
+static void exynos_dsi_enable(struct drm_bridge *bridge)
+{
+	struct drm_encoder *encoder = bridge_to_encoder(bridge);
+	struct exynos_dsi *dsi = encoder_to_dsi(encoder);
+
+	if (dsi->state & DSIM_STATE_ENABLED)
+		return;
 
 	exynos_dsi_set_display_mode(dsi);
 	exynos_dsi_set_display_enable(dsi, true);
 
 	if (dsi->panel) {
+		int ret;
+
 		ret = drm_panel_enable(dsi->panel);
 		WARN_ON(ret && ret != -ENOSYS);
-	} else {
-		drm_bridge_enable(dsi->out_bridge);
 	}
 
-	dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE;
-	return;
+	dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE | DSIM_STATE_ENABLED;
 }
 
-static void exynos_dsi_disable(struct drm_encoder *encoder)
+static void exynos_dsi_disable(struct drm_bridge *bridge)
 {
+	struct drm_encoder *encoder = bridge_to_encoder(bridge);
 	struct exynos_dsi *dsi = encoder_to_dsi(encoder);
 
 	if (!(dsi->state & DSIM_STATE_ENABLED))
@@ -1415,11 +1423,18 @@ static void exynos_dsi_disable(struct drm_encoder *encoder)
 
 	dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE;
 
-	drm_panel_disable(dsi->panel);
-	drm_bridge_disable(dsi->out_bridge);
 	exynos_dsi_set_display_enable(dsi, false);
 	drm_panel_unprepare(dsi->panel);
-	drm_bridge_post_disable(dsi->out_bridge);
+}
+
+static void exynos_dsi_post_disable(struct drm_bridge *bridge)
+{
+	struct drm_encoder *encoder = bridge_to_encoder(bridge);
+	struct exynos_dsi *dsi = encoder_to_dsi(encoder);
+
+	if (!(dsi->state & DSIM_STATE_ENABLED))
+		return;
+
 	dsi->state &= ~DSIM_STATE_ENABLED;
 	pm_runtime_put_sync(dsi->dev);
 }
@@ -1489,9 +1504,11 @@ static int exynos_dsi_create_connector(struct drm_encoder *encoder)
 	return 0;
 }
 
-static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = {
+static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = {
+	.pre_enable = exynos_dsi_pre_enable,
 	.enable = exynos_dsi_enable,
 	.disable = exynos_dsi_disable,
+	.post_disable = exynos_dsi_post_disable,
 };
 
 static const struct drm_encoder_funcs exynos_dsi_encoder_funcs = {
@@ -1512,7 +1529,6 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
 	if (out_bridge) {
 		drm_bridge_attach(encoder, out_bridge, NULL);
 		dsi->out_bridge = out_bridge;
-		encoder->bridge.next = NULL;
 	} else {
 		int ret = exynos_dsi_create_connector(encoder);
 
@@ -1569,7 +1585,8 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host,
 
 	if (dsi->panel) {
 		mutex_lock(&drm->mode_config.mutex);
-		exynos_dsi_disable(&dsi->encoder);
+		exynos_dsi_disable(&dsi->encoder.bridge);
+		exynos_dsi_post_disable(&dsi->encoder.bridge);
 		drm_panel_detach(dsi->panel);
 		dsi->panel = NULL;
 		dsi->connector.status = connector_status_disconnected;
@@ -1674,11 +1691,10 @@ static int exynos_dsi_bind(struct device *dev, struct device *master,
 	struct drm_bridge *in_bridge;
 	int ret;
 
+	encoder->bridge.funcs = &exynos_dsi_bridge_funcs;
 	drm_encoder_init(drm_dev, encoder, &exynos_dsi_encoder_funcs,
 			 DRM_MODE_ENCODER_TMDS, NULL);
 
-	drm_encoder_helper_add(encoder, &exynos_dsi_encoder_helper_funcs);
-
 	ret = exynos_drm_set_possible_crtcs(encoder, EXYNOS_DISPLAY_TYPE_LCD);
 	if (ret < 0)
 		return ret;
@@ -1698,7 +1714,8 @@ static void exynos_dsi_unbind(struct device *dev, struct device *master,
 	struct drm_encoder *encoder = dev_get_drvdata(dev);
 	struct exynos_dsi *dsi = encoder_to_dsi(encoder);
 
-	exynos_dsi_disable(encoder);
+	exynos_dsi_disable(&encoder->bridge);
+	exynos_dsi_post_disable(&encoder->bridge);
 
 	mipi_dsi_host_unregister(&dsi->dsi_host);
 }
-- 
2.21.0

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

  parent reply	other threads:[~2019-08-26 15:26 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 15:26 [PATCH v2 00/21] drm: Add support for bus-format negotiation Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 01/21] drm: Stop including drm_bridge.h from drm_crtc.h Boris Brezillon
2019-08-28 20:27   ` Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 02/21] drm: Add a dummy bridge object to drm_encoder Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 03/21] drm/vc4: Implement bridge_funcs instead of encoder_helper_funcs Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 04/21] drm/exynos: Fix potential unbalanced calls to pm_runtime_put Boris Brezillon
2019-10-11 13:31   ` Boris Brezillon
2019-10-11 13:54   ` Andrzej Hajda
2019-10-11 14:20     ` Boris Brezillon
2019-10-12  7:15       ` Sam Ravnborg
2019-10-22  9:14         ` Boris Brezillon
2019-10-22 17:23     ` Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 05/21] drm/exynos: Don't reset bridge->next Boris Brezillon
2019-08-26 15:26 ` Boris Brezillon [this message]
2019-08-26 15:26 ` [PATCH v2 07/21] drm/bridge: Rename bridge helpers targeting a bridge chain Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 08/21] drm/msm: Use drm_attach_bridge() to attach a bridge to an encoder Boris Brezillon
2019-08-28 15:22   ` Sean Paul
2019-08-28 15:25     ` Boris Brezillon
2019-08-28 15:30       ` Sean Paul
2019-08-28 20:27         ` Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 09/21] drm/bridge: Introduce drm_bridge_chain_get_next_bridge() Boris Brezillon
2019-08-27  7:19   ` Neil Armstrong
2019-08-26 15:26 ` [PATCH v2 10/21] drm/bridge: Make the bridge chain a double-linked list Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 11/21] drm/bridge: Add the drm_for_each_bridge_in_chain() helper Boris Brezillon
2019-08-27  7:26   ` Neil Armstrong
2019-08-26 15:26 ` [PATCH v2 12/21] drm/bridge: Add a drm_bridge_state object Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 13/21] drm/bridge: Patch atomic hooks to take a drm_bridge_state Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 14/21] drm/bridge: Add an ->atomic_check() hook Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 15/21] drm/bridge: Add the drm_bridge_chain_get_prev_bridge() helper Boris Brezillon
2019-08-27  7:26   ` Neil Armstrong
2019-08-26 15:26 ` [PATCH v2 16/21] drm/bridge: Add the necessary bits to support bus format negotiation Boris Brezillon
2019-08-27  8:18   ` Neil Armstrong
2019-08-26 15:26 ` [PATCH v2 17/21] drm/imx: pd: Use bus format/flags provided by the bridge when available Boris Brezillon
2019-08-27  8:15   ` Philipp Zabel
2019-08-27  8:43     ` Boris Brezillon
2019-08-27  9:23       ` Philipp Zabel
2019-08-27  9:57         ` Boris Brezillon
2019-08-27 12:51           ` Philipp Zabel
2019-08-27 13:20             ` Boris Brezillon
2019-08-27 13:49               ` Philipp Zabel
2019-08-26 15:26 ` [PATCH v2 18/21] drm/bridge: lvds-encoder: Implement basic bus format negotiation Boris Brezillon
2019-08-26 16:15   ` Jernej Škrabec
2019-08-26 18:17     ` Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 19/21] drm/bridge: panel: Propage bus format/flags Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 20/21] drm/panel: simple: Add support for Toshiba LTA089AC29000 panel Boris Brezillon
2019-08-26 15:26 ` [PATCH v2 21/21] ARM: dts: imx: imx51-zii-rdu1: Fix the display pipeline definition Boris Brezillon

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=20190826152649.13820-7-boris.brezillon@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=Chris.Healy@zii.aero \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=kyungmin.park@samsung.com \
    --cc=narmstrong@baylibre.com \
    --cc=nikita.yoush@cogentembedded.com \
    --cc=sam@ravnborg.org \
    --cc=sw0312.kim@samsung.com \
    --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.