[PATCH 2/9] drm/i915/display: create a common function to check validity of ELD

Jani Nikula jani.nikula at intel.com
Tue Oct 8 12:26:17 UTC 2024


On Tue, 08 Oct 2024, Vinod Govindapillai <vinod.govindapillai at intel.com> wrote:
> We would need to check the validity of connector ELD from multiple
> places in the follow up patches. So create a separate function to
> check the validity for ELD.
>
> Signed-off-by: Vinod Govindapillai <vinod.govindapillai at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_audio.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
> index 1afd3b99e3ea..6946f3b0f8c9 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -690,13 +690,10 @@ void intel_audio_sdp_split_update(const struct intel_crtc_state *crtc_state)
>  			     crtc_state->sdp_split_enable ? AUD_ENABLE_SDP_SPLIT : 0);
>  }
>  
> -bool intel_audio_compute_config(struct intel_crtc_state *crtc_state,
> -				struct drm_connector_state *conn_state)
> +static bool intel_audio_eld_valid(struct drm_connector_state *conn_state)
>  {
>  	struct drm_connector *connector = conn_state->connector;
>  	struct drm_i915_private *i915 = to_i915(connector->dev);
> -	const struct drm_display_mode *adjusted_mode =
> -		&crtc_state->hw.adjusted_mode;
>  
>  	if (!connector->eld[0]) {
>  		drm_dbg_kms(&i915->drm,
> @@ -705,6 +702,19 @@ bool intel_audio_compute_config(struct intel_crtc_state *crtc_state,
>  		return false;
>  	}
>  
> +	return true;
> +}
> +
> +bool intel_audio_compute_config(struct intel_crtc_state *crtc_state,
> +				struct drm_connector_state *conn_state)
> +{
> +	struct drm_connector *connector = conn_state->connector;

We should stop adding new drm_connector local vars and use struct
intel_connector instead.

> +	const struct drm_display_mode *adjusted_mode =
> +		&crtc_state->hw.adjusted_mode;
> +
> +	if (!intel_audio_eld_valid(conn_state))
> +		return false;
> +
>  	BUILD_BUG_ON(sizeof(crtc_state->eld) != sizeof(connector->eld));
>  	memcpy(crtc_state->eld, connector->eld, sizeof(crtc_state->eld));

-- 
Jani Nikula, Intel


More information about the Intel-gfx mailing list