drm/i915: Nuke intel_ddi_hdmi_num_entries()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 1 Oct 2021 13:01:04 +0000 (16:01 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 4 Oct 2021 10:01:45 +0000 (13:01 +0300)
Since intel_ddi_level() now looks at the buf_trans table there's
no point in having intel_ddi_hdmi_num_entries() around. Just
roll the necessary bits of locic into
intel_ddi_hdmi_level()/intel_ddi_level().

Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211001130107.1746-8-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h

index 2b19269..4e9a6f3 100644 (file)
@@ -74,20 +74,13 @@ static const u8 index_to_dp_signal_levels[] = {
 };
 
 static int intel_ddi_hdmi_level(struct intel_encoder *encoder,
-                               const struct intel_crtc_state *crtc_state)
+                               const struct intel_ddi_buf_trans *trans)
 {
-       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-       int n_entries, level, default_entry;
+       int level;
 
-       n_entries = intel_ddi_hdmi_num_entries(encoder, crtc_state, &default_entry);
-       if (n_entries == 0)
-               return 0;
        level = intel_bios_hdmi_level_shift(encoder);
        if (level < 0)
-               level = default_entry;
-
-       if (drm_WARN_ON_ONCE(&dev_priv->drm, level >= n_entries))
-               level = n_entries - 1;
+               level = trans->hdmi_default_entry;
 
        return level;
 }
@@ -142,7 +135,7 @@ static void hsw_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder,
                                         const struct intel_crtc_state *crtc_state)
 {
        struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-       int level = intel_ddi_hdmi_level(encoder, crtc_state);
+       int level = intel_ddi_level(encoder, crtc_state);
        u32 iboost_bit = 0;
        int n_entries;
        enum port port = encoder->port;
@@ -1366,7 +1359,7 @@ int intel_ddi_level(struct intel_encoder *encoder,
                return 0;
 
        if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
-               level = intel_ddi_hdmi_level(encoder, crtc_state);
+               level = intel_ddi_hdmi_level(encoder, trans);
        else
                level = intel_ddi_dp_level(enc_to_intel_dp(encoder));
 
index 449daba..a2d3913 100644 (file)
@@ -1617,26 +1617,6 @@ dg2_get_snps_buf_trans(struct intel_encoder *encoder,
                return intel_get_buf_trans(&dg2_snps_trans, n_entries);
 }
 
-int intel_ddi_hdmi_num_entries(struct intel_encoder *encoder,
-                              const struct intel_crtc_state *crtc_state,
-                              int *default_entry)
-{
-       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-       const struct intel_ddi_buf_trans *trans;
-       int n_entries;
-
-       trans = encoder->get_buf_trans(encoder, crtc_state, &n_entries);
-
-       if (drm_WARN_ON(&dev_priv->drm, !trans)) {
-               *default_entry = 0;
-               return 0;
-       }
-
-       *default_entry = trans->hdmi_default_entry;
-
-       return n_entries;
-}
-
 void intel_ddi_buf_trans_init(struct intel_encoder *encoder)
 {
        struct drm_i915_private *i915 = to_i915(encoder->base.dev);
index 94d3382..6cdb8e9 100644 (file)
@@ -68,10 +68,6 @@ struct intel_ddi_buf_trans {
 
 bool is_hobl_buf_trans(const struct intel_ddi_buf_trans *table);
 
-int intel_ddi_hdmi_num_entries(struct intel_encoder *encoder,
-                              const struct intel_crtc_state *crtc_state,
-                              int *default_entry);
-
 void intel_ddi_buf_trans_init(struct intel_encoder *encoder);
 
 #endif