From c4429baaa0f774c3f6d1ff3091b841320ac65eda Mon Sep 17 00:00:00 2001 From: Sandeep Panda Date: Wed, 9 May 2018 15:39:39 +0530 Subject: [PATCH] drm/msm/dsi-staging: add support to wait post dsi command rx Some display panel have the requirement of waiting for certain duration before dsi host can read back the response from panel, to a DCS read command. This change adds the support to store the delay required in dsi message structure it self. Change-Id: I82f53d811f82195eb900e4594b01c6e0f23fed53 Signed-off-by: Sandeep Panda Signed-off-by: Shashank Babu Chinta Venkata --- drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c | 9 +++------ drivers/gpu/drm/msm/dsi-staging/dsi_display.c | 2 +- drivers/gpu/drm/msm/dsi-staging/dsi_panel.c | 4 +++- include/drm/drm_mipi_dsi.h | 2 ++ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c index c7e82767065b..9abc69cd0327 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c @@ -1338,9 +1338,6 @@ static int dsi_message_rx(struct dsi_ctrl *dsi_ctrl, u32 dlen, diff, rlen = msg->rx_len; unsigned char *buff; char cmd; - struct dsi_cmd_desc *of_cmd; - - of_cmd = container_of(msg, struct dsi_cmd_desc, msg); if (msg->rx_len <= 2) { short_resp = true; @@ -1378,9 +1375,9 @@ static int dsi_message_rx(struct dsi_ctrl *dsi_ctrl, * wait before reading rdbk_data register, if any delay is * required after sending the read command. */ - if (of_cmd && of_cmd->post_wait_ms) - usleep_range(of_cmd->post_wait_ms * 1000, - ((of_cmd->post_wait_ms * 1000) + 10)); + if (msg->wait_ms) + usleep_range(msg->wait_ms * 1000, + ((msg->wait_ms * 1000) + 10)); dlen = dsi_ctrl->hw.ops.get_cmd_read_data(&dsi_ctrl->hw, buff, total_bytes_read, diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_display.c b/drivers/gpu/drm/msm/dsi-staging/dsi_display.c index 80aed687b99a..2225513a796a 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_display.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_display.c @@ -749,7 +749,7 @@ static int dsi_display_cmd_prepare(const char *cmd_buf, u32 cmd_buf_len, cmd->msg.channel = cmd_buf[2]; cmd->msg.flags = cmd_buf[3]; cmd->msg.ctrl = 0; - cmd->post_wait_ms = cmd_buf[4]; + cmd->post_wait_ms = cmd->msg.wait_ms = cmd_buf[4]; cmd->msg.tx_len = ((cmd_buf[5] << 8) | (cmd_buf[6])); if (cmd->msg.tx_len > payload_len) { diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c index 05761f2a2e8e..4fbc7d8b9b56 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c @@ -1490,7 +1490,7 @@ static int dsi_panel_create_cmd_packets(const char *data, cmd[i].msg.channel = data[2]; cmd[i].msg.flags |= (data[3] == 1 ? MIPI_DSI_MSG_REQ_ACK : 0); cmd[i].msg.ctrl = 0; - cmd[i].post_wait_ms = data[4]; + cmd[i].post_wait_ms = cmd[i].msg.wait_ms = data[4]; cmd[i].msg.tx_len = ((data[5] << 8) | (data[6])); size = cmd[i].msg.tx_len * sizeof(u8); @@ -3471,6 +3471,7 @@ static int dsi_panel_roi_prepare_dcs_cmds(struct dsi_panel_cmd_set *set, set->cmds[0].msg.tx_buf = caset; set->cmds[0].msg.rx_len = 0; set->cmds[0].msg.rx_buf = 0; + set->cmds[0].msg.wait_ms = 0; set->cmds[0].last_command = 0; set->cmds[0].post_wait_ms = 0; @@ -3482,6 +3483,7 @@ static int dsi_panel_roi_prepare_dcs_cmds(struct dsi_panel_cmd_set *set, set->cmds[1].msg.tx_buf = paset; set->cmds[1].msg.rx_len = 0; set->cmds[1].msg.rx_buf = 0; + set->cmds[1].msg.wait_ms = 0; set->cmds[1].last_command = 1; set->cmds[1].post_wait_ms = 0; diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 3c2024d8e6f5..328f232f33ee 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -32,6 +32,7 @@ struct mipi_dsi_device; * @type: payload data type * @flags: flags controlling this message transmission * @ctrl: ctrl index to transmit on + * @wait_ms: duration in ms to wait after message transmission * @tx_len: length of @tx_buf * @tx_buf: data to be written * @rx_len: length of @rx_buf @@ -42,6 +43,7 @@ struct mipi_dsi_msg { u8 type; u16 flags; u32 ctrl; + u32 wait_ms; size_t tx_len; const void *tx_buf;