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

Commit 58726373 authored by Xiaoming Zhou's avatar Xiaoming Zhou Committed by Radhika Ranjan Soni
Browse files

msm: mdss: wait for dma done before issuing dsi bta request



In the command mode panel, the mdp pixel data is using the
dsi command mode engine which is shared with the dsi dma
transaction.  This change makes sure there is no pending
mdp dma before issuing the dsi bta request.

Change-Id: Ida99e973c2bf73757726134ba7e2ad2df9e6eb02
Signed-off-by: default avatarXiaoming Zhou <zhoux@codeaurora.org>
parent 5bc094e1
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -82,7 +82,19 @@ static void check_dsi_ctrl_status(struct work_struct *work)
	mdp3_session = pdsi_status->mfd->mdp.private1;
	mutex_lock(&mdp3_session->lock);

	if (!mdp3_session->status) {
		pr_debug("%s: display off already\n", __func__);
		mutex_unlock(&mdp3_session->lock);
		return;
	}

	if (mdp3_session->wait_for_dma_done)
		ret = mdp3_session->wait_for_dma_done(mdp3_session);

	if (!ret)
		ret = ctrl_pdata->check_status(ctrl_pdata);
	else
		pr_err("%s: wait_for_dma_done error\n", __func__);

	mutex_unlock(&mdp3_session->lock);

+25 −1
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ void dma_done_notify_handler(void *arg)
	struct mdp3_session_data *session = (struct mdp3_session_data *)arg;
	atomic_inc(&session->dma_done_cnt);
	schedule_work(&session->dma_done_work);
	complete(&session->dma_completion);
}

void vsync_count_down(void *arg)
@@ -1050,7 +1051,8 @@ static int mdp3_ctrl_display_commit_kickoff(struct msm_fb_data_type *mfd,
					MDP_NOTIFY_FRAME_DONE);
			}
		}

		mdp3_session->dma_active = 1;
		init_completion(&mdp3_session->dma_completion);
		mdp3_ctrl_notify(mdp3_session, MDP_NOTIFY_FRAME_FLUSHED);
		mdp3_bufq_push(&mdp3_session->bufq_out, data);
	}
@@ -1146,6 +1148,8 @@ static void mdp3_ctrl_pan_display(struct msm_fb_data_type *mfd,
					MDP_NOTIFY_FRAME_DONE);
			}
		}
		mdp3_session->dma_active = 1;
		init_completion(&mdp3_session->dma_completion);
		mdp3_ctrl_notify(mdp3_session, MDP_NOTIFY_FRAME_FLUSHED);
	} else {
		pr_debug("mdp3_ctrl_pan_display no memory, stop interface");
@@ -1787,6 +1791,23 @@ static int mdp3_ctrl_ioctl_handler(struct msm_fb_data_type *mfd,
	return rc;
}

int mdp3_wait_for_dma_done(struct mdp3_session_data *session)
{
	int rc = 0;

	if (session->dma_active) {
		rc = wait_for_completion_timeout(&session->dma_completion,
			KOFF_TIMEOUT);
		if (rc > 0) {
			session->dma_active = 0;
			rc = 0;
		} else if (rc == 0) {
			rc = -ETIME;
		}
	}
	return rc;
}

int mdp3_ctrl_init(struct msm_fb_data_type *mfd)
{
	struct device *dev = mfd->fbi->dev;
@@ -1861,6 +1882,9 @@ int mdp3_ctrl_init(struct msm_fb_data_type *mfd)
	mdp3_session->vsync_timer.data = (u32)mdp3_session;
	mdp3_session->vsync_period = 1000 / mfd->panel_info->mipi.frame_rate;
	mfd->mdp.private1 = mdp3_session;
	init_completion(&mdp3_session->dma_completion);
	if (intf_type != MDP3_DMA_OUTPUT_SEL_DSI_VIDEO)
		mdp3_session->wait_for_dma_done = mdp3_wait_for_dma_done;

	rc = sysfs_create_group(&dev->kobj, &vsync_fs_attr_group);
	if (rc) {
+4 −0
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@ struct mdp3_session_data {
	int vsync_enabled;
	atomic_t vsync_countdown; /* Used to count down  */
	bool in_splash_screen;

	bool dma_active;
	struct completion dma_completion;
	int (*wait_for_dma_done)(struct mdp3_session_data *session);
};

int mdp3_ctrl_init(struct msm_fb_data_type *mfd);