disp: msm: dp: optimize sim function handling in dp_debug
Remove edid/dpcd simulation function from dp_debug and calls to sim bridge instead to simplify dp_debug module. Also add mst edid support and mst hpd simulation from aux level. Move selected mode from dp_debug module to dp_panel module to simplify mst handling and decouple dp_debug from main dp driver. Remove custom edid/dpcd mode from dp_panel and dp_aux module. Remove mst connector list handling from dp_display module. Change-Id: Ife1d2deb0e353f0a9695b7b90e5bf3459e1c81f7 Signed-off-by: Xiaowen Wu <wxiaowen@codeaurora.org> Signed-off-by: Karim Henain <khenain@codeaurora.org> Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
This commit is contained in:

committed by
Sudarsan Ramesh

vanhempi
24d245556e
commit
67ce55687b
@@ -1599,7 +1599,7 @@ static void dp_display_attention_work(struct work_struct *work)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (dp->debug->mst_hpd_sim || !dp_display_state_is(DP_STATE_READY)) {
|
||||
if (!dp_display_state_is(DP_STATE_READY)) {
|
||||
mutex_unlock(&dp->session_lock);
|
||||
goto mst_attention;
|
||||
}
|
||||
@@ -1740,8 +1740,7 @@ static int dp_display_usbpd_attention_cb(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((dp->hpd->hpd_irq && dp_display_state_is(DP_STATE_READY)) ||
|
||||
dp->debug->mst_hpd_sim) {
|
||||
if (dp->hpd->hpd_irq && dp_display_state_is(DP_STATE_READY)) {
|
||||
queue_work(dp->wq, &dp->attention_work);
|
||||
complete_all(&dp->attention_comp);
|
||||
} else if (dp->process_hpd_connect ||
|
||||
@@ -2796,72 +2795,6 @@ static int dp_display_validate_topology(struct dp_display_private *dp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dp_display_validate_mst_connectors(struct dp_debug *debug,
|
||||
struct dp_panel *dp_panel, struct drm_display_mode *mode,
|
||||
enum drm_mode_status *mode_status, bool *use_default)
|
||||
{
|
||||
struct dp_mst_connector *mst_connector;
|
||||
int hdis, vdis, vref, ar, _hdis, _vdis, _vref, _ar;
|
||||
bool in_list = false;
|
||||
|
||||
/*
|
||||
* If the connector exists in the mst connector list and if debug is
|
||||
* enabled for that connector, use the mst connector settings from the
|
||||
* list for validation. Otherwise, use non-mst default settings.
|
||||
*/
|
||||
mutex_lock(&debug->dp_mst_connector_list.lock);
|
||||
|
||||
if (list_empty(&debug->dp_mst_connector_list.list)) {
|
||||
mutex_unlock(&debug->dp_mst_connector_list.lock);
|
||||
*use_default = true;
|
||||
return;
|
||||
}
|
||||
|
||||
list_for_each_entry(mst_connector, &debug->dp_mst_connector_list.list,
|
||||
list) {
|
||||
if (mst_connector->con_id != dp_panel->connector->base.id)
|
||||
continue;
|
||||
|
||||
in_list = true;
|
||||
|
||||
if (!mst_connector->debug_en) {
|
||||
mutex_unlock(&debug->dp_mst_connector_list.lock);
|
||||
*use_default = false;
|
||||
*mode_status = MODE_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
hdis = mst_connector->hdisplay;
|
||||
vdis = mst_connector->vdisplay;
|
||||
vref = mst_connector->vrefresh;
|
||||
ar = mst_connector->aspect_ratio;
|
||||
|
||||
_hdis = mode->hdisplay;
|
||||
_vdis = mode->vdisplay;
|
||||
_vref = drm_mode_vrefresh(mode);
|
||||
_ar = mode->picture_aspect_ratio;
|
||||
|
||||
if (hdis == _hdis && vdis == _vdis && vref == _vref &&
|
||||
ar == _ar) {
|
||||
mutex_unlock(&debug->dp_mst_connector_list.lock);
|
||||
*use_default = false;
|
||||
*mode_status = MODE_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&debug->dp_mst_connector_list.lock);
|
||||
|
||||
if (in_list) {
|
||||
*use_default = false;
|
||||
return;
|
||||
}
|
||||
|
||||
*use_default = true;
|
||||
}
|
||||
|
||||
static enum drm_mode_status dp_display_validate_mode(
|
||||
struct dp_display *dp_display,
|
||||
void *panel, struct drm_display_mode *mode,
|
||||
@@ -2873,7 +2806,6 @@ static enum drm_mode_status dp_display_validate_mode(
|
||||
enum drm_mode_status mode_status = MODE_BAD;
|
||||
struct dp_display_mode dp_mode;
|
||||
int rc = 0;
|
||||
bool use_default = true;
|
||||
|
||||
if (!dp_display || !mode || !panel ||
|
||||
!avail_res || !avail_res->max_mixer_width) {
|
||||
@@ -2919,17 +2851,6 @@ static enum drm_mode_status dp_display_validate_mode(
|
||||
if (rc)
|
||||
goto end;
|
||||
|
||||
dp_display_validate_mst_connectors(debug, dp_panel, mode, &mode_status,
|
||||
&use_default);
|
||||
if (!use_default)
|
||||
goto end;
|
||||
|
||||
if (debug->debug_en && (mode->hdisplay != debug->hdisplay ||
|
||||
mode->vdisplay != debug->vdisplay ||
|
||||
drm_mode_vrefresh(mode) != debug->vrefresh ||
|
||||
mode->picture_aspect_ratio != debug->aspect_ratio))
|
||||
goto end;
|
||||
|
||||
mode_status = MODE_OK;
|
||||
end:
|
||||
mutex_unlock(&dp->session_lock);
|
||||
@@ -3281,8 +3202,6 @@ static int dp_display_mst_connector_install(struct dp_display *dp_display,
|
||||
struct dp_panel_in panel_in;
|
||||
struct dp_panel *dp_panel;
|
||||
struct dp_display_private *dp;
|
||||
struct dp_mst_connector *mst_connector;
|
||||
struct dp_mst_connector *cached_connector;
|
||||
|
||||
if (!dp_display || !connector) {
|
||||
DP_ERR("invalid input\n");
|
||||
@@ -3326,38 +3245,6 @@ static int dp_display_mst_connector_install(struct dp_display *dp_display,
|
||||
DP_MST_DEBUG("dp mst connector installed. conn:%d\n",
|
||||
connector->base.id);
|
||||
|
||||
mutex_lock(&dp->debug->dp_mst_connector_list.lock);
|
||||
|
||||
mst_connector = kmalloc(sizeof(struct dp_mst_connector),
|
||||
GFP_KERNEL);
|
||||
if (!mst_connector) {
|
||||
mutex_unlock(&dp->debug->dp_mst_connector_list.lock);
|
||||
rc = -ENOMEM;
|
||||
goto end;
|
||||
}
|
||||
|
||||
cached_connector = &dp->debug->mst_connector_cache;
|
||||
if (cached_connector->debug_en) {
|
||||
mst_connector->debug_en = true;
|
||||
mst_connector->hdisplay = cached_connector->hdisplay;
|
||||
mst_connector->vdisplay = cached_connector->vdisplay;
|
||||
mst_connector->vrefresh = cached_connector->vrefresh;
|
||||
mst_connector->aspect_ratio = cached_connector->aspect_ratio;
|
||||
memset(cached_connector, 0, sizeof(*cached_connector));
|
||||
dp->debug->set_mst_con(dp->debug, connector->base.id);
|
||||
} else {
|
||||
mst_connector->debug_en = false;
|
||||
}
|
||||
|
||||
mst_connector->conn = connector;
|
||||
mst_connector->con_id = connector->base.id;
|
||||
mst_connector->state = connector_status_unknown;
|
||||
INIT_LIST_HEAD(&mst_connector->list);
|
||||
|
||||
list_add(&mst_connector->list,
|
||||
&dp->debug->dp_mst_connector_list.list);
|
||||
|
||||
mutex_unlock(&dp->debug->dp_mst_connector_list.lock);
|
||||
end:
|
||||
mutex_unlock(&dp->session_lock);
|
||||
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, dp->state, rc);
|
||||
@@ -3372,7 +3259,6 @@ static int dp_display_mst_connector_uninstall(struct dp_display *dp_display,
|
||||
struct sde_connector *sde_conn;
|
||||
struct dp_panel *dp_panel;
|
||||
struct dp_display_private *dp;
|
||||
struct dp_mst_connector *con_to_remove, *temp_con;
|
||||
|
||||
if (!dp_display || !connector) {
|
||||
DP_ERR("invalid input\n");
|
||||
@@ -3404,64 +3290,12 @@ static int dp_display_mst_connector_uninstall(struct dp_display *dp_display,
|
||||
DP_MST_DEBUG("dp mst connector uninstalled. conn:%d\n",
|
||||
connector->base.id);
|
||||
|
||||
mutex_lock(&dp->debug->dp_mst_connector_list.lock);
|
||||
|
||||
list_for_each_entry_safe(con_to_remove, temp_con,
|
||||
&dp->debug->dp_mst_connector_list.list, list) {
|
||||
if (con_to_remove->conn == connector) {
|
||||
/*
|
||||
* cache any debug info if enabled that can be applied
|
||||
* on new connectors.
|
||||
*/
|
||||
if (con_to_remove->debug_en)
|
||||
memcpy(&dp->debug->mst_connector_cache,
|
||||
con_to_remove,
|
||||
sizeof(*con_to_remove));
|
||||
|
||||
list_del(&con_to_remove->list);
|
||||
kfree(con_to_remove);
|
||||
}
|
||||
}
|
||||
|
||||
mutex_unlock(&dp->debug->dp_mst_connector_list.lock);
|
||||
mutex_unlock(&dp->session_lock);
|
||||
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, dp->state);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int dp_display_mst_get_connector_info(struct dp_display *dp_display,
|
||||
struct drm_connector *connector,
|
||||
struct dp_mst_connector *mst_conn)
|
||||
{
|
||||
struct dp_display_private *dp;
|
||||
struct dp_mst_connector *conn, *temp_conn;
|
||||
|
||||
if (!connector || !mst_conn) {
|
||||
DP_ERR("invalid input\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dp = container_of(dp_display, struct dp_display_private, dp_display);
|
||||
|
||||
mutex_lock(&dp->session_lock);
|
||||
if (!dp->mst.drm_registered) {
|
||||
DP_DEBUG("drm mst not registered\n");
|
||||
mutex_unlock(&dp->session_lock);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
mutex_lock(&dp->debug->dp_mst_connector_list.lock);
|
||||
list_for_each_entry_safe(conn, temp_conn,
|
||||
&dp->debug->dp_mst_connector_list.list, list) {
|
||||
if (conn->con_id == connector->base.id)
|
||||
memcpy(mst_conn, conn, sizeof(*mst_conn));
|
||||
}
|
||||
mutex_unlock(&dp->debug->dp_mst_connector_list.lock);
|
||||
mutex_unlock(&dp->session_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dp_display_mst_connector_update_edid(struct dp_display *dp_display,
|
||||
struct drm_connector *connector,
|
||||
struct edid *edid)
|
||||
@@ -3710,8 +3544,6 @@ static int dp_display_probe(struct platform_device *pdev)
|
||||
g_dp_display->set_stream_info = dp_display_set_stream_info;
|
||||
g_dp_display->update_pps = dp_display_update_pps;
|
||||
g_dp_display->convert_to_dp_mode = dp_display_convert_to_dp_mode;
|
||||
g_dp_display->mst_get_connector_info =
|
||||
dp_display_mst_get_connector_info;
|
||||
g_dp_display->mst_get_fixed_topology_port =
|
||||
dp_display_mst_get_fixed_topology_port;
|
||||
g_dp_display->wakeup_phy_layer =
|
||||
|
Viittaa uudesa ongelmassa
Block a user