Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
From: Sean Paul <sean@poorly.run>
To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org
Cc: Sean Paul <seanpaul@chromium.org>,
	Rob Clark <robdclark@gmail.com>, Sean Paul <sean@poorly.run>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	linux-arm-msm@vger.kernel.org
Subject: [PATCH 13/13] drm/msm/dsi: Move setup_encoder to modeset_init
Date: Mon, 17 Jun 2019 16:12:58 -0400
Message-ID: <20190617201301.133275-10-sean@poorly.run> (raw)
In-Reply-To: <20190617201301.133275-1-sean@poorly.run>

From: Sean Paul <seanpaul@chromium.org>

Now that the panel probe/setup is in the modeset path, we can call
dsi_manager_setup_encoder() in a common place for both internal and
external bridge setups.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/msm/dsi/dsi.c         |  2 ++
 drivers/gpu/drm/msm/dsi/dsi.h         |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c    |  2 --
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 27 ++-------------------------
 4 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 7b2a1e6a8810..d45b0a40aaf3 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -250,6 +250,8 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
 		goto fail;
 	}
 
+	msm_dsi_manager_setup_encoder(msm_dsi->id);
+
 	priv->bridges[priv->num_bridges++]       = msm_dsi->bridge;
 	priv->connectors[priv->num_connectors++] = msm_dsi->connector;
 
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index f8a611725f2e..53bb124e8259 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -96,7 +96,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id);
 struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id);
 int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg);
 bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len);
-void msm_dsi_manager_attach_dsi_device(int id);
+void msm_dsi_manager_setup_encoder(int id);
 int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
 void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
 bool msm_dsi_manager_validate_current_config(u8 id);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index effea0db5626..04db0c806aa4 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1598,8 +1598,6 @@ static int dsi_host_attach(struct mipi_dsi_host *host,
 	msm_host->format = dsi->format;
 	msm_host->mode_flags = dsi->mode_flags;
 
-	msm_dsi_manager_attach_dsi_device(msm_host->id);
-
 	/* Some gpios defined in panel DT need to be controlled by host */
 	ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev);
 	if (ret)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 5db43c7ffafc..ff39ce6150ad 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -239,7 +239,7 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)
 	return !(host_flags & MIPI_DSI_MODE_VIDEO);
 }
 
-static void msm_dsi_manager_setup_encoder(int id)
+void msm_dsi_manager_setup_encoder(int id)
 {
 	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
 	struct msm_drm_private *priv = msm_dsi->dev->dev_private;
@@ -280,12 +280,7 @@ static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id)
 		return PTR_ERR(panel);
 	}
 
-	if (!panel)
-		return 0;
-
-	msm_dsi_manager_setup_encoder(id);
-
-	if (!IS_DUAL_DSI())
+	if (!panel || !IS_DUAL_DSI())
 		goto out;
 
 	drm_object_attach_property(&conn->base,
@@ -790,24 +785,6 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len)
 	return true;
 }
 
-void msm_dsi_manager_attach_dsi_device(int id)
-{
-	struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
-	struct drm_device *dev = msm_dsi->dev;
-
-	/*
-	 * drm_device pointer is assigned to msm_dsi only in the modeset_init
-	 * path. If mipi_dsi_attach() happens in DSI driver's probe path
-	 * (generally the case when we're connected to a drm_panel of the type
-	 * mipi_dsi_device), this would be NULL. In such cases, try to set the
-	 * encoder mode in the DSI connector's detect() op.
-	 */
-	if (!dev)
-		return;
-
-	msm_dsi_manager_setup_encoder(id);
-}
-
 int msm_dsi_manager_register(struct msm_dsi *msm_dsi)
 {
 	struct msm_dsi_manager *msm_dsim = &msm_dsim_glb;
-- 
Sean Paul, Software Engineer, Google / Chromium OS


      parent reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 20:03 [RESEND PATCH 01/13] drm/msm/dpu: Remove call to drm_mode_set_crtcinfo Sean Paul
2019-06-17 20:03 ` [RESEND PATCH 02/13] drm/msm/dpu: Fix mmu init/destroy functions Sean Paul
2019-06-17 20:09 ` [PATCH 03/13] drm/msm/phy/dsi_phy: Set pll to NULL in case initialization fails Sean Paul
2019-06-17 20:12 ` [PATCH 04/13] drm/msm/dsi_pll_10nm: Release clk hw on destroy and failure Sean Paul
2019-06-17 20:12   ` [PATCH 05/13] drm/msm/dsi_pll_10nm: Remove impossible check Sean Paul
2019-06-17 20:12   ` [PATCH 06/13] drm/msm: Depopulate platform on probe failure Sean Paul
2019-06-17 20:12   ` [PATCH 07/13] drm/msm/dsi: Split mode_flags out of msm_dsi_host_get_panel() Sean Paul
2019-06-17 20:12   ` [PATCH 08/13] drm/msm/dsi: Don't store dsi host mode_flags in msm_dsi Sean Paul
2019-06-17 20:12   ` [PATCH 09/13] drm/msm/dsi: Pull out panel init code into function Sean Paul
2019-06-17 20:12   ` [PATCH 10/13] drm/msm/dsi: Simplify the logic in msm_dsi_manager_panel_init() Sean Paul
2019-06-17 20:12   ` [PATCH 11/13] drm/msm/dsi: Use the new setup_encoder function in attach_dsi_device Sean Paul
2019-06-17 20:12   ` [PATCH 12/13] drm/msm/dsi: Move dsi panel init into modeset init path Sean Paul
2019-06-17 20:12   ` Sean Paul [this message]

Reply instructions:

You may reply publically 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=20190617201301.133275-10-sean@poorly.run \
    --to=sean@poorly.run \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=seanpaul@chromium.org \
    /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

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org linux-arm-msm@archiver.kernel.org
	public-inbox-index linux-arm-msm


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox