Encapsulate C10's VS/PE-O's indices in enum snps_c10_vspeo_index.

Use index of -1 as an indication of error case. Refer to it as C10_ERR.

1st VS/PE-O's table is used for external DP with modes below HBR2
(exclusive). 1st table is also used as a fallback for non-DPs. Refer to
it as C10_DP14_RBR_HBR.

2nd table is used for external DP with modes higher than HBR2
(inclusive). Refer to it as C10_DP14_HBR2_HBR3.

3rd table is used for eDP with modes lower than HBR3 (exclusive). Refer
to it as C10_EDP_NON_HBR3.

4th table is used for eDP with modes higher than HBR3 (inclusive). Refer
to it as C10_EDP_HBR3.

Indices for other tables have not yet been observed to be used as of
now.

Signed-off-by: Michał Grzelak <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c | 12 ++++++------
 drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h |  9 +++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c 
b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
index a9f1242e2bcf0..80ca9ca6b6471 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c
@@ -1786,28 +1786,28 @@ xe3plpd_get_lt_buf_trans(struct intel_encoder *encoder,
                return intel_get_buf_trans(&xe3plpd_lt_trans_dp14, n_entries);
 }
 
-static int
+static enum snps_c10_vspeo_index
 snps_c10_compute_index(const struct intel_crtc_state *crtc_state)
 {
        if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP)) {
                if (crtc_state->port_clock > 540000)
-                       return 3;
+                       return C10_EDP_HBR3;
                else
-                       return 2;
+                       return C10_EDP_NON_HBR3;
        }
 
        if (intel_crtc_has_dp_encoder(crtc_state)) {
                if (crtc_state->port_clock > 270000)
-                       return 1;
+                       return C10_DP14_HBR2_HBR3;
                else
-                       return 0;
+                       return C10_DP14_RBR_HBR;
        }
 
        drm_WARN(to_intel_display(crtc_state)->drm, 1,
                 "non-DP (%d) encoder asks to compute VS/PE-O index\n",
                 crtc_state->output_types);
 
-       return -EINVAL;
+       return C10_ERR;
 }
 
 static enum snps_c20_vspeo_index
diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h 
b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h
index e182fbe9590c5..a8c998fa339e6 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h
@@ -98,6 +98,15 @@ enum snps_c20_vspeo_index {
        C20_DP20
 };
 
+enum snps_c10_vspeo_index {
+       C10_ERR = -1,
+
+       C10_DP14_RBR_HBR = 0,
+       C10_DP14_HBR2_HBR3,
+       C10_EDP_NON_HBR3,
+       C10_EDP_HBR3
+};
+
 bool is_hobl_buf_trans(const struct intel_ddi_buf_trans *table);
 
 void intel_ddi_buf_trans_init(struct intel_encoder *encoder);
-- 
2.45.2

Reply via email to