diff mbox

[5/5] drm/msm/dsi: replace version checks for commmand broadcast

Message ID 1520860994-23334-6-git-send-email-sibis@codeaurora.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sibi Sankar March 12, 2018, 1:23 p.m. UTC
Replace version checks for commmand broadcast with the helper
functions bound to cfg_handler for DSI v6G 1.x and DSI 6G v2.0+
controllers

Signed-off-by: Sibi S <sibis@codeaurora.org>
---
 drivers/gpu/drm/msm/dsi/dsi_cfg.c  |  6 ++++++
 drivers/gpu/drm/msm/dsi/dsi_cfg.h  |  2 ++
 drivers/gpu/drm/msm/dsi/dsi_host.c | 16 +++-------------
 3 files changed, 11 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
index dcdfb1b..6ec28d1 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
@@ -145,6 +145,8 @@ 
 	.tx_buf_put = NULL,
 	.dma_base_get = dsi_dma_base_get_v2,
 	.calc_clk_rate = dsi_calc_clk_rate_v2,
+	.xfer = msm_dsi_manager_cmd_xfer,
+	.xfer_trigger = msm_dsi_manager_cmd_xfer_trigger,
 };
 
 const static struct msm_dsi_host_cfg_ops msm_dsi_6g_host_ops = {
@@ -156,6 +158,8 @@ 
 	.tx_buf_put = dsi_tx_buf_put_6g,
 	.dma_base_get = dsi_dma_base_get_6g,
 	.calc_clk_rate = dsi_calc_clk_rate_6g,
+	.xfer = msm_dsi_manager_cmd_xfer,
+	.xfer_trigger = msm_dsi_manager_cmd_xfer_trigger,
 };
 
 const static struct msm_dsi_host_cfg_ops msm_dsi_6g_v2_host_ops = {
@@ -167,6 +171,8 @@ 
 	.tx_buf_put = dsi_tx_buf_put_6g,
 	.dma_base_get = dsi_dma_base_get_6g,
 	.calc_clk_rate = dsi_calc_clk_rate_6g,
+	.xfer = msm_dsi_manager_cmd_xfer_6g_v2,
+	.xfer_trigger = msm_dsi_manager_cmd_xfer_trigger_6g_v2,
 };
 
 static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] = {
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index a795a06..145251e 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -49,6 +49,8 @@  struct msm_dsi_host_cfg_ops {
 	void (*tx_buf_put)(struct msm_dsi_host *msm_host);
 	int (*dma_base_get)(struct msm_dsi_host *msm_host, uint64_t *iova);
 	int (*calc_clk_rate)(struct msm_dsi_host *msm_host);
+	bool (*xfer_trigger)(int id, u32 dma_base, u32 len);
+	int (*xfer)(int id, const struct mipi_dsi_msg *msg);
 };
 
 struct msm_dsi_cfg_handler {
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index bd61cad..240ecb8 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1251,13 +1251,8 @@  static int dsi_cmd_dma_tx(struct msm_dsi_host *msm_host, int len)
 	reinit_completion(&msm_host->dma_comp);
 
 	dsi_wait4video_eng_busy(msm_host);
-	if ((cfg_hnd->major == MSM_DSI_VER_MAJOR_6G) &&
-			(cfg_hnd->minor < MSM_DSI_6G_VER_MINOR_V2_2_1))
-		triggered = msm_dsi_manager_cmd_xfer_trigger(msm_host->id,
-								dma_base, len);
-	else
-		triggered = msm_dsi_manager_cmd_xfer_trigger_6g_v2(
-						  msm_host->id, dma_base, len);
+	triggered = cfg_hnd->ops->xfer_trigger(msm_host->id,
+							dma_base, len);
 
 	if (triggered) {
 		ret = wait_for_completion_timeout(&msm_host->dma_comp,
@@ -1615,12 +1610,7 @@  static ssize_t dsi_host_transfer(struct mipi_dsi_host *host,
 
 	mutex_lock(&msm_host->cmd_mutex);
 
-	if (((cfg_hnd->major == MSM_DSI_VER_MAJOR_6G) &&
-			(cfg_hnd->minor < MSM_DSI_6G_VER_MINOR_V2_2_1)) ||
-			(cfg_hnd->major == MSM_DSI_VER_MAJOR_V2))
-		ret = msm_dsi_manager_cmd_xfer(msm_host->id, msg);
-	else
-		ret = msm_dsi_manager_cmd_xfer_6g_v2(msm_host->id, msg);
+	ret = cfg_hnd->ops->xfer(msm_host->id, msg);
 
 	mutex_unlock(&msm_host->cmd_mutex);