diff mbox series

[03/19] drm/i915/display_debugfs: Allow force joiner only if supported

Message ID 20240911131349.933814-4-ankit.k.nautiyal@intel.com (mailing list archive)
State New, archived
Headers show
Series Ultrajoiner basic functionality series | expand

Commit Message

Ankit Nautiyal Sept. 11, 2024, 1:13 p.m. UTC
Currently joiner is only supported for DP encoder.
Allow force joiner only for DP for supported platforms.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
 .../drm/i915/display/intel_display_debugfs.c  | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Comments

Ville Syrjala Sept. 11, 2024, 8 p.m. UTC | #1
On Wed, Sep 11, 2024 at 06:43:33PM +0530, Ankit Nautiyal wrote:
> Currently joiner is only supported for DP encoder.
> Allow force joiner only for DP for supported platforms.
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
>  .../drm/i915/display/intel_display_debugfs.c  | 20 ++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> index d7651f6f80e1..7ceaf01a884a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -1520,6 +1520,9 @@ static ssize_t i915_joiner_write(struct file *file,
>  	struct seq_file *m = file->private_data;
>  	struct intel_connector *connector = m->private;
>  	struct intel_display *display = to_intel_display(connector);
> +	struct intel_encoder *intel_encoder = intel_attached_encoder(connector);

That won't work for MST. You'll want to use intel_attached_dp().

> +	struct intel_dp *intel_dp;
> +	int connector_type = connector->base.connector_type;
>  	int force_join_pipes = 0;
>  	int ret;
>  
> @@ -1530,16 +1533,27 @@ static ssize_t i915_joiner_write(struct file *file,
>  	if (ret < 0)
>  		return ret;
>  
> +	/* Currently joiner is only supported for eDP/DP */
> +	if (connector_type != DRM_MODE_CONNECTOR_DisplayPort &&
> +	    connector_type != DRM_MODE_CONNECTOR_eDP)
> +		return 0;

We shouldn't be adding the debugfs file to a non-DP connector so this
seems redundant.

> +
> +	intel_dp = enc_to_intel_dp(intel_encoder);
> +
> +	connector->force_joined_pipes = 0;
> +
>  	switch (force_join_pipes) {
>  	case 0:
> -		fallthrough;
> +		break;
>  	case 2:
> -		connector->force_joined_pipes = force_join_pipes;
> +		if (intel_dp_has_joiner(intel_dp))
> +			connector->force_joined_pipes = force_join_pipes;
> +		else
> +			drm_dbg(display->drm, "Force joiner not supported for the config\n");

That should return an error. Hmm, or perhaps even better to not
even create the debugfs file in the first place?

>  		break;
>  	default:
>  		drm_dbg(display->drm, "Ignoring Invalid num of pipes %d for force joining\n",
>  			force_join_pipes);
> -		connector->force_joined_pipes = 0;
>  	}
>  
>  	*offp += len;
> -- 
> 2.45.2
Ville Syrjala Sept. 11, 2024, 8:11 p.m. UTC | #2
On Wed, Sep 11, 2024 at 06:43:33PM +0530, Ankit Nautiyal wrote:
> Currently joiner is only supported for DP encoder.
> Allow force joiner only for DP for supported platforms.
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
>  .../drm/i915/display/intel_display_debugfs.c  | 20 ++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> index d7651f6f80e1..7ceaf01a884a 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
> @@ -1520,6 +1520,9 @@ static ssize_t i915_joiner_write(struct file *file,
>  	struct seq_file *m = file->private_data;
>  	struct intel_connector *connector = m->private;
>  	struct intel_display *display = to_intel_display(connector);
> +	struct intel_encoder *intel_encoder = intel_attached_encoder(connector);
> +	struct intel_dp *intel_dp;
> +	int connector_type = connector->base.connector_type;
>  	int force_join_pipes = 0;
>  	int ret;
>  
> @@ -1530,16 +1533,27 @@ static ssize_t i915_joiner_write(struct file *file,
>  	if (ret < 0)
>  		return ret;
>  
> +	/* Currently joiner is only supported for eDP/DP */
> +	if (connector_type != DRM_MODE_CONNECTOR_DisplayPort &&
> +	    connector_type != DRM_MODE_CONNECTOR_eDP)
> +		return 0;
> +
> +	intel_dp = enc_to_intel_dp(intel_encoder);
> +
> +	connector->force_joined_pipes = 0;
> +
>  	switch (force_join_pipes) {
>  	case 0:
> -		fallthrough;
> +		break;

That 'break' looks wrong.

>  	case 2:
> -		connector->force_joined_pipes = force_join_pipes;
> +		if (intel_dp_has_joiner(intel_dp))
> +			connector->force_joined_pipes = force_join_pipes;
> +		else
> +			drm_dbg(display->drm, "Force joiner not supported for the config\n");
>  		break;
>  	default:
>  		drm_dbg(display->drm, "Ignoring Invalid num of pipes %d for force joining\n",
>  			force_join_pipes);
> -		connector->force_joined_pipes = 0;
>  	}
>  
>  	*offp += len;
> -- 
> 2.45.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index d7651f6f80e1..7ceaf01a884a 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -1520,6 +1520,9 @@  static ssize_t i915_joiner_write(struct file *file,
 	struct seq_file *m = file->private_data;
 	struct intel_connector *connector = m->private;
 	struct intel_display *display = to_intel_display(connector);
+	struct intel_encoder *intel_encoder = intel_attached_encoder(connector);
+	struct intel_dp *intel_dp;
+	int connector_type = connector->base.connector_type;
 	int force_join_pipes = 0;
 	int ret;
 
@@ -1530,16 +1533,27 @@  static ssize_t i915_joiner_write(struct file *file,
 	if (ret < 0)
 		return ret;
 
+	/* Currently joiner is only supported for eDP/DP */
+	if (connector_type != DRM_MODE_CONNECTOR_DisplayPort &&
+	    connector_type != DRM_MODE_CONNECTOR_eDP)
+		return 0;
+
+	intel_dp = enc_to_intel_dp(intel_encoder);
+
+	connector->force_joined_pipes = 0;
+
 	switch (force_join_pipes) {
 	case 0:
-		fallthrough;
+		break;
 	case 2:
-		connector->force_joined_pipes = force_join_pipes;
+		if (intel_dp_has_joiner(intel_dp))
+			connector->force_joined_pipes = force_join_pipes;
+		else
+			drm_dbg(display->drm, "Force joiner not supported for the config\n");
 		break;
 	default:
 		drm_dbg(display->drm, "Ignoring Invalid num of pipes %d for force joining\n",
 			force_join_pipes);
-		connector->force_joined_pipes = 0;
 	}
 
 	*offp += len;