Commit abf1aae8 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Clean up EDID downclock mode lookup

Rename intel_find_panel_downclock() to intel_panel_edid_downclock_mode()
to make it clear it's looking for the downclock mode in the EDID.
And while at it polish the implementation a bit as well.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190321132446.22394-6-ville.syrjala@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 9f6fbe22
...@@ -7033,9 +7033,7 @@ intel_dp_drrs_init(struct intel_connector *connector, ...@@ -7033,9 +7033,7 @@ intel_dp_drrs_init(struct intel_connector *connector,
return NULL; return NULL;
} }
downclock_mode = intel_find_panel_downclock(dev_priv, fixed_mode, downclock_mode = intel_panel_edid_downclock_mode(connector, fixed_mode);
&connector->base);
if (!downclock_mode) { if (!downclock_mode) {
DRM_DEBUG_KMS("Downclock mode is not found. DRRS not supported\n"); DRM_DEBUG_KMS("Downclock mode is not found. DRRS not supported\n");
return NULL; return NULL;
......
...@@ -2153,10 +2153,9 @@ void intel_panel_update_backlight(struct intel_encoder *encoder, ...@@ -2153,10 +2153,9 @@ void intel_panel_update_backlight(struct intel_encoder *encoder,
const struct intel_crtc_state *crtc_state, const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state); const struct drm_connector_state *conn_state);
void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_state); void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_state);
extern struct drm_display_mode *intel_find_panel_downclock( struct drm_display_mode *
struct drm_i915_private *dev_priv, intel_panel_edid_downclock_mode(struct intel_connector *connector,
struct drm_display_mode *fixed_mode, const struct drm_display_mode *fixed_mode);
struct drm_connector *connector);
struct drm_display_mode * struct drm_display_mode *
intel_panel_edid_fixed_mode(struct intel_connector *connector); intel_panel_edid_fixed_mode(struct intel_connector *connector);
struct drm_display_mode * struct drm_display_mode *
......
...@@ -56,24 +56,16 @@ static bool is_downclock_mode(const struct drm_display_mode *downclock_mode, ...@@ -56,24 +56,16 @@ static bool is_downclock_mode(const struct drm_display_mode *downclock_mode,
downclock_mode->clock < fixed_mode->clock; downclock_mode->clock < fixed_mode->clock;
} }
/**
* intel_find_panel_downclock - find the reduced downclock for LVDS in EDID
* @dev_priv: i915 device instance
* @fixed_mode : panel native mode
* @connector: LVDS/eDP connector
*
* Return downclock_avail
* Find the reduced downclock for LVDS/eDP in EDID.
*/
struct drm_display_mode * struct drm_display_mode *
intel_find_panel_downclock(struct drm_i915_private *dev_priv, intel_panel_edid_downclock_mode(struct intel_connector *connector,
struct drm_display_mode *fixed_mode, const struct drm_display_mode *fixed_mode)
struct drm_connector *connector)
{ {
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
const struct drm_display_mode *scan, *best_mode = NULL; const struct drm_display_mode *scan, *best_mode = NULL;
struct drm_display_mode *downclock_mode;
int best_clock = fixed_mode->clock; int best_clock = fixed_mode->clock;
list_for_each_entry(scan, &connector->probed_modes, head) { list_for_each_entry(scan, &connector->base.probed_modes, head) {
/* /*
* If one mode has the same resolution with the fixed_panel * If one mode has the same resolution with the fixed_panel
* mode while they have the different refresh rate, it means * mode while they have the different refresh rate, it means
...@@ -92,10 +84,18 @@ intel_find_panel_downclock(struct drm_i915_private *dev_priv, ...@@ -92,10 +84,18 @@ intel_find_panel_downclock(struct drm_i915_private *dev_priv,
} }
} }
if (best_mode) if (!best_mode)
return drm_mode_duplicate(&dev_priv->drm, best_mode); return NULL;
downclock_mode = drm_mode_duplicate(&dev_priv->drm, best_mode);
if (!downclock_mode)
return NULL;
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] using downclock mode from EDID: ",
connector->base.base.id, connector->base.name);
drm_mode_debug_printmodeline(downclock_mode);
return NULL; return downclock_mode;
} }
struct drm_display_mode * struct drm_display_mode *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment