Commit a94a6d76 authored by Jani Nikula's avatar Jani Nikula

drm/i915/mst: abstract intel_dp_mst_source_support()

Add a function for checking source MST support. Drop intel_dp->can_mst
and use intel_dp->mst_mgr.cbs to indicate the same. It's the single
point of truth without additional state variables. In code, "source
support" is also self-documenting as opposed to the vague "can mst".
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211006101618.22066-1-jani.nikula@intel.com
parent c474420b
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
#include <drm/drm_fourcc.h> #include <drm/drm_fourcc.h>
#include "i915_debugfs.h" #include "i915_debugfs.h"
#include "intel_de.h"
#include "intel_display_debugfs.h" #include "intel_display_debugfs.h"
#include "intel_display_power.h" #include "intel_display_power.h"
#include "intel_de.h"
#include "intel_display_types.h" #include "intel_display_types.h"
#include "intel_dmc.h" #include "intel_dmc.h"
#include "intel_dp.h" #include "intel_dp.h"
#include "intel_dp_mst.h"
#include "intel_drrs.h" #include "intel_drrs.h"
#include "intel_fbc.h" #include "intel_fbc.h"
#include "intel_hdcp.h" #include "intel_hdcp.h"
...@@ -1379,7 +1380,7 @@ static int i915_dp_mst_info(struct seq_file *m, void *unused) ...@@ -1379,7 +1380,7 @@ static int i915_dp_mst_info(struct seq_file *m, void *unused)
continue; continue;
dig_port = enc_to_dig_port(intel_encoder); dig_port = enc_to_dig_port(intel_encoder);
if (!dig_port->dp.can_mst) if (!intel_dp_mst_source_support(&dig_port->dp))
continue; continue;
seq_printf(m, "MST Source Port [ENCODER:%d:%s]\n", seq_printf(m, "MST Source Port [ENCODER:%d:%s]\n",
......
...@@ -1574,7 +1574,6 @@ struct intel_dp { ...@@ -1574,7 +1574,6 @@ struct intel_dp {
struct intel_pps pps; struct intel_pps pps;
bool can_mst; /* this port supports mst */
bool is_mst; bool is_mst;
int active_mst_links; int active_mst_links;
......
...@@ -2667,7 +2667,7 @@ intel_dp_can_mst(struct intel_dp *intel_dp) ...@@ -2667,7 +2667,7 @@ intel_dp_can_mst(struct intel_dp *intel_dp)
struct drm_i915_private *i915 = dp_to_i915(intel_dp); struct drm_i915_private *i915 = dp_to_i915(intel_dp);
return i915->params.enable_dp_mst && return i915->params.enable_dp_mst &&
intel_dp->can_mst && intel_dp_mst_source_support(intel_dp) &&
drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd); drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd);
} }
...@@ -2682,10 +2682,10 @@ intel_dp_configure_mst(struct intel_dp *intel_dp) ...@@ -2682,10 +2682,10 @@ intel_dp_configure_mst(struct intel_dp *intel_dp)
drm_dbg_kms(&i915->drm, drm_dbg_kms(&i915->drm,
"[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: %s\n", "[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: %s\n",
encoder->base.base.id, encoder->base.name, encoder->base.base.id, encoder->base.name,
yesno(intel_dp->can_mst), yesno(sink_can_mst), yesno(intel_dp_mst_source_support(intel_dp)), yesno(sink_can_mst),
yesno(i915->params.enable_dp_mst)); yesno(i915->params.enable_dp_mst));
if (!intel_dp->can_mst) if (!intel_dp_mst_source_support(intel_dp))
return; return;
intel_dp->is_mst = sink_can_mst && intel_dp->is_mst = sink_can_mst &&
...@@ -5085,7 +5085,7 @@ void intel_dp_mst_suspend(struct drm_i915_private *dev_priv) ...@@ -5085,7 +5085,7 @@ void intel_dp_mst_suspend(struct drm_i915_private *dev_priv)
intel_dp = enc_to_intel_dp(encoder); intel_dp = enc_to_intel_dp(encoder);
if (!intel_dp->can_mst) if (!intel_dp_mst_source_support(intel_dp))
continue; continue;
if (intel_dp->is_mst) if (intel_dp->is_mst)
...@@ -5109,7 +5109,7 @@ void intel_dp_mst_resume(struct drm_i915_private *dev_priv) ...@@ -5109,7 +5109,7 @@ void intel_dp_mst_resume(struct drm_i915_private *dev_priv)
intel_dp = enc_to_intel_dp(encoder); intel_dp = enc_to_intel_dp(encoder);
if (!intel_dp->can_mst) if (!intel_dp_mst_source_support(intel_dp))
continue; continue;
ret = drm_dp_mst_topology_mgr_resume(&intel_dp->mst_mgr, ret = drm_dp_mst_topology_mgr_resume(&intel_dp->mst_mgr,
......
...@@ -977,24 +977,31 @@ intel_dp_mst_encoder_init(struct intel_digital_port *dig_port, int conn_base_id) ...@@ -977,24 +977,31 @@ intel_dp_mst_encoder_init(struct intel_digital_port *dig_port, int conn_base_id)
dig_port->max_lanes, dig_port->max_lanes,
max_source_rate, max_source_rate,
conn_base_id); conn_base_id);
if (ret) if (ret) {
intel_dp->mst_mgr.cbs = NULL;
return ret; return ret;
}
intel_dp->can_mst = true;
return 0; return 0;
} }
bool intel_dp_mst_source_support(struct intel_dp *intel_dp)
{
return intel_dp->mst_mgr.cbs;
}
void void
intel_dp_mst_encoder_cleanup(struct intel_digital_port *dig_port) intel_dp_mst_encoder_cleanup(struct intel_digital_port *dig_port)
{ {
struct intel_dp *intel_dp = &dig_port->dp; struct intel_dp *intel_dp = &dig_port->dp;
if (!intel_dp->can_mst) if (!intel_dp_mst_source_support(intel_dp))
return; return;
drm_dp_mst_topology_mgr_destroy(&intel_dp->mst_mgr); drm_dp_mst_topology_mgr_destroy(&intel_dp->mst_mgr);
/* encoders will get killed by normal cleanup */ /* encoders will get killed by normal cleanup */
intel_dp->mst_mgr.cbs = NULL;
} }
bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state) bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state)
......
...@@ -8,13 +8,15 @@ ...@@ -8,13 +8,15 @@
#include <linux/types.h> #include <linux/types.h>
struct intel_digital_port;
struct intel_crtc_state; struct intel_crtc_state;
struct intel_digital_port;
struct intel_dp;
int intel_dp_mst_encoder_init(struct intel_digital_port *dig_port, int conn_id); int intel_dp_mst_encoder_init(struct intel_digital_port *dig_port, int conn_id);
void intel_dp_mst_encoder_cleanup(struct intel_digital_port *dig_port); void intel_dp_mst_encoder_cleanup(struct intel_digital_port *dig_port);
int intel_dp_mst_encoder_active_links(struct intel_digital_port *dig_port); int intel_dp_mst_encoder_active_links(struct intel_digital_port *dig_port);
bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state); bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state);
bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state); bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state);
bool intel_dp_mst_source_support(struct intel_dp *intel_dp);
#endif /* __INTEL_DP_MST_H__ */ #endif /* __INTEL_DP_MST_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment