diff mbox series

[v2,3/4] drm/i915/display: combine DP audio compute config steps

Message ID 20230815142921.404127-4-vinod.govindapillai@intel.com (mailing list archive)
State New, archived
Headers show
Series SDP split for DP-MST | expand

Commit Message

Vinod Govindapillai Aug. 15, 2023, 2:29 p.m. UTC
Combine all DP audio configs into a single function

Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Jani Nikula Aug. 15, 2023, 5:32 p.m. UTC | #1
On Tue, 15 Aug 2023, Vinod Govindapillai <vinod.govindapillai@intel.com> wrote:
> Combine all DP audio configs into a single function

This should've been the first step.

>
> Signed-off-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 97a14afbcfe8..0eb072a78d44 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -2236,11 +2236,16 @@ intel_dp_compute_output_format(struct intel_encoder *encoder,
>  static void
>  intel_dp_audio_compute_config(struct intel_encoder *encoder,
>  			      struct intel_crtc_state *pipe_config,
> -			      struct drm_connector_state *conn_state)
> +			      struct drm_connector_state *conn_state,
> +			      struct intel_dp *intel_dp)

No need to pass intel_dp around. And usually if it's necessary, it's the
kind of context parameter that should be one of the first parameters.

>  {
>  	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
>  	struct drm_connector *connector = conn_state->connector;
>  
> +	pipe_config->has_audio =
> +		intel_dp_has_audio(encoder, conn_state, intel_dp) &&
> +		intel_audio_compute_config(encoder, pipe_config, conn_state);
> +
>  	pipe_config->sdp_split_enable = pipe_config->has_audio &&
>  					intel_dp_is_uhbr(pipe_config);
>  
> @@ -2264,10 +2269,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && encoder->port != PORT_A)
>  		pipe_config->has_pch_encoder = true;
>  
> -	pipe_config->has_audio =
> -		intel_dp_has_audio(encoder, conn_state, intel_dp) &&
> -		intel_audio_compute_config(encoder, pipe_config, conn_state);
> -
>  	fixed_mode = intel_panel_fixed_mode(connector, adjusted_mode);
>  	if (intel_dp_is_edp(intel_dp) && fixed_mode) {
>  		ret = intel_panel_compute_config(connector, adjusted_mode);
> @@ -2334,7 +2335,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
>  		adjusted_mode->crtc_clock /= n;
>  	}
>  
> -	intel_dp_audio_compute_config(encoder, pipe_config, conn_state);
> +	intel_dp_audio_compute_config(encoder, pipe_config, conn_state, intel_dp);
>  
>  	intel_link_compute_m_n(output_bpp,
>  			       pipe_config->lane_count,
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 97a14afbcfe8..0eb072a78d44 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2236,11 +2236,16 @@  intel_dp_compute_output_format(struct intel_encoder *encoder,
 static void
 intel_dp_audio_compute_config(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config,
-			      struct drm_connector_state *conn_state)
+			      struct drm_connector_state *conn_state,
+			      struct intel_dp *intel_dp)
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	struct drm_connector *connector = conn_state->connector;
 
+	pipe_config->has_audio =
+		intel_dp_has_audio(encoder, conn_state, intel_dp) &&
+		intel_audio_compute_config(encoder, pipe_config, conn_state);
+
 	pipe_config->sdp_split_enable = pipe_config->has_audio &&
 					intel_dp_is_uhbr(pipe_config);
 
@@ -2264,10 +2269,6 @@  intel_dp_compute_config(struct intel_encoder *encoder,
 	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && encoder->port != PORT_A)
 		pipe_config->has_pch_encoder = true;
 
-	pipe_config->has_audio =
-		intel_dp_has_audio(encoder, conn_state, intel_dp) &&
-		intel_audio_compute_config(encoder, pipe_config, conn_state);
-
 	fixed_mode = intel_panel_fixed_mode(connector, adjusted_mode);
 	if (intel_dp_is_edp(intel_dp) && fixed_mode) {
 		ret = intel_panel_compute_config(connector, adjusted_mode);
@@ -2334,7 +2335,7 @@  intel_dp_compute_config(struct intel_encoder *encoder,
 		adjusted_mode->crtc_clock /= n;
 	}
 
-	intel_dp_audio_compute_config(encoder, pipe_config, conn_state);
+	intel_dp_audio_compute_config(encoder, pipe_config, conn_state, intel_dp);
 
 	intel_link_compute_m_n(output_bpp,
 			       pipe_config->lane_count,