[Intel-gfx] [PATCH 6/9] drm/i915: Extract intel_panel_vbt_sdvo_fixed_mode()

Jani Nikula jani.nikula at linux.intel.com
Mon Mar 28 11:31:04 UTC 2022


On Wed, 23 Mar 2022, Ville Syrjala <ville.syrjala at linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> We have a function for duplicating the VBT LFP mode. Add the same
> for the VBT SDVO mode.
>
> 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_panel.c | 20 ++++++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_panel.h |  2 ++
>  drivers/gpu/drm/i915/display/intel_sdvo.c  | 14 ++++----------
>  3 files changed, 26 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
> index bd606d0b1c24..7f59db8b9ede 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.c
> +++ b/drivers/gpu/drm/i915/display/intel_panel.c
> @@ -272,6 +272,26 @@ intel_panel_vbt_lfp_fixed_mode(struct intel_connector *connector)
>  	return fixed_mode;
>  }
>  
> +struct drm_display_mode *
> +intel_panel_vbt_sdvo_fixed_mode(struct intel_connector *connector)
> +{
> +	struct drm_i915_private *i915 = to_i915(connector->base.dev);
> +	struct drm_display_mode *fixed_mode;
> +
> +	if (!i915->vbt.sdvo_lvds_vbt_mode)
> +		return NULL;
> +
> +	fixed_mode = drm_mode_duplicate(&i915->drm,
> +					i915->vbt.sdvo_lvds_vbt_mode);
> +	if (!fixed_mode)
> +		return NULL;
> +
> +	/* Guarantee the mode is preferred */
> +	fixed_mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
> +
> +	return fixed_mode;
> +}
> +
>  /* adjusted_mode has been preset to be the panel's fixed mode */
>  static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
>  			     const struct drm_connector_state *conn_state)
> diff --git a/drivers/gpu/drm/i915/display/intel_panel.h b/drivers/gpu/drm/i915/display/intel_panel.h
> index 9704ac81fe3e..7e32c903a1e6 100644
> --- a/drivers/gpu/drm/i915/display/intel_panel.h
> +++ b/drivers/gpu/drm/i915/display/intel_panel.h
> @@ -48,5 +48,7 @@ struct drm_display_mode *
>  intel_panel_edid_fixed_mode(struct intel_connector *connector);
>  struct drm_display_mode *
>  intel_panel_vbt_lfp_fixed_mode(struct intel_connector *connector);
> +struct drm_display_mode *
> +intel_panel_vbt_sdvo_fixed_mode(struct intel_connector *connector);
>  
>  #endif /* __INTEL_PANEL_H__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> index a2061b132107..27b3d3a79989 100644
> --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> @@ -2301,16 +2301,10 @@ static int intel_sdvo_get_lvds_modes(struct drm_connector *connector)
>  	 * Fetch modes from VBT. For SDVO prefer the VBT mode since some
>  	 * SDVO->LVDS transcoders can't cope with the EDID mode.
>  	 */
> -	if (dev_priv->vbt.sdvo_lvds_vbt_mode != NULL) {
> -		newmode = drm_mode_duplicate(connector->dev,
> -					     dev_priv->vbt.sdvo_lvds_vbt_mode);
> -		if (newmode != NULL) {
> -			/* Guarantee the mode is preferred */
> -			newmode->type = (DRM_MODE_TYPE_PREFERRED |
> -					 DRM_MODE_TYPE_DRIVER);
> -			drm_mode_probed_add(connector, newmode);
> -			num_modes++;
> -		}
> +	newmode = intel_panel_vbt_sdvo_fixed_mode(to_intel_connector(connector));
> +	if (newmode) {
> +		drm_mode_probed_add(connector, newmode);
> +		num_modes++;
>  	}
>  
>  	/*

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list