diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 5d0767ac4936..c922727ccadc 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -731,6 +731,40 @@ exit: return rc; } +int dsi_display_cmd_mipi_transfer(struct dsi_display *display, + struct mipi_dsi_msg *msg, + u32 flags) +{ + int rc = 0; + struct dsi_display_ctrl *m_ctrl; + + m_ctrl = &display->ctrl[display->cmd_master_idx]; + + if (display->tx_cmd_buf == NULL) { + rc = dsi_host_alloc_cmd_tx_buffer(display); + if (rc) { + DSI_ERR("failed to allocate cmd tx buffer memory\n"); + goto done; + } + } + + rc = dsi_display_cmd_engine_enable(display); + if (rc) { + DSI_ERR("cmd engine enable failed\n"); + return -EPERM; + } + + flags |= DSI_CTRL_CMD_FETCH_MEMORY | DSI_CTRL_CMD_CUSTOM_DMA_SCHED; + rc = dsi_ctrl_cmd_transfer(m_ctrl->ctrl, msg, &flags); + if (((flags & DSI_CTRL_CMD_READ) && rc <= 0) || + (!(flags & DSI_CTRL_CMD_READ) && rc)) + DSI_ERR("failed to transfer cmd. rc = %d\n", rc); + + dsi_display_cmd_engine_disable(display); +done: + return rc; +} + static int dsi_display_status_reg_read(struct dsi_display *display) { int rc = 0, i; diff --git a/msm/dsi/dsi_display.h b/msm/dsi/dsi_display.h index 8724178e0541..7502c1ca3380 100644 --- a/msm/dsi/dsi_display.h +++ b/msm/dsi/dsi_display.h @@ -764,6 +764,20 @@ enum dsi_pixel_format dsi_display_get_dst_format( struct drm_connector *connector, void *display); +/* + * dsi_display_cmd_mipi_transfer() - Sending the MIPI DSI command + * @display: Handle to display + * @msg: MIPI DSI command information + * @flags: Modifier flags + * Return: if this is a MIPI DSI read then it will return number read byte + * in success case. Otherwise will be "<=0" + * if this is a MIPI DSI write then it will return "0" for success + * + */ +int dsi_display_cmd_mipi_transfer(struct dsi_display *display, + struct mipi_dsi_msg *msg, + u32 flags); + /** * dsi_display_cont_splash_config() - initialize splash resources * @display: Handle to display diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 96fbb6e1d525..15ebe5f90559 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -11,6 +11,7 @@ #include #include