From 46e93edf2e831861edc8c0b4477edf4a2aa1d6c7 Mon Sep 17 00:00:00 2001 From: Tatenda Chipeperekwa Date: Mon, 28 Sep 2020 15:54:53 -0700 Subject: [PATCH] disp: msm: dp: skip link training in simulation mode Skip link training when in simulation mode considering that we are not yet implementing tests specific to link training. This change will reduce the time it takes to power on the panel in simulation mode, and also reduce the likelihood of failures caused by unresponsive host machines. Change-Id: Ie215cafd545bb25b4a033ceae1f275c690e7433d Signed-off-by: Tatenda Chipeperekwa --- msm/dp/dp_ctrl.c | 28 ++++++++++++++++++++++++++++ msm/dp/dp_ctrl.h | 2 ++ msm/dp/dp_debug.c | 2 ++ 3 files changed, 32 insertions(+) diff --git a/msm/dp/dp_ctrl.c b/msm/dp/dp_ctrl.c index 3f69f235ad..8e8c11c020 100644 --- a/msm/dp/dp_ctrl.c +++ b/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: diff --git a/msm/dp/dp_ctrl.h b/msm/dp/dp_ctrl.h index 50b3d48ab9..940aa1e8c3 100644 --- a/msm/dp/dp_ctrl.h +++ b/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 { diff --git a/msm/dp/dp_debug.c b/msm/dp/dp_debug.c index 7610d65eb3..e854c2f945 100644 --- a/msm/dp/dp_debug.c +++ b/msm/dp/dp_debug.c @@ -1601,6 +1601,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"); @@ -1611,6 +1612,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);