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

Commit 2ab750c3 authored by Dhaval Patel's avatar Dhaval Patel
Browse files

msm: mdss: support danger safe signal per pipe



MDPv1.5 and MDPv1.8 has danger safe LUTs and control setting
register under MDP register space. These LUTs and control
settings can be different for each pipe for MDPv1.7. It makes
"panic-ctrl-offsets" configuration also optional for VIG, RGB
and DMA pipes. This change handles the danger safe signal
programming for such MDP version.

Change-Id: Icf0e4a732d7372493d1166579b90a7c2df7ae126
Signed-off-by: default avatarDhaval Patel <pdhaval@codeaurora.org>
parent cc95eee0
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ static int mdss_debug_set_panic_signal(struct mdss_mdp_pipe *pipe_pool,
	for (i = 0; i < pool_size; i++) {
		pipe = pipe_pool + i;
		if (pipe && (atomic_read(&pipe->kref.refcount) != 0) &&
			mdss_mdp_panic_signal_supported(mdata, pipe)) {
			mdss_mdp_panic_signal_support_mode(mdata, pipe)) {
			mdss_mdp_pipe_panic_signal_ctrl(pipe, enable);
			pr_debug("pnum:%d count:%d img:%dx%d ",
				pipe->num, pipe->play_cnt, pipe->img_width,
@@ -475,7 +475,7 @@ static int mdss_debug_set_panic_signal(struct mdss_mdp_pipe *pipe_pool,
		} else if (pipe) {
			pr_debug("Inactive pipe num:%d supported:%d\n",
			       atomic_read(&pipe->kref.refcount),
				mdss_mdp_panic_signal_supported(mdata, pipe));
			       mdss_mdp_panic_signal_support_mode(mdata, pipe));
		}
	}
	return cnt;
+2 −12
Original line number Diff line number Diff line
@@ -1726,12 +1726,10 @@ static int mdss_mdp_parse_dt_pipe_clk_ctrl(struct platform_device *pdev,
static void mdss_mdp_parse_dt_pipe_panic_ctrl(struct platform_device *pdev,
	char *prop_name, struct mdss_mdp_pipe *pipe_list, u32 npipes)
{
	int rc = 0;
	int i, j;
	size_t len;
	const u32 *arr;
	struct mdss_mdp_pipe *pipe = NULL;
	struct mdss_data_type *mdata = platform_get_drvdata(pdev);

	arr = of_get_property(pdev->dev.of_node, prop_name, (int *) &len);
	if (arr) {
@@ -1740,27 +1738,19 @@ static void mdss_mdp_parse_dt_pipe_panic_ctrl(struct platform_device *pdev,
			if (j >= npipes) {
				pr_err("invalid panic ctrl enries for prop: %s\n",
					prop_name);
				goto error;
				return;
			}

			pipe = &pipe_list[j];
			pipe->panic_ctrl_ndx = be32_to_cpu(arr[i++]);
		}
		if (j != npipes) {
		if (j != npipes)
			pr_err("%s: %d entries found. required %d\n",
				prop_name, j, npipes);
			rc = -EINVAL;
			goto error;
		}
	} else {
		pr_debug("panic ctrl enabled but property '%s' not found\n",
								prop_name);
		rc = -EINVAL;
	}

error:
	if (rc)
		mdata->has_panic_ctrl = false;
}

static int mdss_mdp_parse_dt_pipe(struct platform_device *pdev)
+21 −6
Original line number Diff line number Diff line
@@ -127,6 +127,12 @@ enum mdss_mdp_reg_bus_cfg {
	REG_CLK_CFG_HIGH,
};

enum mdss_mdp_panic_signal_type {
	MDSS_MDP_PANIC_NONE,
	MDSS_MDP_PANIC_COMMON_REG_CFG,
	MDSS_MDP_PANIC_PER_PIPE_CFG,
};

/**
 * enum mdp_commit_stage_type - Indicate different commit stages
 *
@@ -603,15 +609,24 @@ static inline int mdss_mdp_line_buffer_width(void)
	return MAX_LINE_BUFFER_WIDTH;
}

static inline int mdss_mdp_panic_signal_supported(
static inline int mdss_mdp_panic_signal_support_mode(
	struct mdss_data_type *mdata, struct mdss_mdp_pipe *pipe)
{
	return ((IS_MDSS_MAJOR_MINOR_SAME(mdata->mdp_rev,
	uint32_t signal_mode = MDSS_MDP_PANIC_NONE;

	if (pipe && pipe->mixer_left &&
		pipe->mixer_left->type != MDSS_MDP_MIXER_TYPE_INTF) {
		if (IS_MDSS_MAJOR_MINOR_SAME(mdata->mdp_rev,
					MDSS_MDP_HW_REV_105) ||
		    IS_MDSS_MAJOR_MINOR_SAME(mdata->mdp_rev,
					MDSS_MDP_HW_REV_108)) &&
		pipe->mixer_left &&
		pipe->mixer_left->type == MDSS_MDP_MIXER_TYPE_INTF);
					MDSS_MDP_HW_REV_108))
			signal_mode = MDSS_MDP_PANIC_COMMON_REG_CFG;
		else if (IS_MDSS_MAJOR_MINOR_SAME(mdata->mdp_rev,
					MDSS_MDP_HW_REV_107))
			signal_mode = MDSS_MDP_PANIC_PER_PIPE_CFG;
	}

	return signal_mode;
}

static inline struct clk *mdss_mdp_get_clk(u32 clk_idx)
+1 −0
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ enum mdss_mdp_sspp_chroma_samp_type {
#define MDSS_MDP_REG_SSPP_REQPRIO_FIFO_WM_0		0x050
#define MDSS_MDP_REG_SSPP_REQPRIO_FIFO_WM_1		0x054
#define MDSS_MDP_REG_SSPP_REQPRIO_FIFO_WM_2		0x058
#define MDSS_MDP_REG_SSPP_QOS_CTRL			0x06C

#define MDSS_MDP_REG_SSPP_SRC_OP_MODE			0x038
#define MDSS_MDP_OP_DEINTERLACE			BIT(22)
+28 −16
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ int mdss_mdp_pipe_panic_signal_ctrl(struct mdss_mdp_pipe *pipe, bool enable)
	if (!mdata->has_panic_ctrl)
		goto end;

	switch (mdss_mdp_panic_signal_support_mode(mdata, pipe)) {
	case MDSS_MDP_PANIC_COMMON_REG_CFG:
		mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
		panic_robust_ctrl = readl_relaxed(mdata->mdp_base +
				MMSS_MDP_PANIC_ROBUST_CTRL);
@@ -76,6 +78,20 @@ int mdss_mdp_pipe_panic_signal_ctrl(struct mdss_mdp_pipe *pipe, bool enable)
		writel_relaxed(panic_robust_ctrl,
				mdata->mdp_base + MMSS_MDP_PANIC_ROBUST_CTRL);
		mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
		break;
	case MDSS_MDP_PANIC_PER_PIPE_CFG:
		mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
		panic_robust_ctrl = mdss_mdp_pipe_read(pipe,
				MDSS_MDP_REG_SSPP_QOS_CTRL);
		if (enable)
			panic_robust_ctrl |= BIT(0);
		else
			panic_robust_ctrl &= ~BIT(0);
		mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_SSPP_QOS_CTRL,
					panic_robust_ctrl);
		mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
		break;
	}

end:
	return 0;
@@ -824,7 +840,6 @@ static struct mdss_mdp_pipe *mdss_mdp_pipe_init(struct mdss_mdp_mixer *mixer,
		return NULL;
	}

	if (pipe && mdss_mdp_panic_signal_supported(mdata, pipe))
	mdss_mdp_pipe_panic_signal_ctrl(pipe, false);

	if (pipe && mdss_mdp_pipe_is_sw_reset_available(mdata)) {
@@ -977,14 +992,12 @@ struct mdss_mdp_pipe *mdss_mdp_pipe_search(struct mdss_data_type *mdata,
static void mdss_mdp_pipe_free(struct kref *kref)
{
	struct mdss_mdp_pipe *pipe;
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();

	pipe = container_of(kref, struct mdss_mdp_pipe, kref);

	pr_debug("ndx=%x pnum=%d\n", pipe->ndx, pipe->num);

	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
	if (mdss_mdp_panic_signal_supported(mdata, pipe))
	mdss_mdp_pipe_panic_signal_ctrl(pipe, false);

	if (pipe->play_cnt) {
@@ -1643,7 +1656,6 @@ int mdss_mdp_pipe_queue_data(struct mdss_mdp_pipe *pipe,
			mdss_mdp_pipe_write(pipe, MDSS_MDP_REG_VIG_OP_MODE,
			opmode);

		if (mdss_mdp_panic_signal_supported(mdata, pipe))
		mdss_mdp_pipe_panic_signal_ctrl(pipe, true);
	}