]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/i915: Extract intel_panel_mode_valid()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 23 Sep 2021 20:01:04 +0000 (23:01 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 30 Sep 2021 08:18:32 +0000 (11:18 +0300)
Extract intel_panel_mode_valid() from the eDP code to a generic helper.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210923200109.4459-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_panel.c
drivers/gpu/drm/i915/display/intel_panel.h

index 378008873e039f4f2a3a097d883d4edbfd2c73f0..2b8b495fc2a9a56a7bc88c1c53c489004b164749 100644 (file)
@@ -845,11 +845,9 @@ intel_dp_mode_valid(struct drm_connector *connector,
                return MODE_H_ILLEGAL;
 
        if (intel_dp_is_edp(intel_dp) && fixed_mode) {
-               if (mode->hdisplay != fixed_mode->hdisplay)
-                       return MODE_PANEL;
-
-               if (mode->vdisplay != fixed_mode->vdisplay)
-                       return MODE_PANEL;
+               status = intel_panel_mode_valid(intel_connector, mode);
+               if (status != MODE_OK)
+                       return status;
 
                target_clock = fixed_mode->clock;
        }
index 4804b6b86798528ce8c8cd3376135f4918d8c376..8a364bb1ce416ba3c4c8c12cfe77407c3a89ce70 100644 (file)
@@ -482,6 +482,24 @@ intel_panel_detect(struct drm_connector *connector, bool force)
        return connector_status_connected;
 }
 
+enum drm_mode_status
+intel_panel_mode_valid(struct intel_connector *connector,
+                      const struct drm_display_mode *mode)
+{
+       const struct drm_display_mode *fixed_mode = connector->panel.fixed_mode;
+
+       if (!fixed_mode)
+               return MODE_OK;
+
+       if (mode->hdisplay != fixed_mode->hdisplay)
+               return MODE_PANEL;
+
+       if (mode->vdisplay != fixed_mode->vdisplay)
+               return MODE_PANEL;
+
+       return MODE_OK;
+}
+
 int intel_panel_init(struct intel_panel *panel,
                     struct drm_display_mode *fixed_mode,
                     struct drm_display_mode *downclock_mode)
index f6af1a98290c09729d432423b50c922472af1e1f..71bad6d546fa65c8a7ab571c7ab5cd2379238c10 100644 (file)
@@ -26,6 +26,9 @@ intel_panel_detect(struct drm_connector *connector, bool force);
 bool intel_panel_use_ssc(struct drm_i915_private *i915);
 void intel_panel_fixed_mode(const struct drm_display_mode *fixed_mode,
                            struct drm_display_mode *adjusted_mode);
+enum drm_mode_status
+intel_panel_mode_valid(struct intel_connector *connector,
+                      const struct drm_display_mode *mode);
 int intel_panel_fitting(struct intel_crtc_state *crtc_state,
                        const struct drm_connector_state *conn_state);
 struct drm_display_mode *