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

Commit 7a72fd80 authored by Terence Hampson's avatar Terence Hampson Committed by Xiaoming Zhou
Browse files

mdss: mdp3: Add underrun counter to debugfs stat call



To allow for easier debug we added logs to output current
underrun count.

Change-Id: I61f3911b315193ae5550de0332c5abefe22c12ce
Signed-off-by: default avatarTerence Hampson <thampson@codeaurora.org>
parent b16fa45c
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -1806,6 +1806,14 @@ static int mdp3_panel_register_done(struct mdss_panel_data *pdata)
	return rc;
}

static int mdp3_debug_dump_stats(void *data, char *buf, int len)
{
	int total = 0;
	total = scnprintf(buf, len, "underrun: %08u\n",
			mdp3_res->underrun_cnt);
	return total;
}

static void mdp3_debug_enable_clock(int on)
{
	if (on)
@@ -1825,7 +1833,7 @@ static int mdp3_debug_init(struct platform_device *pdev)

	mdss_res = mdata;

	mdata->debug_inf.debug_dump_stats = NULL;
	mdata->debug_inf.debug_dump_stats = mdp3_debug_dump_stats;
	mdata->debug_inf.debug_enable_clock = mdp3_debug_enable_clock;

	rc = mdss_debugfs_init(mdata);
@@ -1847,6 +1855,13 @@ static void mdp3_debug_deinit(struct platform_device *pdev)
	}
}

static void mdp3_dma_underrun_intr_handler(int type, void *arg)
{
	mdp3_res->underrun_cnt++;
	pr_err("display underrun detected count=%d\n",
			mdp3_res->underrun_cnt);
}

static int mdp3_probe(struct platform_device *pdev)
{
	int rc;
@@ -1857,6 +1872,11 @@ static int mdp3_probe(struct platform_device *pdev)
	.fb_stride = mdp3_fb_stride,
	};

	struct mdp3_intr_cb underrun_cb = {
		.cb = mdp3_dma_underrun_intr_handler,
		.data = NULL,
	};

	if (!pdev->dev.of_node) {
		pr_err("MDP driver only supports device tree probe\n");
		return -ENOTSUPP;
@@ -1904,6 +1924,11 @@ static int mdp3_probe(struct platform_device *pdev)
	if (rc)
		pr_err("unable to register mdp instance\n");

	rc = mdp3_set_intr_callback(MDP3_INTR_LCDC_UNDERFLOW,
					&underrun_cb);
	if (rc)
		pr_err("unable to configure interrupt callback\n");

probe_done:
	if (IS_ERR_VALUE(rc)) {
		mdp3_res_deinit();
+2 −0
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ struct mdp3_hw_resource {
	u32 irq_ref_count[MDP3_MAX_INTR];
	u32 irq_mask;
	struct mdp3_intr_cb callbacks[MDP3_MAX_INTR];
	u32 underrun_cnt;

	int irq_registered;

	u32 splash_mem_addr;
+3 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@ static int mdp3_dma_callback_setup(struct mdp3_dma *dma)
		.data = dma,
	};


	struct mdp3_intr_cb hist_cb = {
		.cb = mdp3_hist_done_intr_handler,
		.data = dma,
@@ -298,6 +299,7 @@ static int mdp3_dmap_config(struct mdp3_dma *dma,
	dma->output_config = *output_config;
	mdp3_dma_sync_config(dma, source_config);

	mdp3_irq_enable(MDP3_INTR_LCDC_UNDERFLOW);
	mdp3_dma_callback_setup(dma);
	return 0;
}
@@ -824,6 +826,7 @@ static int mdp3_dma_stop(struct mdp3_dma *dma, struct mdp3_intf *intf)

	mdp3_dma_callback_disable(dma, MDP3_DMA_CALLBACK_TYPE_VSYNC |
					MDP3_DMA_CALLBACK_TYPE_DMA_DONE);
	mdp3_irq_disable(MDP3_INTR_LCDC_UNDERFLOW);

	init_completion(&dma->dma_comp);
	dma->vsync_client.handler = NULL;