int mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp)
{
	struct dcs_cmd_req *req;
	int ret = -EINVAL;
	int rc = 0;
	mutex_lock(&ctrl->cmd_mutex);
	req = mdss_dsi_cmdlist_get(ctrl);

	/* make sure dsi_cmd_mdp is idle */
	mdss_dsi_cmd_mdp_busy(ctrl);

	pr_debug("%s:  from_mdp=%d pid=%d\n", __func__, from_mdp, current->pid);

	if (req == NULL)
		goto need_lock;

	/*
	 * mdss interrupt is generated in mdp core clock domain
	 * mdp clock need to be enabled to receive dsi interrupt
	 * also, axi bus bandwidth need since dsi controller will
	 * fetch dcs commands from axi bus
	 */
	mdss_bus_scale_set_quota(MDSS_HW_DSI0, SZ_1M, SZ_1M);
	mdss_bus_bandwidth_ctrl(1);
	pr_debug("%s:  from_mdp=%d pid=%d\n", __func__, from_mdp, current->pid);
	mdss_dsi_clk_ctrl(ctrl, 1);

	rc = mdss_iommu_ctrl(1);
	if (IS_ERR_VALUE(rc)) {
		pr_err("IOMMU attach failed\n");
		mutex_unlock(&ctrl->cmd_mutex);
		return rc;
	}

	if (req->flags & CMD_REQ_HS_MODE)
		mdss_dsi_set_tx_power_mode(0, &ctrl->panel_data);

	if (req->flags & CMD_REQ_RX)
		ret = mdss_dsi_cmdlist_rx(ctrl, req);
	else
		ret = mdss_dsi_cmdlist_tx(ctrl, req);

	if (req->flags & CMD_REQ_HS_MODE)
		mdss_dsi_set_tx_power_mode(1, &ctrl->panel_data);

	mdss_iommu_ctrl(0);
	mdss_dsi_clk_ctrl(ctrl, 0);
	mdss_bus_scale_set_quota(MDSS_HW_DSI0, 0, 0);
	mdss_bus_bandwidth_ctrl(0);
need_lock:

	if (from_mdp) /* from pipe_commit */
		mdss_dsi_cmd_mdp_start(ctrl);

	mutex_unlock(&ctrl->cmd_mutex);
	return ret;
}
int mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp)
{
	struct dcs_cmd_req *req;
	int ret = -EINVAL;
	int rc = 0;
	mutex_lock(&ctrl->cmd_mutex);
	req = mdss_dsi_cmdlist_get(ctrl);

	MDSS_XLOG(ctrl->ndx, from_mdp, ctrl->mdp_busy, current->pid,
							XLOG_FUNC_ENTRY);

	/* make sure dsi_cmd_mdp is idle */
	mdss_dsi_cmd_mdp_busy(ctrl);

	pr_debug("%s:  from_mdp=%d pid=%d\n", __func__, from_mdp, current->pid);

	if (req == NULL)
		goto need_lock;

	MDSS_XLOG(ctrl->ndx, req->flags, req->cmds_cnt, from_mdp, current->pid);

	/*
	 * mdss interrupt is generated in mdp core clock domain
	 * mdp clock need to be enabled to receive dsi interrupt
	 * also, axi bus bandwidth need since dsi controller will
	 * fetch dcs commands from axi bus
	 */
	mdss_bus_bandwidth_ctrl(1);
	pr_debug("%s:  from_mdp=%d pid=%d\n", __func__, from_mdp, current->pid);
	mdss_dsi_clk_ctrl(ctrl, DSI_ALL_CLKS, 1);

	rc = mdss_iommu_ctrl(1);
	if (IS_ERR_VALUE(rc)) {
		pr_err("IOMMU attach failed\n");
		mutex_unlock(&ctrl->cmd_mutex);
		return rc;
	}
	if (req->flags & CMD_REQ_RX)
		ret = mdss_dsi_cmdlist_rx(ctrl, req);
	else
		ret = mdss_dsi_cmdlist_tx(ctrl, req);
	mdss_iommu_ctrl(0);
	mdss_dsi_clk_ctrl(ctrl, DSI_ALL_CLKS, 0);
	mdss_bus_bandwidth_ctrl(0);

need_lock:

	if (from_mdp) /* from pipe_commit */
		mdss_dsi_cmd_mdp_start(ctrl);

	MDSS_XLOG(ctrl->ndx, from_mdp, ctrl->mdp_busy, current->pid,
							XLOG_FUNC_EXIT);
	mutex_unlock(&ctrl->cmd_mutex);
	return ret;
}
int mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp)
{
	struct dcs_cmd_req *req;
	int ret = -EINVAL;
	int rc = 0;
	mutex_lock(&ctrl->cmd_mutex);
	req = mdss_dsi_cmdlist_get(ctrl);

	
	mdss_dsi_cmd_mdp_busy(ctrl);

	pr_debug("%s:  from_mdp=%d pid=%d\n", __func__, from_mdp, current->pid);

	if (req == NULL)
		goto need_lock;

	mdss_bus_scale_set_quota(MDSS_HW_DSI0, SZ_1M, SZ_1M);
	mdss_bus_bandwidth_ctrl(1);
	pr_debug("%s:  from_mdp=%d pid=%d\n", __func__, from_mdp, current->pid);
	mdss_dsi_clk_ctrl(ctrl, 1);

	rc = mdss_iommu_ctrl(1);
	if (IS_ERR_VALUE(rc)) {
		pr_err("IOMMU attach failed\n");
		mutex_unlock(&ctrl->cmd_mutex);
		return rc;
	}

	if (req->flags & CMD_REQ_HS_MODE)
		mdss_dsi_set_tx_power_mode(0, &ctrl->panel_data);

	if (req->flags & CMD_REQ_RX)
		ret = mdss_dsi_cmdlist_rx(ctrl, req);
	else
		ret = mdss_dsi_cmdlist_tx(ctrl, req);

	if (req->flags & CMD_REQ_HS_MODE)
		mdss_dsi_set_tx_power_mode(1, &ctrl->panel_data);

	mdss_iommu_ctrl(0);
	mdss_dsi_clk_ctrl(ctrl, 0);
	mdss_bus_scale_set_quota(MDSS_HW_DSI0, 0, 0);
	mdss_bus_bandwidth_ctrl(0);
need_lock:

	if (from_mdp) 
		mdss_dsi_cmd_mdp_start(ctrl);

	mutex_unlock(&ctrl->cmd_mutex);
	return ret;
}
Exemplo n.º 4
0
int mdss_dsi_cmdlist_commit(struct mdss_dsi_ctrl_pdata *ctrl, int from_mdp)
{
    struct dcs_cmd_req *req;
    struct mdss_panel_info *pinfo;
    struct mdss_rect *roi = NULL;
    int ret = -EINVAL;
    int rc = 0;

    if (from_mdp)	/* from mdp kickoff */
        mutex_lock(&ctrl->cmd_mutex);

    req = mdss_dsi_cmdlist_get(ctrl);

    MDSS_XLOG(ctrl->ndx, from_mdp, ctrl->mdp_busy, current->pid,
              XLOG_FUNC_ENTRY);

    /* make sure dsi_cmd_mdp is idle */
    mdss_dsi_cmd_mdp_busy(ctrl);

    pr_debug("%s: ctrl=%d from_mdp=%d pid=%d\n", __func__,
             ctrl->ndx, from_mdp, current->pid);

    if (req == NULL)
        goto need_lock;

    MDSS_XLOG(ctrl->ndx, req->flags, req->cmds_cnt, from_mdp, current->pid);

    /*
     * mdss interrupt is generated in mdp core clock domain
     * mdp clock need to be enabled to receive dsi interrupt
     * also, axi bus bandwidth need since dsi controller will
     * fetch dcs commands from axi bus
     */
    mdss_bus_scale_set_quota(MDSS_HW_DSI0, SZ_1M, SZ_1M);

    pr_debug("%s:  from_mdp=%d pid=%d\n", __func__, from_mdp, current->pid);
    mdss_dsi_clk_ctrl(ctrl, DSI_ALL_CLKS, 1);

    rc = mdss_iommu_ctrl(1);
    if (IS_ERR_VALUE(rc)) {
        pr_err("IOMMU attach failed\n");
        mutex_unlock(&ctrl->cmd_mutex);
        return rc;
    }
    if (req->flags & CMD_REQ_RX)
        ret = mdss_dsi_cmdlist_rx(ctrl, req);
    else
        ret = mdss_dsi_cmdlist_tx(ctrl, req);
    mdss_iommu_ctrl(0);
    mdss_dsi_clk_ctrl(ctrl, DSI_ALL_CLKS, 0);
    mdss_bus_scale_set_quota(MDSS_HW_DSI0, 0, 0);
need_lock:

    MDSS_XLOG(ctrl->ndx, from_mdp, ctrl->mdp_busy, current->pid,
              XLOG_FUNC_EXIT);

    if (from_mdp) { /* from mdp kickoff */
        /*
         * when partial update enabled, the roi of pinfo
         * is updated before mdp kickoff. Either width or
         * height of roi is 0, then it is false kickoff so
         * no mdp_busy flag set needed.
         * when partial update disabled, mdp_busy flag
         * alway set.
         */
        pinfo = &ctrl->panel_data.panel_info;
        if (pinfo->partial_update_enabled)
            roi = &pinfo->roi;

        if (!roi || (roi->w != 0 || roi->h != 0))
            mdss_dsi_cmd_mdp_start(ctrl);

        mutex_unlock(&ctrl->cmd_mutex);
    }

    return ret;
}