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

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

mdss: mdp: Separate intfs func ptr to their own struct



Cleans up interface specific function pointer to be
grouped together.

Change-Id: I5be4bdd8248e672dda1162bf119f44762a5e8f7a
Signed-off-by: default avatarTerence Hampson <thampson@codeaurora.org>
parent b6d89b7b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -171,8 +171,8 @@ void mdss_check_dsi_ctrl_status(struct work_struct *work, uint32_t interval)
	 * display reset not to be proper. Hence, wait for DMA_P done
	 * for command mode panels before triggering BTA.
	 */
	if (ctl->wait_pingpong)
		ctl->wait_pingpong(ctl, NULL);
	if (ctl->ops.wait_pingpong)
		ctl->ops.wait_pingpong(ctl, NULL);

	pr_debug("%s: DSI ctrl wait for ping pong done\n", __func__);

+18 −14
Original line number Diff line number Diff line
@@ -212,6 +212,23 @@ struct mdss_mdp_perf_params {
	DECLARE_BITMAP(bw_vote_mode, MDSS_MDP_BW_MODE_MAX);
};

struct mdss_mdp_ctl_intfs_ops {
	int (*start_fnc)(struct mdss_mdp_ctl *ctl);
	int (*stop_fnc)(struct mdss_mdp_ctl *ctl, int panel_power_state);
	int (*prepare_fnc)(struct mdss_mdp_ctl *ctl, void *arg);
	int (*display_fnc)(struct mdss_mdp_ctl *ctl, void *arg);
	int (*wait_fnc)(struct mdss_mdp_ctl *ctl, void *arg);
	int (*wait_pingpong)(struct mdss_mdp_ctl *ctl, void *arg);
	u32 (*read_line_cnt_fnc)(struct mdss_mdp_ctl *);
	int (*add_vsync_handler)(struct mdss_mdp_ctl *,
					struct mdss_mdp_vsync_handler *);
	int (*remove_vsync_handler)(struct mdss_mdp_ctl *,
					struct mdss_mdp_vsync_handler *);
	int (*config_fps_fnc)(struct mdss_mdp_ctl *ctl,
				struct mdss_mdp_ctl *sctl, int new_fps);
	int (*restore_fnc)(struct mdss_mdp_ctl *ctl);
};

struct mdss_mdp_ctl {
	u32 num;
	char __iomem *base;
@@ -273,20 +290,7 @@ struct mdss_mdp_ctl {
	bool cmd_autorefresh_en;
	int autorefresh_frame_cnt;

	int (*start_fnc) (struct mdss_mdp_ctl *ctl);
	int (*stop_fnc) (struct mdss_mdp_ctl *ctl, int panel_power_state);
	int (*prepare_fnc) (struct mdss_mdp_ctl *ctl, void *arg);
	int (*display_fnc) (struct mdss_mdp_ctl *ctl, void *arg);
	int (*wait_fnc) (struct mdss_mdp_ctl *ctl, void *arg);
	int (*wait_pingpong) (struct mdss_mdp_ctl *ctl, void *arg);
	u32 (*read_line_cnt_fnc) (struct mdss_mdp_ctl *);
	int (*add_vsync_handler) (struct mdss_mdp_ctl *,
					struct mdss_mdp_vsync_handler *);
	int (*remove_vsync_handler) (struct mdss_mdp_ctl *,
					struct mdss_mdp_vsync_handler *);
	int (*config_fps_fnc) (struct mdss_mdp_ctl *ctl,
				struct mdss_mdp_ctl *sctl, int new_fps);
	int (*restore_fnc) (struct mdss_mdp_ctl *ctl);
	struct mdss_mdp_ctl_intfs_ops ops;

	struct blocking_notifier_head notifier_head;

+36 −45
Original line number Diff line number Diff line
@@ -1557,16 +1557,7 @@ static int mdss_mdp_ctl_free(struct mdss_mdp_ctl *ctl)
	ctl->intf_type = MDSS_MDP_NO_INTF;
	ctl->is_secure = false;
	ctl->power_state = MDSS_PANEL_POWER_OFF;
	ctl->start_fnc = NULL;
	ctl->stop_fnc = NULL;
	ctl->prepare_fnc = NULL;
	ctl->display_fnc = NULL;
	ctl->wait_fnc = NULL;
	ctl->read_line_cnt_fnc = NULL;
	ctl->add_vsync_handler = NULL;
	ctl->remove_vsync_handler = NULL;
	ctl->config_fps_fnc = NULL;
	ctl->panel_data = NULL;
	memset(&ctl->ops, 0, sizeof(ctl->ops));
	mutex_unlock(&mdss_mdp_ctl_lock);

	return 0;
@@ -1733,14 +1724,14 @@ struct mdss_mdp_mixer *mdss_mdp_wb_mixer_alloc(int rotator)

	ctl->mixer_left = mixer;

	ctl->start_fnc = mdss_mdp_writeback_start;
	ctl->ops.start_fnc = mdss_mdp_writeback_start;
	ctl->power_state = MDSS_PANEL_POWER_ON;
	ctl->wb_type = (rotator ? MDSS_MDP_WB_CTL_TYPE_BLOCK :
			MDSS_MDP_WB_CTL_TYPE_LINE);
	mixer->ctl = ctl;

	if (ctl->start_fnc)
		ctl->start_fnc(ctl);
	if (ctl->ops.start_fnc)
		ctl->ops.start_fnc(ctl);

	return mixer;
error:
@@ -1766,8 +1757,8 @@ int mdss_mdp_wb_mixer_destroy(struct mdss_mdp_mixer *mixer)

	pr_debug("destroy ctl=%d mixer=%d\n", ctl->num, mixer->num);

	if (ctl->stop_fnc)
		ctl->stop_fnc(ctl, MDSS_PANEL_POWER_OFF);
	if (ctl->ops.stop_fnc)
		ctl->ops.stop_fnc(ctl, MDSS_PANEL_POWER_OFF);

	mdss_mdp_ctl_free(ctl);

@@ -2108,7 +2099,7 @@ struct mdss_mdp_ctl *mdss_mdp_ctl_init(struct mdss_panel_data *pdata,
		ctl->intf_num = MDSS_MDP_INTF0;
		ctl->intf_type = MDSS_INTF_EDP;
		ctl->opmode = MDSS_MDP_CTL_OP_VIDEO_MODE;
		ctl->start_fnc = mdss_mdp_video_start;
		ctl->ops.start_fnc = mdss_mdp_video_start;
		break;
	case MIPI_VIDEO_PANEL:
		ctl->is_video_mode = true;
@@ -2120,7 +2111,7 @@ struct mdss_mdp_ctl *mdss_mdp_ctl_init(struct mdss_panel_data *pdata,
				MDSS_MDP_INTF2;
		ctl->intf_type = MDSS_INTF_DSI;
		ctl->opmode = MDSS_MDP_CTL_OP_VIDEO_MODE;
		ctl->start_fnc = mdss_mdp_video_start;
		ctl->ops.start_fnc = mdss_mdp_video_start;
		break;
	case MIPI_CMD_PANEL:
		if (pdata->panel_info.pdest == DISPLAY_1)
@@ -2131,21 +2122,21 @@ struct mdss_mdp_ctl *mdss_mdp_ctl_init(struct mdss_panel_data *pdata,
				MDSS_MDP_INTF2;
		ctl->intf_type = MDSS_INTF_DSI;
		ctl->opmode = MDSS_MDP_CTL_OP_CMD_MODE;
		ctl->start_fnc = mdss_mdp_cmd_start;
		ctl->ops.start_fnc = mdss_mdp_cmd_start;
		break;
	case DTV_PANEL:
		ctl->is_video_mode = true;
		ctl->intf_num = MDSS_MDP_INTF3;
		ctl->intf_type = MDSS_INTF_HDMI;
		ctl->opmode = MDSS_MDP_CTL_OP_VIDEO_MODE;
		ctl->start_fnc = mdss_mdp_video_start;
		ctl->ops.start_fnc = mdss_mdp_video_start;
		ret = mdss_mdp_limited_lut_igc_config(ctl);
		if (ret)
			pr_err("Unable to config IGC LUT data\n");
		break;
	case WRITEBACK_PANEL:
		ctl->intf_num = MDSS_MDP_NO_INTF;
		ctl->start_fnc = mdss_mdp_writeback_start;
		ctl->ops.start_fnc = mdss_mdp_writeback_start;
		ret = mdss_mdp_ctl_setup_wfd(ctl);
		if (ret)
			goto ctl_init_fail;
@@ -2417,8 +2408,8 @@ void mdss_mdp_ctl_restore(void)
			mdss_mdp_ctl_restore_sub(sctl);
			mdss_mdp_ctl_split_display_enable(1, ctl, sctl);
		}
		if (ctl->restore_fnc)
			ctl->restore_fnc(ctl);
		if (ctl->ops.restore_fnc)
			ctl->ops.restore_fnc(ctl);
	}
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
}
@@ -2438,8 +2429,8 @@ static int mdss_mdp_ctl_start_sub(struct mdss_mdp_ctl *ctl, bool handoff)
	 * (2) continuous splash finished.
	 */
	if (handoff || !ctl->panel_data->panel_info.cont_splash_enabled) {
		if (ctl->start_fnc)
			ret = ctl->start_fnc(ctl);
		if (ctl->ops.start_fnc)
			ret = ctl->ops.start_fnc(ctl);
		else
			pr_warn("no start function for ctl=%d type=%d\n",
					ctl->num,
@@ -2580,8 +2571,8 @@ int mdss_mdp_ctl_stop(struct mdss_mdp_ctl *ctl, int power_state)

	mdss_mdp_hist_intr_setup(&mdata->hist_intr, MDSS_IRQ_SUSPEND);

	if (ctl->stop_fnc) {
		ret = ctl->stop_fnc(ctl, power_state);
	if (ctl->ops.stop_fnc) {
		ret = ctl->ops.stop_fnc(ctl, power_state);
		if (ctl->panel_data->panel_info.fbc.enabled)
			mdss_mdp_ctl_fbc_enable(0, ctl->mixer_left,
				&ctl->panel_data->panel_info);
@@ -2589,8 +2580,8 @@ int mdss_mdp_ctl_stop(struct mdss_mdp_ctl *ctl, int power_state)
		pr_warn("no stop func for ctl=%d\n", ctl->num);
	}

	if (sctl && sctl->stop_fnc) {
		ret = sctl->stop_fnc(sctl, power_state);
	if (sctl && sctl->ops.stop_fnc) {
		ret = sctl->ops.stop_fnc(sctl, power_state);
		if (ctl->panel_data->panel_info.fbc.enabled)
			mdss_mdp_ctl_fbc_enable(0, sctl->mixer_left,
				&sctl->panel_data->panel_info);
@@ -3259,8 +3250,8 @@ int mdss_mdp_ctl_update_fps(struct mdss_mdp_ctl *ctl, int fps)

	sctl = mdss_mdp_get_split_ctl(ctl);

	if (ctl->config_fps_fnc)
		ret = ctl->config_fps_fnc(ctl, sctl, fps);
	if (ctl->ops.config_fps_fnc)
		ret = ctl->ops.config_fps_fnc(ctl, sctl, fps);

	return ret;
}
@@ -3274,7 +3265,7 @@ int mdss_mdp_display_wakeup_time(struct mdss_mdp_ctl *ctl,
	u32 time_of_line, time_to_vsync;
	ktime_t current_time = ktime_get();

	if (!ctl->read_line_cnt_fnc)
	if (!ctl->ops.read_line_cnt_fnc)
		return -ENOSYS;

	pinfo = &ctl->panel_data->panel_info;
@@ -3305,7 +3296,7 @@ int mdss_mdp_display_wakeup_time(struct mdss_mdp_ctl *ctl,
	if (!time_of_line)
		return -EINVAL;

	current_line = ctl->read_line_cnt_fnc(ctl);
	current_line = ctl->ops.read_line_cnt_fnc(ctl);

	total_line = pinfo->lcdc.v_back_porch +
		pinfo->lcdc.v_front_porch +
@@ -3351,8 +3342,8 @@ int mdss_mdp_display_wait4comp(struct mdss_mdp_ctl *ctl)
	}

	ATRACE_BEGIN("wait_fnc");
	if (ctl->wait_fnc)
		ret = ctl->wait_fnc(ctl, NULL);
	if (ctl->ops.wait_fnc)
		ret = ctl->ops.wait_fnc(ctl, NULL);
	ATRACE_END("wait_fnc");

	trace_mdp_commit(ctl);
@@ -3389,21 +3380,21 @@ int mdss_mdp_display_wait4pingpong(struct mdss_mdp_ctl *ctl, bool use_lock)
			return ret;
	}

	if (!mdss_mdp_ctl_is_power_on(ctl) || !ctl->wait_pingpong) {
	if (!mdss_mdp_ctl_is_power_on(ctl) || !ctl->ops.wait_pingpong) {
		if (use_lock)
			mutex_unlock(&ctl->lock);
		return 0;
	}

	ATRACE_BEGIN("wait_pingpong");
	ctl->wait_pingpong(ctl, NULL);
	ctl->ops.wait_pingpong(ctl, NULL);
	ATRACE_END("wait_pingpong");

	sctl = mdss_mdp_get_split_ctl(ctl);

	if (sctl && sctl->wait_pingpong) {
	if (sctl && sctl->ops.wait_pingpong) {
		ATRACE_BEGIN("wait_pingpong sctl");
		sctl->wait_pingpong(sctl, NULL);
		sctl->ops.wait_pingpong(sctl, NULL);
		ATRACE_END("wait_pingpong sctl");
	}

@@ -3462,8 +3453,8 @@ int mdss_mdp_display_commit(struct mdss_mdp_ctl *ctl, void *arg,
		(ctl->mixer_left && ctl->mixer_left->params_changed) ||
		(ctl->mixer_right && ctl->mixer_right->params_changed)) {
		ATRACE_BEGIN("prepare_fnc");
		if (ctl->prepare_fnc)
			ret = ctl->prepare_fnc(ctl, arg);
		if (ctl->ops.prepare_fnc)
			ret = ctl->ops.prepare_fnc(ctl, arg);
		ATRACE_END("prepare_fnc");
		if (ret) {
			pr_err("error preparing display\n");
@@ -3532,7 +3523,7 @@ int mdss_mdp_display_commit(struct mdss_mdp_ctl *ctl, void *arg,
	mdss_mdp_ctl_notify(ctl, MDP_NOTIFY_FRAME_READY);
	ATRACE_END("frame_ready");

	if (ctl->wait_pingpong && !mdata->serialize_wait4pp)
	if (ctl->ops.wait_pingpong && !mdata->serialize_wait4pp)
		mdss_mdp_display_wait4pingpong(ctl, false);

	if (commit_cb)
@@ -3559,11 +3550,11 @@ int mdss_mdp_display_commit(struct mdss_mdp_ctl *ctl, void *arg,
		 * Seperate kickoff on DSI1 is needed only when we have
		 * ONLY right half updating on a dual DSI panel
		 */
		if (sctl->display_fnc)
			ret = sctl->display_fnc(sctl, arg); /* DSI1 kickoff */
		if (sctl->ops.display_fnc)
			ret = sctl->ops.display_fnc(sctl, arg);
	} else {
		if (ctl->display_fnc)
			ret = ctl->display_fnc(ctl, arg); /* DSI0 kickoff */
		if (ctl->ops.display_fnc)
			ret = ctl->ops.display_fnc(ctl, arg); /* DSI0 kickoff */
	}

	if (sctl)
+12 −12
Original line number Diff line number Diff line
@@ -1234,11 +1234,11 @@ panel_events:
	pr_debug("%s: turn off panel\n", __func__);
	ctl->intf_ctx[MASTER_CTX] = NULL;
	ctl->intf_ctx[SLAVE_CTX] = NULL;
	ctl->stop_fnc = NULL;
	ctl->display_fnc = NULL;
	ctl->wait_pingpong = NULL;
	ctl->add_vsync_handler = NULL;
	ctl->remove_vsync_handler = NULL;
	ctl->ops.stop_fnc = NULL;
	ctl->ops.display_fnc = NULL;
	ctl->ops.wait_pingpong = NULL;
	ctl->ops.add_vsync_handler = NULL;
	ctl->ops.remove_vsync_handler = NULL;

end:
	if (!IS_ERR_VALUE(ret))
@@ -1391,13 +1391,13 @@ int mdss_mdp_cmd_start(struct mdss_mdp_ctl *ctl)
		return ret;
	}

	ctl->stop_fnc = mdss_mdp_cmd_stop;
	ctl->display_fnc = mdss_mdp_cmd_kickoff;
	ctl->wait_pingpong = mdss_mdp_cmd_wait4pingpong;
	ctl->add_vsync_handler = mdss_mdp_cmd_add_vsync_handler;
	ctl->remove_vsync_handler = mdss_mdp_cmd_remove_vsync_handler;
	ctl->read_line_cnt_fnc = mdss_mdp_cmd_line_count;
	ctl->restore_fnc = mdss_mdp_cmd_restore;
	ctl->ops.stop_fnc = mdss_mdp_cmd_stop;
	ctl->ops.display_fnc = mdss_mdp_cmd_kickoff;
	ctl->ops.wait_pingpong = mdss_mdp_cmd_wait4pingpong;
	ctl->ops.add_vsync_handler = mdss_mdp_cmd_add_vsync_handler;
	ctl->ops.remove_vsync_handler = mdss_mdp_cmd_remove_vsync_handler;
	ctl->ops.read_line_cnt_fnc = mdss_mdp_cmd_line_count;
	ctl->ops.restore_fnc = mdss_mdp_cmd_restore;
	pr_debug("%s:-\n", __func__);

	return 0;
+9 −9
Original line number Diff line number Diff line
@@ -638,13 +638,13 @@ static void recover_underrun_work(struct work_struct *work)
	struct mdss_mdp_ctl *ctl =
		container_of(work, typeof(*ctl), recover_work);

	if (!ctl || !ctl->add_vsync_handler) {
	if (!ctl || !ctl->ops.add_vsync_handler) {
		pr_err("ctl or vsync handler is NULL\n");
		return;
	}

	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_ON);
	ctl->add_vsync_handler(ctl, &ctl->recover_underrun_handler);
	ctl->ops.add_vsync_handler(ctl, &ctl->recover_underrun_handler);
	mdss_mdp_clk_ctrl(MDP_BLOCK_POWER_OFF);
}

@@ -1312,13 +1312,13 @@ int mdss_mdp_video_start(struct mdss_mdp_ctl *ctl)
		return ret;
	}

	ctl->stop_fnc = mdss_mdp_video_stop;
	ctl->display_fnc = mdss_mdp_video_display;
	ctl->wait_fnc = mdss_mdp_video_wait4comp;
	ctl->read_line_cnt_fnc = mdss_mdp_video_line_count;
	ctl->add_vsync_handler = mdss_mdp_video_add_vsync_handler;
	ctl->remove_vsync_handler = mdss_mdp_video_remove_vsync_handler;
	ctl->config_fps_fnc = mdss_mdp_video_config_fps;
	ctl->ops.stop_fnc = mdss_mdp_video_stop;
	ctl->ops.display_fnc = mdss_mdp_video_display;
	ctl->ops.wait_fnc = mdss_mdp_video_wait4comp;
	ctl->ops.read_line_cnt_fnc = mdss_mdp_video_line_count;
	ctl->ops.add_vsync_handler = mdss_mdp_video_add_vsync_handler;
	ctl->ops.remove_vsync_handler = mdss_mdp_video_remove_vsync_handler;
	ctl->ops.config_fps_fnc = mdss_mdp_video_config_fps;

	return 0;
}
Loading