On Fri, 11 Mar 2022, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > There are a couple of cases where we essentially just want to > get/check the preferred fixed mode of the panel. Add a small > helper for that to abstract away the direct pointer lookup. > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_dp.c | 3 ++- > drivers/gpu/drm/i915/display/intel_panel.c | 6 ++++++ > drivers/gpu/drm/i915/display/intel_panel.h | 2 ++ > drivers/gpu/drm/i915/display/intel_sdvo.c | 2 +- > 4 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c > index 3c97cd5853cc..2709a8c08cee 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp.c > +++ b/drivers/gpu/drm/i915/display/intel_dp.c > @@ -582,8 +582,9 @@ static bool intel_dp_can_link_train_fallback_for_edp(struct intel_dp *intel_dp, > int link_rate, > u8 lane_count) > { > + /* FIXME figure out what we actually want here */ > const struct drm_display_mode *fixed_mode = > - intel_dp->attached_connector->panel.fixed_mode; > + intel_panel_preferred_fixed_mode(intel_dp->attached_connector); > int mode_rate, max_rate; > > mode_rate = intel_dp_link_required(fixed_mode->clock, 18); > diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c > index 222328d4e7a1..3ca37766ccb3 100644 > --- a/drivers/gpu/drm/i915/display/intel_panel.c > +++ b/drivers/gpu/drm/i915/display/intel_panel.c > @@ -45,6 +45,12 @@ bool intel_panel_use_ssc(struct drm_i915_private *i915) > && !(i915->quirks & QUIRK_LVDS_SSC_DISABLE); > } > > +const struct drm_display_mode * > +intel_panel_preferred_fixed_mode(struct intel_connector *connector) > +{ > + return connector->panel.fixed_mode; > +} > + > const struct drm_display_mode * > intel_panel_fixed_mode(struct intel_connector *connector, > const struct drm_display_mode *mode) > diff --git a/drivers/gpu/drm/i915/display/intel_panel.h b/drivers/gpu/drm/i915/display/intel_panel.h > index 051b86450156..88e6f5c217d8 100644 > --- a/drivers/gpu/drm/i915/display/intel_panel.h > +++ b/drivers/gpu/drm/i915/display/intel_panel.h > @@ -25,6 +25,8 @@ enum drm_connector_status > intel_panel_detect(struct drm_connector *connector, bool force); > bool intel_panel_use_ssc(struct drm_i915_private *i915); > const struct drm_display_mode * > +intel_panel_preferred_fixed_mode(struct intel_connector *connector); > +const struct drm_display_mode * > intel_panel_fixed_mode(struct intel_connector *connector, > const struct drm_display_mode *mode); > const struct drm_display_mode * > diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c > index 04487b03b640..6e0a4f48d84d 100644 > --- a/drivers/gpu/drm/i915/display/intel_sdvo.c > +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c > @@ -2932,7 +2932,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) > } > } > > - if (!intel_connector->panel.fixed_mode) > + if (!intel_panel_preferred_fixed_mode(intel_connector)) > goto err; > > return true; -- Jani Nikula, Intel Open Source Graphics Center