msm: mdss: add ESD support by register read for DSI v2
Add support to check ESD status by register read for DSI v2 based platforms. Change-Id: I013d31c67b3e5c61b7723ecb234be06c2fd5a451 Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
This commit is contained in:
parent
ba6ec83385
commit
fece5962fd
1 changed files with 87 additions and 1 deletions
|
@ -1288,6 +1288,82 @@ error_vreg:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int msm_dsi_read_status(struct mdss_dsi_ctrl_pdata *ctrl)
|
||||
{
|
||||
struct dcs_cmd_req cmdreq;
|
||||
|
||||
memset(&cmdreq, 0, sizeof(cmdreq));
|
||||
cmdreq.cmds = ctrl->status_cmds.cmds;
|
||||
cmdreq.cmds_cnt = ctrl->status_cmds.cmd_cnt;
|
||||
cmdreq.flags = CMD_REQ_COMMIT | CMD_CLK_CTRL | CMD_REQ_RX;
|
||||
cmdreq.rlen = 1;
|
||||
cmdreq.cb = NULL;
|
||||
cmdreq.rbuf = ctrl->status_buf.data;
|
||||
|
||||
return mdss_dsi_cmdlist_put(ctrl, &cmdreq);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* msm_dsi_reg_status_check() - Check dsi panel status through reg read
|
||||
* @ctrl_pdata: pointer to the dsi controller structure
|
||||
*
|
||||
* This function can be used to check the panel status through reading the
|
||||
* status register from the panel.
|
||||
*
|
||||
* Return: positive value if the panel is in good state, negative value or
|
||||
* zero otherwise.
|
||||
*/
|
||||
int msm_dsi_reg_status_check(struct mdss_dsi_ctrl_pdata *ctrl_pdata)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (ctrl_pdata == NULL) {
|
||||
pr_err("%s: Invalid input data\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pr_debug("%s: Checking Register status\n", __func__);
|
||||
|
||||
msm_dsi_clk_ctrl(&ctrl_pdata->panel_data, 1);
|
||||
|
||||
if (ctrl_pdata->status_cmds.link_state == DSI_HS_MODE)
|
||||
dsi_set_tx_power_mode(0);
|
||||
|
||||
ret = msm_dsi_read_status(ctrl_pdata);
|
||||
|
||||
if (ctrl_pdata->status_cmds.link_state == DSI_HS_MODE)
|
||||
dsi_set_tx_power_mode(1);
|
||||
|
||||
if (ret == 0) {
|
||||
if (ctrl_pdata->status_buf.data[0] !=
|
||||
ctrl_pdata->status_value) {
|
||||
pr_err("%s: Read back value from panel is incorrect\n",
|
||||
__func__);
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
ret = 1;
|
||||
}
|
||||
} else {
|
||||
pr_err("%s: Read status register returned error\n", __func__);
|
||||
}
|
||||
|
||||
msm_dsi_clk_ctrl(&ctrl_pdata->panel_data, 0);
|
||||
pr_debug("%s: Read register done with ret: %d\n", __func__, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* msm_dsi_bta_status_check() - Check dsi panel status through bta check
|
||||
* @ctrl_pdata: pointer to the dsi controller structure
|
||||
*
|
||||
* This function can be used to check status of the panel using bta check
|
||||
* for the panel.
|
||||
*
|
||||
* Return: positive value if the panel is in good state, negative value or
|
||||
* zero otherwise.
|
||||
*/
|
||||
static int msm_dsi_bta_status_check(struct mdss_dsi_ctrl_pdata *ctrl_pdata)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -1503,9 +1579,19 @@ void msm_dsi_ctrl_init(struct mdss_dsi_ctrl_pdata *ctrl)
|
|||
complete(&ctrl->mdp_comp);
|
||||
dsi_buf_alloc(&ctrl->tx_buf, SZ_4K);
|
||||
dsi_buf_alloc(&ctrl->rx_buf, SZ_4K);
|
||||
dsi_buf_alloc(&ctrl->status_buf, SZ_4K);
|
||||
ctrl->cmdlist_commit = msm_dsi_cmdlist_commit;
|
||||
ctrl->panel_mode = ctrl->panel_data.panel_info.mipi.mode;
|
||||
ctrl->check_status = msm_dsi_bta_status_check;
|
||||
|
||||
if (ctrl->status_mode == ESD_REG)
|
||||
ctrl->check_status = msm_dsi_reg_status_check;
|
||||
else if (ctrl->status_mode == ESD_BTA)
|
||||
ctrl->check_status = msm_dsi_bta_status_check;
|
||||
|
||||
if (ctrl->status_mode == ESD_MAX) {
|
||||
pr_err("%s: Using default BTA for ESD check\n", __func__);
|
||||
ctrl->check_status = msm_dsi_bta_status_check;
|
||||
}
|
||||
}
|
||||
|
||||
static int msm_dsi_probe(struct platform_device *pdev)
|
||||
|
|
Loading…
Add table
Reference in a new issue