From d821dcad2c51333216efd89a47bdf9883794545b Mon Sep 17 00:00:00 2001 From: Kuogee Hsieh Date: Sat, 13 Oct 2012 17:26:31 -0700 Subject: [PATCH] msm_fb: display: add video mode dcs cmdlist support Add video mode dcs command list support. This patch make sure dcs commands committed while dsi video engine is busy so that dcs command will be transmitted at beginning of next BLLP. Change-Id: I11b0214ee10f3b1ef33b1da4c8e577800068cb06 Signed-off-by: Kuogee Hsieh (cherry picked from commit 7b0e0a45216714d76bf717a928a0db77bfa2868a) --- drivers/video/msm/mipi_dsi_host.c | 34 ++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/drivers/video/msm/mipi_dsi_host.c b/drivers/video/msm/mipi_dsi_host.c index 527b0c84c876..02d28d7396df 100644 --- a/drivers/video/msm/mipi_dsi_host.c +++ b/drivers/video/msm/mipi_dsi_host.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -1488,6 +1489,23 @@ int mipi_dsi_cmd_dma_rx(struct dsi_buf *rp, int rlen) return rlen; } +static void mipi_dsi_wait_for_video_eng_busy(void) +{ + u32 status; + int sleep_us = 4000; + + /* + * if video mode engine was not busy (in BLLP) + * wait to pass BLLP + */ + + /* check for VIDEO_MODE_ENGINE_BUSY */ + readl_poll((MIPI_DSI_BASE + 0x0004), /* DSI_STATUS */ + status, + (status & 0x08), + sleep_us); +} + void mipi_dsi_cmd_mdp_busy(void) { u32 status; @@ -1563,6 +1581,7 @@ void mipi_dsi_cmdlist_commit(int from_mdp) { struct dcs_cmd_req *req; int video; + u32 dsi_ctrl; mutex_lock(&cmd_mutex); req = mipi_dsi_cmdlist_get(); @@ -1579,9 +1598,18 @@ void mipi_dsi_cmdlist_commit(int from_mdp) pr_debug("%s: from_mdp=%d pid=%d\n", __func__, from_mdp, current->pid); - if (!from_mdp) { /* from put */ - /* make sure dsi_cmd_mdp is idle */ - mipi_dsi_cmd_mdp_busy(); + dsi_ctrl = MIPI_INP(MIPI_DSI_BASE + 0x0000); + if (dsi_ctrl & 0x02) { + /* video mode, make sure dsi_cmd_mdp is busy + * sodcs command will be txed at start of BLLP + */ + mipi_dsi_wait_for_video_eng_busy(); + } else { + /* command mode */ + if (!from_mdp) { /* cmdlist_put */ + /* make sure dsi_cmd_mdp is idle */ + mipi_dsi_cmd_mdp_busy(); + } } if (req->flags & CMD_REQ_RX)