linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Archit Taneja <architt@codeaurora.org>
To: dri-devel@lists.freedesktop.org
Cc: robdclark@gmail.com, linux-arm-msm@vger.kernel.org,
	hali@codeaurora.org, wentaox@codeaurora.org,
	sviau@codeaurora.org, jilaiw@codeaurora.org,
	Archit Taneja <architt@codeaurora.org>
Subject: [PATCH v2 3/5] drm/msm/dsi: Create a helper to check if there is a connected device
Date: Sun,  2 Aug 2015 21:50:35 +0530	[thread overview]
Message-ID: <1438532437-24646-4-git-send-email-architt@codeaurora.org> (raw)
In-Reply-To: <1438532437-24646-1-git-send-email-architt@codeaurora.org>

Create a helper msm_dsi_device_connected() which checks whether we have a
device connected to the dsi host or not. This check gets messy when we
have support external bridges too. Having an inline function makes it
more legible.

For now, the check only consists of msm_dsi->panel being non-NULL. Later,
this will check if we have an external bridge or not.

This helper isn't used in dsi_connector related code as that's specific
to only when a drm_panel is connected.

Signed-off-by: Archit Taneja <architt@codeaurora.org>
---
 drivers/gpu/drm/msm/dsi/dsi.c         | 2 +-
 drivers/gpu/drm/msm/dsi/dsi.h         | 5 +++++
 drivers/gpu/drm/msm/dsi/dsi_manager.c | 6 ++++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 9f5fe59..e991270 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -15,7 +15,7 @@
 
 struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi)
 {
-	if (!msm_dsi || !msm_dsi->panel)
+	if (!msm_dsi || !msm_dsi_device_connected(msm_dsi))
 		return NULL;
 
 	return (msm_dsi->device_flags & MIPI_DSI_MODE_VIDEO) ?
diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h
index fe5204e..918b0c6 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.h
+++ b/drivers/gpu/drm/msm/dsi/dsi.h
@@ -96,6 +96,11 @@ int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
 void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
 
 /* msm dsi */
+static inline bool msm_dsi_device_connected(struct msm_dsi *msm_dsi)
+{
+	return msm_dsi->panel;
+}
+
 struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi);
 
 /* dsi pll */
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index 925412e..e252d9d 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -332,7 +332,8 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
 	int ret;
 
 	DBG("id=%d", id);
-	if (!panel || (is_dual_panel && (DSI_1 == id)))
+	if (!msm_dsi_device_connected(msm_dsi) ||
+			(is_dual_panel && (DSI_1 == id)))
 		return;
 
 	ret = msm_dsi_host_power_on(host);
@@ -419,7 +420,8 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
 
 	DBG("id=%d", id);
 
-	if (!panel || (is_dual_panel && (DSI_1 == id)))
+	if (!msm_dsi_device_connected(msm_dsi) ||
+			(is_dual_panel && (DSI_1 == id)))
 		return;
 
 	ret = drm_panel_disable(panel);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

  parent reply	other threads:[~2015-08-02 16:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26  7:45 [PATCH 0/5] drm/msm/dsi: Add support for external bridge chips Archit Taneja
2015-06-26  7:45 ` [PATCH 1/5] drm/msm/dsi: Make TE gpio optional Archit Taneja
2015-06-26  7:45 ` [PATCH 2/5] drm/msm/dsi: Refer to connected device as 'device' instead of 'panel' Archit Taneja
2015-06-26  7:45 ` [PATCH 3/5] drm/msm/dsi: Create a helper to check if there is a connected device Archit Taneja
2015-06-26  7:45 ` [PATCH 4/5] drm/msm/dsi: Allow dsi to connect to an external bridge Archit Taneja
2015-06-26  7:45 ` [PATCH 5/5] drm/msm/dsi: Modify dsi manager bridge ops to work with external bridges Archit Taneja
2015-08-02 16:20 ` [PATCH v2 0/5] drm/msm/dsi: Add support for external bridge chips Archit Taneja
2015-08-02 16:20   ` [PATCH v2 1/5] drm/msm/dsi: Make TE gpio optional Archit Taneja
2015-08-02 16:20   ` [PATCH v2 2/5] drm/msm/dsi: Refer to connected device as 'device' instead of 'panel' Archit Taneja
2015-08-02 16:20   ` Archit Taneja [this message]
2015-08-02 16:20   ` [PATCH v2 4/5] drm/msm/dsi: Allow dsi to connect to an external bridge Archit Taneja
2015-08-02 16:20   ` [PATCH v2 5/5] drm/msm/dsi: Modify dsi manager bridge ops to work with external bridges Archit Taneja

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=1438532437-24646-4-git-send-email-architt@codeaurora.org \
    --to=architt@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hali@codeaurora.org \
    --cc=jilaiw@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=sviau@codeaurora.org \
    --cc=wentaox@codeaurora.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
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;
as well as URLs for NNTP newsgroup(s).