Commit a9a3c0da authored by Jun Lei's avatar Jun Lei Committed by Alex Deucher

drm/amd/display: add explicit handshake between x86 and DMCU

[why]
When DMCU interrupts x86, it leads to undefined phy programming

[how]
expand dmcu interface to support new PHY lock and unlock commands
if DMCU FW doesn't support these commands, they fail silently so its okay
Signed-off-by: default avatarJun Lei <Jun.Lei@amd.com>
Reviewed-by: default avatarAnthony Koo <Anthony.Koo@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent cc602e2b
...@@ -58,6 +58,8 @@ void dp_enable_link_phy( ...@@ -58,6 +58,8 @@ void dp_enable_link_phy(
const struct dc_link_settings *link_settings) const struct dc_link_settings *link_settings)
{ {
struct link_encoder *link_enc = link->link_enc; struct link_encoder *link_enc = link->link_enc;
struct dc *core_dc = link->ctx->dc;
struct dmcu *dmcu = core_dc->res_pool->dmcu;
struct pipe_ctx *pipes = struct pipe_ctx *pipes =
link->dc->current_state->res_ctx.pipe_ctx; link->dc->current_state->res_ctx.pipe_ctx;
...@@ -84,6 +86,9 @@ void dp_enable_link_phy( ...@@ -84,6 +86,9 @@ void dp_enable_link_phy(
} }
} }
if (dmcu != NULL && dmcu->funcs->lock_phy)
dmcu->funcs->lock_phy(dmcu);
if (dc_is_dp_sst_signal(signal)) { if (dc_is_dp_sst_signal(signal)) {
link_enc->funcs->enable_dp_output( link_enc->funcs->enable_dp_output(
link_enc, link_enc,
...@@ -95,6 +100,10 @@ void dp_enable_link_phy( ...@@ -95,6 +100,10 @@ void dp_enable_link_phy(
link_settings, link_settings,
clock_source); clock_source);
} }
if (dmcu != NULL && dmcu->funcs->unlock_phy)
dmcu->funcs->unlock_phy(dmcu);
link->cur_link_settings = *link_settings; link->cur_link_settings = *link_settings;
dp_receiver_power_ctrl(link, true); dp_receiver_power_ctrl(link, true);
...@@ -150,15 +159,25 @@ bool edp_receiver_ready_T7(struct dc_link *link) ...@@ -150,15 +159,25 @@ bool edp_receiver_ready_T7(struct dc_link *link)
void dp_disable_link_phy(struct dc_link *link, enum signal_type signal) void dp_disable_link_phy(struct dc_link *link, enum signal_type signal)
{ {
struct dc *core_dc = link->ctx->dc;
struct dmcu *dmcu = core_dc->res_pool->dmcu;
if (!link->wa_flags.dp_keep_receiver_powered) if (!link->wa_flags.dp_keep_receiver_powered)
dp_receiver_power_ctrl(link, false); dp_receiver_power_ctrl(link, false);
if (signal == SIGNAL_TYPE_EDP) { if (signal == SIGNAL_TYPE_EDP) {
link->link_enc->funcs->disable_output(link->link_enc, signal); link->link_enc->funcs->disable_output(link->link_enc, signal);
link->dc->hwss.edp_power_control(link, false); link->dc->hwss.edp_power_control(link, false);
} else } else {
if (dmcu != NULL && dmcu->funcs->lock_phy)
dmcu->funcs->lock_phy(dmcu);
link->link_enc->funcs->disable_output(link->link_enc, signal); link->link_enc->funcs->disable_output(link->link_enc, signal);
if (dmcu != NULL && dmcu->funcs->unlock_phy)
dmcu->funcs->unlock_phy(dmcu);
}
/* Clear current link setting.*/ /* Clear current link setting.*/
memset(&link->cur_link_settings, 0, memset(&link->cur_link_settings, 0,
sizeof(link->cur_link_settings)); sizeof(link->cur_link_settings));
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#define PSR_SET_WAITLOOP 0x31 #define PSR_SET_WAITLOOP 0x31
#define MCP_INIT_DMCU 0x88 #define MCP_INIT_DMCU 0x88
#define MCP_INIT_IRAM 0x89 #define MCP_INIT_IRAM 0x89
#define MCP_SYNC_PHY_LOCK 0x90
#define MCP_SYNC_PHY_UNLOCK 0x91
#define MCP_BL_SET_PWM_FRAC 0x6A /* Enable or disable Fractional PWM */ #define MCP_BL_SET_PWM_FRAC 0x6A /* Enable or disable Fractional PWM */
#define MASTER_COMM_CNTL_REG__MASTER_COMM_INTERRUPT_MASK 0x00000001L #define MASTER_COMM_CNTL_REG__MASTER_COMM_INTERRUPT_MASK 0x00000001L
...@@ -719,7 +721,7 @@ static bool dcn10_is_dmcu_initialized(struct dmcu *dmcu) ...@@ -719,7 +721,7 @@ static bool dcn10_is_dmcu_initialized(struct dmcu *dmcu)
return true; return true;
} }
#endif #endif //(CONFIG_DRM_AMD_DC_DCN1_0)
static const struct dmcu_funcs dce_funcs = { static const struct dmcu_funcs dce_funcs = {
.dmcu_init = dce_dmcu_init, .dmcu_init = dce_dmcu_init,
......
...@@ -70,6 +70,8 @@ struct dmcu_funcs { ...@@ -70,6 +70,8 @@ struct dmcu_funcs {
void (*get_psr_wait_loop)(struct dmcu *dmcu, void (*get_psr_wait_loop)(struct dmcu *dmcu,
unsigned int *psr_wait_loop_number); unsigned int *psr_wait_loop_number);
bool (*is_dmcu_initialized)(struct dmcu *dmcu); bool (*is_dmcu_initialized)(struct dmcu *dmcu);
bool (*lock_phy)(struct dmcu *dmcu);
bool (*unlock_phy)(struct dmcu *dmcu);
}; };
#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