Commit 15a27de2 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Don't call PSR func if DMCU is off

Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 2801b0a8
...@@ -46,14 +46,6 @@ ...@@ -46,14 +46,6 @@
#include "dce/dce_11_0_enum.h" #include "dce/dce_11_0_enum.h"
#include "dce/dce_11_0_sh_mask.h" #include "dce/dce_11_0_sh_mask.h"
#ifndef mmDMCU_STATUS__UC_IN_RESET__SHIFT
#define mmDMCU_STATUS__UC_IN_RESET__SHIFT 0x0
#endif
#ifndef mmDMCU_STATUS__UC_IN_RESET_MASK
#define mmDMCU_STATUS__UC_IN_RESET_MASK 0x00000001L
#endif
#define LINK_INFO(...) \ #define LINK_INFO(...) \
dm_logger_write(dc_ctx->logger, LOG_HW_HOTPLUG, \ dm_logger_write(dc_ctx->logger, LOG_HW_HOTPLUG, \
__VA_ARGS__) __VA_ARGS__)
......
...@@ -366,6 +366,16 @@ static bool dce_abm_init_backlight(struct abm *abm) ...@@ -366,6 +366,16 @@ static bool dce_abm_init_backlight(struct abm *abm)
return true; return true;
} }
static bool is_dmcu_initialized(struct abm *abm)
{
struct dce_abm *abm_dce = TO_DCE_ABM(abm);
unsigned int dmcu_uc_reset;
REG_GET(DMCU_STATUS, UC_IN_RESET, &dmcu_uc_reset);
return !dmcu_uc_reset;
}
static bool dce_abm_set_backlight_level( static bool dce_abm_set_backlight_level(
struct abm *abm, struct abm *abm,
unsigned int backlight_level, unsigned int backlight_level,
...@@ -373,23 +383,19 @@ static bool dce_abm_set_backlight_level( ...@@ -373,23 +383,19 @@ static bool dce_abm_set_backlight_level(
unsigned int controller_id) unsigned int controller_id)
{ {
struct dce_abm *abm_dce = TO_DCE_ABM(abm); struct dce_abm *abm_dce = TO_DCE_ABM(abm);
unsigned int dmcu_uc_reset;
dm_logger_write(abm->ctx->logger, LOG_BACKLIGHT, dm_logger_write(abm->ctx->logger, LOG_BACKLIGHT,
"New Backlight level: %d (0x%X)\n", "New Backlight level: %d (0x%X)\n",
backlight_level, backlight_level); backlight_level, backlight_level);
REG_GET(DMCU_STATUS, UC_IN_RESET, &dmcu_uc_reset);
/* If DMCU is in reset state, DMCU is uninitialized */ /* If DMCU is in reset state, DMCU is uninitialized */
if (dmcu_uc_reset) { if (is_dmcu_initialized(abm))
driver_set_backlight_level(abm_dce, backlight_level);
} else {
dmcu_set_backlight_level(abm_dce, dmcu_set_backlight_level(abm_dce,
backlight_level, backlight_level,
frame_ramp, frame_ramp,
controller_id); controller_id);
} else
driver_set_backlight_level(abm_dce, backlight_level);
return true; return true;
} }
...@@ -398,7 +404,8 @@ static const struct abm_funcs dce_funcs = { ...@@ -398,7 +404,8 @@ static const struct abm_funcs dce_funcs = {
.abm_init = dce_abm_init, .abm_init = dce_abm_init,
.set_abm_level = dce_abm_set_level, .set_abm_level = dce_abm_set_level,
.init_backlight = dce_abm_init_backlight, .init_backlight = dce_abm_init_backlight,
.set_backlight_level = dce_abm_set_backlight_level .set_backlight_level = dce_abm_set_backlight_level,
.is_dmcu_initialized = is_dmcu_initialized
}; };
static void dce_abm_construct( static void dce_abm_construct(
......
...@@ -29,11 +29,15 @@ ...@@ -29,11 +29,15 @@
#include "fixed32_32.h" #include "fixed32_32.h"
#include "bios_parser_interface.h" #include "bios_parser_interface.h"
#include "dc.h" #include "dc.h"
#include "core_dc.h"
#include "dce_abm.h"
#if defined(CONFIG_DRM_AMD_DC_DCN1_0) #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
#include "dcn_calcs.h" #include "dcn_calcs.h"
#include "core_dc.h" #include "core_dc.h"
#endif #endif
#define TO_DCE_CLOCKS(clocks)\ #define TO_DCE_CLOCKS(clocks)\
container_of(clocks, struct dce_disp_clk, base) container_of(clocks, struct dce_disp_clk, base)
...@@ -374,6 +378,8 @@ static void dce112_set_clock( ...@@ -374,6 +378,8 @@ static void dce112_set_clock(
struct dce_disp_clk *clk_dce = TO_DCE_CLOCKS(clk); struct dce_disp_clk *clk_dce = TO_DCE_CLOCKS(clk);
struct bp_set_dce_clock_parameters dce_clk_params; struct bp_set_dce_clock_parameters dce_clk_params;
struct dc_bios *bp = clk->ctx->dc_bios; struct dc_bios *bp = clk->ctx->dc_bios;
struct core_dc *core_dc = DC_TO_CORE(clk->ctx->dc);
struct abm *abm = core_dc->res_pool->abm;
/* Prepare to program display clock*/ /* Prepare to program display clock*/
memset(&dce_clk_params, 0, sizeof(dce_clk_params)); memset(&dce_clk_params, 0, sizeof(dce_clk_params));
...@@ -404,9 +410,8 @@ static void dce112_set_clock( ...@@ -404,9 +410,8 @@ static void dce112_set_clock(
bp->funcs->set_dce_clock(bp, &dce_clk_params); bp->funcs->set_dce_clock(bp, &dce_clk_params);
#if defined(CONFIG_DRM_AMD_DC_DCN1_0) if (abm->funcs->is_dmcu_initialized(abm))
dce_psr_wait_loop(clk_dce, requested_clk_khz); dce_psr_wait_loop(clk_dce, requested_clk_khz);
#endif
} }
......
...@@ -40,6 +40,7 @@ struct abm_funcs { ...@@ -40,6 +40,7 @@ struct abm_funcs {
unsigned int backlight_level, unsigned int backlight_level,
unsigned int frame_ramp, unsigned int frame_ramp,
unsigned int controller_id); unsigned int controller_id);
bool (*is_dmcu_initialized)(struct abm *abm);
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment