Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f054ec5 authored by Archit Taneja's avatar Archit Taneja Committed by Rob Clark
Browse files

drm/msm/dsi: Create a helper to check if there is a connected device



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: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent a9ddac9c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@


struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi)
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 NULL;


	return (msm_dsi->device_flags & MIPI_DSI_MODE_VIDEO) ?
	return (msm_dsi->device_flags & MIPI_DSI_MODE_VIDEO) ?
+5 −0
Original line number Original line Diff line number Diff line
@@ -85,6 +85,11 @@ int msm_dsi_manager_register(struct msm_dsi *msm_dsi);
void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi);
void msm_dsi_manager_unregister(struct msm_dsi *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);
struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi);


/* dsi pll */
/* dsi pll */
+4 −2
Original line number Original line Diff line number Diff line
@@ -344,7 +344,8 @@ static void dsi_mgr_bridge_pre_enable(struct drm_bridge *bridge)
	int ret;
	int ret;


	DBG("id=%d", id);
	DBG("id=%d", id);
	if (!panel || (is_dual_dsi && (DSI_1 == id)))
	if (!msm_dsi_device_connected(msm_dsi) ||
			(is_dual_dsi && (DSI_1 == id)))
		return;
		return;


	ret = msm_dsi_host_power_on(host);
	ret = msm_dsi_host_power_on(host);
@@ -431,7 +432,8 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)


	DBG("id=%d", id);
	DBG("id=%d", id);


	if (!panel || (is_dual_dsi && (DSI_1 == id)))
	if (!msm_dsi_device_connected(msm_dsi) ||
			(is_dual_dsi && (DSI_1 == id)))
		return;
		return;


	ret = drm_panel_disable(panel);
	ret = drm_panel_disable(panel);