[Intel-gfx] [PATCH 07/13] drm/i915/sdvo: Fail gracefully if the TV dotclock is out of range

Jani Nikula jani.nikula at linux.intel.com
Thu Jul 6 08:22:49 UTC 2023


On Wed, 05 Jul 2023, Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Instead of warning and continuing with bogus state when the
> requested dotclock isn't acceptable just print some debug
> spew and fail gracefully.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula at intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_sdvo.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> index 75a8e5583358..fcf3a95393d9 100644
> --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> @@ -1269,7 +1269,7 @@ intel_sdvo_get_preferred_input_mode(struct intel_sdvo *intel_sdvo,
>  	return true;
>  }
>  
> -static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
> +static int i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(pipe_config->uapi.crtc->dev);
>  	unsigned int dotclock = pipe_config->hw.adjusted_mode.crtc_clock;
> @@ -1292,11 +1292,14 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
>  		clock->m1 = 12;
>  		clock->m2 = 8;
>  	} else {
> -		drm_WARN(&dev_priv->drm, 1,
> -			 "SDVO TV clock out of range: %i\n", dotclock);
> +		drm_dbg_kms(&dev_priv->drm,
> +			    "SDVO TV clock out of range: %i\n", dotclock);
> +		return -EINVAL;
>  	}
>  
>  	pipe_config->clock_set = true;
> +
> +	return 0;
>  }
>  
>  static bool intel_has_hdmi_sink(struct intel_sdvo_connector *intel_sdvo_connector,
> @@ -1414,8 +1417,13 @@ static int intel_sdvo_compute_config(struct intel_encoder *encoder,
>  					       conn_state);
>  
>  	/* Clock computation needs to happen after pixel multiplier. */
> -	if (IS_TV(intel_sdvo_connector))
> -		i9xx_adjust_sdvo_tv_clock(pipe_config);
> +	if (IS_TV(intel_sdvo_connector)) {
> +		int ret;
> +
> +		ret = i9xx_adjust_sdvo_tv_clock(pipe_config);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	if (conn_state->picture_aspect_ratio)
>  		adjusted_mode->picture_aspect_ratio =

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list