From: Wyatt Wood <[email protected]>

Decouple dmcub config copy from dmcu iram copy.

Signed-off-by: Wyatt Wood <[email protected]>
Reviewed-by: Anthony Koo <[email protected]>
Acked-by: Rodrigo Siqueira <[email protected]>
---
 .../amd/display/modules/power/power_helpers.c | 30 ++++++++++++-------
 .../amd/display/modules/power/power_helpers.h |  3 ++
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c 
b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
index c1a95da6706f..dd1517684c90 100644
--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
+++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.c
@@ -651,14 +651,31 @@ void fill_iram_v_2_3(struct iram_table_v_2_2 *ram_table, 
struct dmcu_iram_parame
                        params, ram_table);
 }
 
+bool dmub_init_abm_config(struct abm *abm,
+       struct dmcu_iram_parameters params)
+{
+       unsigned char ram_table[IRAM_SIZE];
+       bool result = false;
+
+       if (abm == NULL)
+               return false;
+
+       memset(&ram_table, 0, sizeof(ram_table));
+
+       fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params);
+       result = abm->funcs->init_abm_config(
+               abm, (char *)(&ram_table), IRAM_RESERVE_AREA_START_V2_2);
+
+       return result;
+}
+
 bool dmcu_load_iram(struct dmcu *dmcu,
        struct dmcu_iram_parameters params)
 {
        unsigned char ram_table[IRAM_SIZE];
        bool result = false;
-       struct abm *abm = dmcu->ctx->dc->res_pool->abm;
 
-       if (dmcu == NULL && abm == NULL)
+       if (dmcu == NULL)
                return false;
 
        if (dmcu && !dmcu->funcs->is_dmcu_initialized(dmcu))
@@ -666,14 +683,7 @@ bool dmcu_load_iram(struct dmcu *dmcu,
 
        memset(&ram_table, 0, sizeof(ram_table));
 
-       // In the case where abm is implemented on dmcub,
-       // dmcu object will be null.
-       // ABM 2.4 and up are implemented on dmcub
-       if (dmcu == NULL) {
-               fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params);
-               result = abm->funcs->init_abm_config(
-                       abm, (char *)(&ram_table), 
IRAM_RESERVE_AREA_START_V2_2);
-       } else if (dmcu->dmcu_version.abm_version == 0x24) {
+       if (dmcu->dmcu_version.abm_version == 0x24) {
                fill_iram_v_2_3((struct iram_table_v_2_2 *)ram_table, params);
                        result = dmcu->funcs->load_iram(
                                        dmcu, 0, (char *)(&ram_table), 
IRAM_RESERVE_AREA_START_V2_2);
diff --git a/drivers/gpu/drm/amd/display/modules/power/power_helpers.h 
b/drivers/gpu/drm/amd/display/modules/power/power_helpers.h
index e54157026330..46fbca2e2cd1 100644
--- a/drivers/gpu/drm/amd/display/modules/power/power_helpers.h
+++ b/drivers/gpu/drm/amd/display/modules/power/power_helpers.h
@@ -26,6 +26,7 @@
 #define MODULES_POWER_POWER_HELPERS_H_
 
 #include "dc/inc/hw/dmcu.h"
+#include "dc/inc/hw/abm.h"
 
 
 enum abm_defines {
@@ -44,5 +45,7 @@ struct dmcu_iram_parameters {
 
 bool dmcu_load_iram(struct dmcu *dmcu,
                struct dmcu_iram_parameters params);
+bool dmub_init_abm_config(struct abm *abm,
+               struct dmcu_iram_parameters params);
 
 #endif /* MODULES_POWER_POWER_HELPERS_H_ */
-- 
2.26.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to