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 08/13] drm/msm/dsi: Don't store dsi host mode_flags in msm_dsi
Date: Mon, 17 Jun 2019 16:12:53 -0400
Message-ID: <20190617201301.133275-5-sean@poorly.run> (raw)
In-Reply-To: <20190617201301.133275-1-sean@poorly.run>

From: Sean Paul <seanpaul@chromium.org>

It's a bit dangerous to store the flags in msm_dsi since there's no way to
tell when they're populated. Fortunately the only place that uses them
is the same place that fills them. So just use a local variable and
delete the struct member.

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

diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index 8bdc48ca0b67..e0bbe8128aef 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -79,7 +79,6 @@ struct msm_dsi {
 	 */
 	struct drm_panel *panel;
 	struct drm_bridge *external_bridge;
-	unsigned long device_flags;
 
 	struct device *phy_dev;
 	bool phy_enabled;
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 56b8091b75e7..735fff79ae67 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -233,6 +233,12 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge)
 	return dsi_bridge->id;
 }
 
+static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi)
+{
+	unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host);
+	return !(host_flags & MIPI_DSI_MODE_VIDEO);
+}
+
 static enum drm_connector_status dsi_mgr_connector_detect(
 		struct drm_connector *connector, bool force)
 {
@@ -241,17 +247,15 @@ static enum drm_connector_status dsi_mgr_connector_detect(
 	struct msm_dsi *other_dsi = dsi_mgr_get_other_dsi(id);
 	struct msm_drm_private *priv = connector->dev->dev_private;
 	struct msm_kms *kms = priv->kms;
+	bool cmd_mode;
 
 	DBG("id=%d", id);
 	if (!msm_dsi->panel) {
 		msm_dsi->panel = msm_dsi_host_get_panel(msm_dsi->host);
-		msm_dsi->device_flags = msm_dsi_host_get_mode_flags(
-						msm_dsi->host);
 
 		/* There is only 1 panel in the global panel list
 		 * for dual DSI mode. Therefore slave dsi should get
-		 * the drm_panel instance from master dsi, and
-		 * keep using the panel flags got from the current DSI link.
+		 * the drm_panel instance from master dsi.
 		 */
 		if (!msm_dsi->panel && IS_DUAL_DSI() &&
 			!IS_MASTER_DSI_LINK(id) && other_dsi)
@@ -259,9 +263,8 @@ static enum drm_connector_status dsi_mgr_connector_detect(
 						other_dsi->host);
 
 
+		cmd_mode = dsi_mgr_is_cmd_mode(msm_dsi);
 		if (msm_dsi->panel && kms->funcs->set_encoder_mode) {
-			bool cmd_mode = !(msm_dsi->device_flags &
-					  MIPI_DSI_MODE_VIDEO);
 			struct drm_encoder *encoder =
 					msm_dsi_get_encoder(msm_dsi);
 
@@ -277,8 +280,6 @@ static enum drm_connector_status dsi_mgr_connector_detect(
 		 */
 		if (msm_dsi->panel && IS_DUAL_DSI() &&
 			other_dsi && other_dsi->panel) {
-			bool cmd_mode = !(msm_dsi->device_flags &
-						MIPI_DSI_MODE_VIDEO);
 			struct drm_encoder *encoder = msm_dsi_get_encoder(
 					dsi_mgr_get_dsi(DSI_ENCODER_MASTER));
 			struct drm_encoder *slave_enc = msm_dsi_get_encoder(
-- 
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   ` Sean Paul [this message]
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   ` [PATCH 13/13] drm/msm/dsi: Move setup_encoder to modeset_init Sean Paul

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-5-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