Browse Source

Merge "disp: msm: dp: skip link training in simulation mode"

qctecmdr 4 năm trước cách đây
mục cha
commit
cf51cabb69
3 tập tin đã thay đổi với 32 bổ sung0 xóa
  1. 28 0
      msm/dp/dp_ctrl.c
  2. 2 0
      msm/dp/dp_ctrl.h
  3. 2 0
      msm/dp/dp_debug.c

+ 28 - 0
msm/dp/dp_ctrl.c

@@ -70,6 +70,7 @@ struct dp_ctrl_private {
 	bool mst_mode;
 	bool fec_mode;
 	bool dsc_mode;
+	bool sim_mode;
 
 	atomic_t aborted;
 
@@ -328,6 +329,12 @@ static int dp_ctrl_link_training_1(struct dp_ctrl_private *ctrl)
 	ctrl->aux->state &= ~DP_STATE_TRAIN_1_SUCCEEDED;
 	ctrl->aux->state |= DP_STATE_TRAIN_1_STARTED;
 
+	if (ctrl->sim_mode) {
+		DP_DEBUG("simulation enabled, skip clock recovery\n");
+		ret = 0;
+		goto skip_training;
+	}
+
 	dp_ctrl_state_ctrl(ctrl, 0);
 	/* Make sure to clear the current pattern before starting a new one */
 	wmb();
@@ -398,6 +405,7 @@ static int dp_ctrl_link_training_1(struct dp_ctrl_private *ctrl)
 		}
 	}
 
+skip_training:
 	ctrl->aux->state &= ~DP_STATE_TRAIN_1_STARTED;
 
 	if (ret)
@@ -451,6 +459,12 @@ static int dp_ctrl_link_training_2(struct dp_ctrl_private *ctrl)
 	ctrl->aux->state &= ~DP_STATE_TRAIN_2_SUCCEEDED;
 	ctrl->aux->state |= DP_STATE_TRAIN_2_STARTED;
 
+	if (ctrl->sim_mode) {
+		DP_DEBUG("simulation enabled, skip channel equalization\n");
+		ret = 0;
+		goto skip_training;
+	}
+
 	dp_ctrl_state_ctrl(ctrl, 0);
 	/* Make sure to clear the current pattern before starting a new one */
 	wmb();
@@ -505,6 +519,7 @@ static int dp_ctrl_link_training_2(struct dp_ctrl_private *ctrl)
 		ctrl->link->adjust_levels(ctrl->link, link_status);
 	}
 
+skip_training:
 	ctrl->aux->state &= ~DP_STATE_TRAIN_2_STARTED;
 
 	if (ret)
@@ -1397,6 +1412,18 @@ static void dp_ctrl_isr(struct dp_ctrl *dp_ctrl)
 		dp_ctrl_idle_patterns_sent(ctrl);
 }
 
+void dp_ctrl_set_sim_mode(struct dp_ctrl *dp_ctrl, bool en)
+{
+	struct dp_ctrl_private *ctrl;
+
+	if (!dp_ctrl)
+		return;
+
+	ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl);
+	ctrl->sim_mode = en;
+	DP_INFO("sim_mode=%d\n", ctrl->sim_mode);
+}
+
 struct dp_ctrl *dp_ctrl_get(struct dp_ctrl_in *in)
 {
 	int rc = 0;
@@ -1445,6 +1472,7 @@ struct dp_ctrl *dp_ctrl_get(struct dp_ctrl_in *in)
 	dp_ctrl->stream_off = dp_ctrl_stream_off;
 	dp_ctrl->stream_pre_off = dp_ctrl_stream_pre_off;
 	dp_ctrl->set_mst_channel_info = dp_ctrl_set_mst_channel_info;
+	dp_ctrl->set_sim_mode = dp_ctrl_set_sim_mode;
 
 	return dp_ctrl;
 error:

+ 2 - 0
msm/dp/dp_ctrl.h

@@ -12,6 +12,7 @@
 #include "dp_parser.h"
 #include "dp_power.h"
 #include "dp_catalog.h"
+#include "dp_debug.h"
 
 struct dp_ctrl {
 	int (*init)(struct dp_ctrl *dp_ctrl, bool flip, bool reset);
@@ -30,6 +31,7 @@ struct dp_ctrl {
 	void (*set_mst_channel_info)(struct dp_ctrl *dp_ctrl,
 			enum dp_stream_id strm,
 			u32 ch_start_slot, u32 ch_tot_slots);
+	void (*set_sim_mode)(struct dp_ctrl *dp_ctrl, bool en);
 };
 
 struct dp_ctrl_in {

+ 2 - 0
msm/dp/dp_debug.c

@@ -1603,6 +1603,7 @@ static void dp_debug_set_sim_mode(struct dp_debug_private *debug, bool sim)
 		debug->dp_debug.sim_mode = true;
 		debug->aux->set_sim_mode(debug->aux, true,
 			debug->edid, debug->dpcd);
+		debug->ctrl->set_sim_mode(debug->ctrl, true);
 	} else {
 		if (debug->hotplug) {
 			DP_WARN("sim mode off before hotplug disconnect\n");
@@ -1613,6 +1614,7 @@ static void dp_debug_set_sim_mode(struct dp_debug_private *debug, bool sim)
 		debug->ctrl->abort(debug->ctrl, true);
 
 		debug->aux->set_sim_mode(debug->aux, false, NULL, NULL);
+		debug->ctrl->set_sim_mode(debug->ctrl, false);
 		debug->dp_debug.sim_mode = false;
 
 		debug->panel->set_edid(debug->panel, 0);