Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 71ed7078 authored by Padmanabhan Komanduru's avatar Padmanabhan Komanduru
Browse files

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: default avatarPadmanabhan Komanduru <pkomandu@codeaurora.org>
parent d0aa1f4c
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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,
+2 −2
Original line number Diff line number Diff line
@@ -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);

+2 −3
Original line number Diff line number Diff line
@@ -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;
}
+25 −7
Original line number Diff line number Diff line
@@ -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)