diff mbox series

[v2,3/6] drm/i915/mst: abstract choosing the MST mode to use

Message ID 7c54416835620ae497cb8e0d2c62d124eeb5efeb.1707823736.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/mst: enable MST mode for 128b/132b single-stream sideband | expand

Commit Message

Jani Nikula Feb. 13, 2024, 11:30 a.m. UTC
Clarify the conditions for choosing the MST mode to use by adding a new
function intel_dp_mst_mode_choose(). This also prepares for being able
to extend the MST modes to single-stream sideband messaging.

Cc: Arun R Murthy <arun.r.murthy@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

Comments

Ville Syrjälä Feb. 14, 2024, 6:18 p.m. UTC | #1
On Tue, Feb 13, 2024 at 01:30:58PM +0200, Jani Nikula wrote:
> Clarify the conditions for choosing the MST mode to use by adding a new
> function intel_dp_mst_mode_choose(). This also prepares for being able
> to extend the MST modes to single-stream sideband messaging.
> 
> Cc: Arun R Murthy <arun.r.murthy@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 944f566525dd..007cb2a04e38 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -4015,6 +4015,24 @@ static const char *intel_dp_mst_mode_str(enum drm_dp_mst_mode mst_mode)
>  		return str_yes_no(mst_mode == DRM_DP_MST);
>  }
>  
> +static enum drm_dp_mst_mode
> +intel_dp_mst_mode_choose(struct intel_dp *intel_dp,
> +			 enum drm_dp_mst_mode sink_mst_mode)
> +{
> +	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> +
> +	if (!i915->display.params.enable_dp_mst)
> +		return DRM_DP_SST;
> +
> +	if (!intel_dp_mst_source_support(intel_dp))
> +		return DRM_DP_SST;
> +
> +	if (sink_mst_mode == DRM_DP_SST_SIDEBAND_MSG)
> +		return DRM_DP_SST;
> +
> +	return sink_mst_mode;
> +}
> +
>  static bool
>  intel_dp_mst_detect(struct intel_dp *intel_dp)
>  {
> @@ -4025,12 +4043,7 @@ intel_dp_mst_detect(struct intel_dp *intel_dp)
>  
>  	sink_mst_mode = drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd);
>  
> -	if (i915->display.params.enable_dp_mst &&
> -	    intel_dp_mst_source_support(intel_dp) &&
> -	    sink_mst_mode == DRM_DP_MST)
> -		mst_detect = DRM_DP_MST;
> -	else
> -		mst_detect = DRM_DP_SST;
> +	mst_detect = intel_dp_mst_mode_choose(intel_dp, sink_mst_mode);
>  
>  	drm_dbg_kms(&i915->drm,
>  		    "[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: %s -> enable: %s\n",
> -- 
> 2.39.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 944f566525dd..007cb2a04e38 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4015,6 +4015,24 @@  static const char *intel_dp_mst_mode_str(enum drm_dp_mst_mode mst_mode)
 		return str_yes_no(mst_mode == DRM_DP_MST);
 }
 
+static enum drm_dp_mst_mode
+intel_dp_mst_mode_choose(struct intel_dp *intel_dp,
+			 enum drm_dp_mst_mode sink_mst_mode)
+{
+	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+
+	if (!i915->display.params.enable_dp_mst)
+		return DRM_DP_SST;
+
+	if (!intel_dp_mst_source_support(intel_dp))
+		return DRM_DP_SST;
+
+	if (sink_mst_mode == DRM_DP_SST_SIDEBAND_MSG)
+		return DRM_DP_SST;
+
+	return sink_mst_mode;
+}
+
 static bool
 intel_dp_mst_detect(struct intel_dp *intel_dp)
 {
@@ -4025,12 +4043,7 @@  intel_dp_mst_detect(struct intel_dp *intel_dp)
 
 	sink_mst_mode = drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd);
 
-	if (i915->display.params.enable_dp_mst &&
-	    intel_dp_mst_source_support(intel_dp) &&
-	    sink_mst_mode == DRM_DP_MST)
-		mst_detect = DRM_DP_MST;
-	else
-		mst_detect = DRM_DP_SST;
+	mst_detect = intel_dp_mst_mode_choose(intel_dp, sink_mst_mode);
 
 	drm_dbg_kms(&i915->drm,
 		    "[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: %s -> enable: %s\n",