From: Dmytro Laktyushkin <[email protected]>

[Why & HOw]
Expose some functions for later dcns to reuse

Reviewed-by: Charlene Liu <[email protected]>
Reviewed-by: Nicholas Kazlauskas <[email protected]>
Signed-off-by: Dmytro Laktyushkin <[email protected]>
Signed-off-by: Ray Wu <[email protected]>
---
 .../drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c  | 15 +++++----------
 .../amd/display/dc/hubbub/dcn401/dcn401_hubbub.c  | 10 +++++-----
 .../amd/display/dc/hubbub/dcn401/dcn401_hubbub.h  | 10 ++++++++++
 .../drm/amd/display/dc/optc/dcn35/dcn35_optc.c    |  6 +++---
 .../drm/amd/display/dc/optc/dcn35/dcn35_optc.h    |  9 +++++++++
 5 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c 
b/drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c
index 663a18ee5162..3063b6ab32e5 100644
--- a/drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c
+++ b/drivers/gpu/drm/amd/display/dc/dccg/dcn401/dcn401_dccg.c
@@ -595,16 +595,6 @@ void dccg401_set_dp_dto(
 
        bool enable = false;
 
-       if (params->otg_inst > 3) {
-               /* dcn401 only has 4 instances */
-               BREAK_TO_DEBUGGER();
-               return;
-       }
-       if (!params->refclk_hz) {
-               BREAK_TO_DEBUGGER();
-               return;
-       }
-
        if (!dc_is_tmds_signal(params->signal)) {
                uint64_t dto_integer;
                uint64_t dto_phase_hz;
@@ -612,6 +602,11 @@ void dccg401_set_dp_dto(
 
                enable = true;
 
+               if (!params->refclk_hz) {
+                       BREAK_TO_DEBUGGER();
+                       return;
+               }
+
                /* Set DTO values:
                 * int = target_pix_rate / reference_clock
                 * phase = target_pix_rate - int * reference_clock,
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c 
b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
index d11afd1ce72a..941dce439e97 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.c
@@ -41,7 +41,7 @@
 #define FN(reg_name, field_name) \
        hubbub2->shifts->field_name, hubbub2->masks->field_name
 
-static void dcn401_init_crb(struct hubbub *hubbub)
+void dcn401_init_crb(struct hubbub *hubbub)
 {
        struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
 
@@ -1110,7 +1110,7 @@ bool hubbub401_get_dcc_compression_cap(struct hubbub 
*hubbub,
        return true;
 }
 
-static void dcn401_program_det_segments(struct hubbub *hubbub, int hubp_inst, 
unsigned det_buffer_size_seg)
+void dcn401_program_det_segments(struct hubbub *hubbub, int hubp_inst, 
unsigned det_buffer_size_seg)
 {
        struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
 
@@ -1147,7 +1147,7 @@ static void dcn401_program_det_segments(struct hubbub 
*hubbub, int hubp_inst, un
        }
 }
 
-static void dcn401_program_compbuf_segments(struct hubbub *hubbub, unsigned 
compbuf_size_seg, bool safe_to_increase)
+void dcn401_program_compbuf_segments(struct hubbub *hubbub, unsigned 
compbuf_size_seg, bool safe_to_increase)
 {
        struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
 
@@ -1170,7 +1170,7 @@ static void dcn401_program_compbuf_segments(struct hubbub 
*hubbub, unsigned comp
        }
 }
 
-static void dcn401_wait_for_det_update(struct hubbub *hubbub, int hubp_inst)
+void dcn401_wait_for_det_update(struct hubbub *hubbub, int hubp_inst)
 {
        struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
 
@@ -1192,7 +1192,7 @@ static void dcn401_wait_for_det_update(struct hubbub 
*hubbub, int hubp_inst)
        }
 }
 
-static bool dcn401_program_arbiter(struct hubbub *hubbub, struct 
dml2_display_arb_regs *arb_regs, bool safe_to_lower)
+bool dcn401_program_arbiter(struct hubbub *hubbub, struct 
dml2_display_arb_regs *arb_regs, bool safe_to_lower)
 {
        struct dcn20_hubbub *hubbub2 = TO_DCN20_HUBBUB(hubbub);
 
diff --git a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h 
b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h
index b1d9ea9d1c3d..f48715544429 100644
--- a/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h
+++ b/drivers/gpu/drm/amd/display/dc/hubbub/dcn401/dcn401_hubbub.h
@@ -194,6 +194,11 @@ bool hubbub401_get_dcc_compression_cap(
                const struct dc_dcc_surface_param *input,
                struct dc_surface_dcc_cap *output);
 
+bool dcn401_program_arbiter(
+       struct hubbub *hubbub,
+       struct dml2_display_arb_regs *arb_regs,
+       bool safe_to_lower);
+
 void hubbub401_construct(struct dcn20_hubbub *hubbub2,
        struct dc_context *ctx,
        const struct dcn_hubbub_registers *hubbub_regs,
@@ -203,4 +208,9 @@ void hubbub401_construct(struct dcn20_hubbub *hubbub2,
        int pixel_chunk_size_kb,
        int config_return_buffer_size_kb);
 
+void dcn401_program_det_segments(struct hubbub *hubbub, int hubp_inst, 
unsigned det_buffer_size_seg);
+void dcn401_program_compbuf_segments(struct hubbub *hubbub, unsigned 
compbuf_size_seg, bool safe_to_increase);
+void dcn401_wait_for_det_update(struct hubbub *hubbub, int hubp_inst);
+void dcn401_init_crb(struct hubbub *hubbub);
+
 #endif
diff --git a/drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c 
b/drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c
index 0953acbcc6d4..5aafd0eedf66 100644
--- a/drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c
+++ b/drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.c
@@ -270,7 +270,7 @@ static bool optc35_get_crc(struct timing_generator *optc, 
uint8_t idx,
        return true;
 }
 
-static bool optc35_configure_crc(struct timing_generator *optc,
+bool optc35_configure_crc(struct timing_generator *optc,
                                 const struct crc_params *params)
 {
        struct optc *optc1 = DCN10TG_FROM_TG(optc);
@@ -437,7 +437,7 @@ void optc35_set_drr(
        REG_WRITE(OTG_V_COUNT_STOP_CONTROL2, 0);
 }
 
-static void optc35_set_long_vtotal(
+void optc35_set_long_vtotal(
        struct timing_generator *optc,
        const struct long_vtotal_params *params)
 {
@@ -524,7 +524,7 @@ static void optc35_set_long_vtotal(
        }
 }
 
-static void optc35_wait_otg_disable(struct timing_generator *optc)
+void optc35_wait_otg_disable(struct timing_generator *optc)
 {
        struct optc *optc1;
        uint32_t is_master_en;
diff --git a/drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.h 
b/drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.h
index 5c2cb1f27783..82e0818c8f9f 100644
--- a/drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.h
+++ b/drivers/gpu/drm/amd/display/dc/optc/dcn35/dcn35_optc.h
@@ -90,4 +90,13 @@ void dcn35_timing_generator_set_fgcg(struct optc *optc1, 
bool enable);
 
 void optc35_set_drr(struct timing_generator *optc, const struct drr_params 
*params);
 
+void optc35_set_long_vtotal(
+       struct timing_generator *optc,
+       const struct long_vtotal_params *params);
+
+bool optc35_configure_crc(struct timing_generator *optc,
+                                const struct crc_params *params);
+
+void optc35_wait_otg_disable(struct timing_generator *optc);
+
 #endif /* __DC_OPTC_DCN35_H__ */
-- 
2.43.0

Reply via email to