diff options
| author | Padmanabhan Komanduru <pkomandu@codeaurora.org> | 2013-11-29 19:25:18 +0530 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:24:16 -0700 |
| commit | 511346b9ce514b0180f6845e1b5fa26f9c8bd494 (patch) | |
| tree | 18abf8b86855a423f31297d2334710516469dba8 | |
| parent | c81e57838916a494ee69810f7cac53303d5f8342 (diff) | |
msm: mdss: Add error handling support for DCS command APIs
Currently there is no error handling done for DSI DCS command
APIs like mdss_dsi_cmdlist_put. So for ESD thread use cases,
the caller functions of these DCS command APIs do not have error
propagated if the panel read/write commands fail. Hence add support
for error handling for these functions.
Change-Id: I0e558fd32fbfd8ae247b60c92fa2756159c3d3c6
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/dsi_host_v2.c | 8 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dsi.h | 4 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dsi_cmd.c | 5 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_dsi_host.c | 32 |
4 files changed, 34 insertions, 15 deletions
diff --git a/drivers/video/fbdev/msm/dsi_host_v2.c b/drivers/video/fbdev/msm/dsi_host_v2.c index 67bfdd96161e..ccc43f2c5b7a 100644 --- a/drivers/video/fbdev/msm/dsi_host_v2.c +++ b/drivers/video/fbdev/msm/dsi_host_v2.c @@ -883,17 +883,18 @@ void msm_dsi_cmdlist_rx(struct mdss_dsi_ctrl_pdata *ctrl, if (req->cb) req->cb(len); } -void msm_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp) +int msm_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp) { struct dcs_cmd_req *req; int dsi_on; + int ret = -EINVAL; mutex_lock(&ctrl->mutex); dsi_on = dsi_host_private->dsi_on; mutex_unlock(&ctrl->mutex); if (!dsi_on) { pr_err("try to send DSI commands while dsi is off\n"); - return; + return ret; } mutex_lock(&ctrl->cmd_mutex); @@ -901,7 +902,7 @@ void msm_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp) if (!req) { mutex_unlock(&ctrl->cmd_mutex); - return; + return ret; } msm_dsi_clk_ctrl(&ctrl->panel_data, 1); @@ -916,6 +917,7 @@ void msm_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp) msm_dsi_clk_ctrl(&ctrl->panel_data, 0); mutex_unlock(&ctrl->cmd_mutex); + return 0; } static int msm_dsi_cal_clk_rate(struct mdss_panel_data *pdata, diff --git a/drivers/video/fbdev/msm/mdss_dsi.h b/drivers/video/fbdev/msm/mdss_dsi.h index c90b8f83f2cc..bf672aa58ffc 100644 --- a/drivers/video/fbdev/msm/mdss_dsi.h +++ b/drivers/video/fbdev/msm/mdss_dsi.h @@ -228,7 +228,7 @@ struct mdss_dsi_ctrl_pdata { int (*off) (struct mdss_panel_data *pdata); int (*partial_update_fnc) (struct mdss_panel_data *pdata); int (*check_status) (struct mdss_dsi_ctrl_pdata *pdata); - void (*cmdlist_commit)(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp); + int (*cmdlist_commit)(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp); struct mdss_panel_data panel_data; unsigned char *ctrl_base; int reg_size; @@ -333,7 +333,7 @@ void mdss_dsi_panel_pwm_cfg(struct mdss_dsi_ctrl_pdata *ctrl); void mdss_dsi_ctrl_init(struct mdss_dsi_ctrl_pdata *ctrl); void mdss_dsi_cmd_mdp_busy(struct mdss_dsi_ctrl_pdata *ctrl); void mdss_dsi_wait4video_done(struct mdss_dsi_ctrl_pdata *ctrl); -void mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp); +int mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp); void mdss_dsi_cmdlist_kickoff(int intf); int mdss_dsi_bta_status_check(struct mdss_dsi_ctrl_pdata *ctrl); diff --git a/drivers/video/fbdev/msm/mdss_dsi_cmd.c b/drivers/video/fbdev/msm/mdss_dsi_cmd.c index 9a3e63840bc3..8fc1115c0f9b 100644 --- a/drivers/video/fbdev/msm/mdss_dsi_cmd.c +++ b/drivers/video/fbdev/msm/mdss_dsi_cmd.c @@ -655,7 +655,7 @@ int mdss_dsi_cmdlist_put(struct mdss_dsi_ctrl_pdata *ctrl, { struct dcs_cmd_req *req; struct dcs_cmd_list *clist; - int ret = 0; + int ret = -EINVAL; mutex_lock(&ctrl->cmd_mutex); clist = &ctrl->cmdlist; @@ -674,7 +674,6 @@ int mdss_dsi_cmdlist_put(struct mdss_dsi_ctrl_pdata *ctrl, } mutex_unlock(&ctrl->cmd_mutex); - ret++; pr_debug("%s: tot=%d put=%d get=%d\n", __func__, clist->tot, clist->put, clist->get); @@ -682,7 +681,7 @@ int mdss_dsi_cmdlist_put(struct mdss_dsi_ctrl_pdata *ctrl, if (!ctrl->cmdlist_commit) pr_err("cmdlist_commit not implemented!\n"); else - ctrl->cmdlist_commit(ctrl, 0); + ret = ctrl->cmdlist_commit(ctrl, 0); } return ret; } diff --git a/drivers/video/fbdev/msm/mdss_dsi_host.c b/drivers/video/fbdev/msm/mdss_dsi_host.c index 16d09f400b1c..c2e5c88dabc4 100644 --- a/drivers/video/fbdev/msm/mdss_dsi_host.c +++ b/drivers/video/fbdev/msm/mdss_dsi_host.c @@ -1156,38 +1156,55 @@ void mdss_dsi_cmd_mdp_busy(struct mdss_dsi_ctrl_pdata *ctrl) __func__, current->pid); } -void mdss_dsi_cmdlist_tx(struct mdss_dsi_ctrl_pdata *ctrl, +int mdss_dsi_cmdlist_tx(struct mdss_dsi_ctrl_pdata *ctrl, struct dcs_cmd_req *req) { - int ret; + int ret, ret_val = -EINVAL; ret = mdss_dsi_cmds_tx(ctrl, req->cmds, req->cmds_cnt); + if (!IS_ERR_VALUE(ret)) + ret_val = 0; + if (req->cb) req->cb(ret); + + return ret_val; } -void mdss_dsi_cmdlist_rx(struct mdss_dsi_ctrl_pdata *ctrl, +int mdss_dsi_cmdlist_rx(struct mdss_dsi_ctrl_pdata *ctrl, struct dcs_cmd_req *req) { struct dsi_buf *rp; - int len = 0; + int len = 0, ret = -EINVAL; if (req->rbuf) { rp = &ctrl->rx_buf; len = mdss_dsi_cmds_rx(ctrl, req->cmds, req->rlen); memcpy(req->rbuf, rp->data, rp->len); + /* + * For dual DSI cases, early return of controller - 0 + * is valid. Hence, for those cases the return value + * is zero even though we don't send any commands. + * + */ + if ((ctrl->shared_pdata.broadcast_enable && + ctrl->ndx == DSI_CTRL_0) || (len != 0)) + ret = 0; } else { pr_err("%s: No rx buffer provided\n", __func__); } if (req->cb) req->cb(len); + + return ret; } -void mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp) +int mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp) { struct dcs_cmd_req *req; + int ret = -EINVAL; mutex_lock(&ctrl->cmd_mutex); req = mdss_dsi_cmdlist_get(ctrl); @@ -1212,9 +1229,9 @@ void mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp) mdss_dsi_clk_ctrl(ctrl, 1); if (req->flags & CMD_REQ_RX) - mdss_dsi_cmdlist_rx(ctrl, req); + ret = mdss_dsi_cmdlist_rx(ctrl, req); else - mdss_dsi_cmdlist_tx(ctrl, req); + ret = mdss_dsi_cmdlist_tx(ctrl, req); mdss_dsi_clk_ctrl(ctrl, 0); mdss_bus_bandwidth_ctrl(0); @@ -1225,6 +1242,7 @@ need_lock: mdss_dsi_cmd_mdp_start(ctrl); mutex_unlock(&ctrl->cmd_mutex); + return ret; } static void dsi_send_events(struct mdss_dsi_ctrl_pdata *ctrl, u32 events) |
