Commit bfc7746a authored by Dave Airlie's avatar Dave Airlie

Merge tag 'amd-drm-fixes-6.8-2024-02-22' of...

Merge tag 'amd-drm-fixes-6.8-2024-02-22' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes

amd-drm-fixes-6.8-2024-02-22:

amdgpu:
- Suspend/resume fixes
- Backlight error fix
- DCN 3.5 fixes
- Misc fixes
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240222195338.5809-1-alexander.deucher@amd.com
parents 741922e7 bbfaf2ae
...@@ -1528,6 +1528,9 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) ...@@ -1528,6 +1528,9 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
*/ */
void amdgpu_choose_low_power_state(struct amdgpu_device *adev) void amdgpu_choose_low_power_state(struct amdgpu_device *adev)
{ {
if (adev->in_runpm)
return;
if (amdgpu_acpi_is_s0ix_active(adev)) if (amdgpu_acpi_is_s0ix_active(adev))
adev->in_s0ix = true; adev->in_s0ix = true;
else if (amdgpu_acpi_is_s3_active(adev)) else if (amdgpu_acpi_is_s3_active(adev))
......
...@@ -1843,21 +1843,12 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) ...@@ -1843,21 +1843,12 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
DRM_ERROR("amdgpu: fail to register dmub aux callback"); DRM_ERROR("amdgpu: fail to register dmub aux callback");
goto error; goto error;
} }
if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD, dmub_hpd_callback, true)) { /* Enable outbox notification only after IRQ handlers are registered and DMUB is alive.
DRM_ERROR("amdgpu: fail to register dmub hpd callback"); * It is expected that DMUB will resend any pending notifications at this point. Note
goto error; * that hpd and hpd_irq handler registration are deferred to register_hpd_handlers() to
} * align legacy interface initialization sequence. Connection status will be proactivly
if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD_IRQ, dmub_hpd_callback, true)) { * detected once in the amdgpu_dm_initialize_drm_device.
DRM_ERROR("amdgpu: fail to register dmub hpd callback"); */
goto error;
}
}
/* Enable outbox notification only after IRQ handlers are registered and DMUB is alive.
* It is expected that DMUB will resend any pending notifications at this point, for
* example HPD from DPIA.
*/
if (dc_is_dmub_outbox_supported(adev->dm.dc)) {
dc_enable_dmub_outbox(adev->dm.dc); dc_enable_dmub_outbox(adev->dm.dc);
/* DPIA trace goes to dmesg logs only if outbox is enabled */ /* DPIA trace goes to dmesg logs only if outbox is enabled */
...@@ -2287,6 +2278,7 @@ static int dm_sw_fini(void *handle) ...@@ -2287,6 +2278,7 @@ static int dm_sw_fini(void *handle)
if (adev->dm.dmub_srv) { if (adev->dm.dmub_srv) {
dmub_srv_destroy(adev->dm.dmub_srv); dmub_srv_destroy(adev->dm.dmub_srv);
kfree(adev->dm.dmub_srv);
adev->dm.dmub_srv = NULL; adev->dm.dmub_srv = NULL;
} }
...@@ -3536,6 +3528,14 @@ static void register_hpd_handlers(struct amdgpu_device *adev) ...@@ -3536,6 +3528,14 @@ static void register_hpd_handlers(struct amdgpu_device *adev)
int_params.requested_polarity = INTERRUPT_POLARITY_DEFAULT; int_params.requested_polarity = INTERRUPT_POLARITY_DEFAULT;
int_params.current_polarity = INTERRUPT_POLARITY_DEFAULT; int_params.current_polarity = INTERRUPT_POLARITY_DEFAULT;
if (dc_is_dmub_outbox_supported(adev->dm.dc)) {
if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD, dmub_hpd_callback, true))
DRM_ERROR("amdgpu: fail to register dmub hpd callback");
if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD_IRQ, dmub_hpd_callback, true))
DRM_ERROR("amdgpu: fail to register dmub hpd callback");
}
list_for_each_entry(connector, list_for_each_entry(connector,
&dev->mode_config.connector_list, head) { &dev->mode_config.connector_list, head) {
...@@ -3564,10 +3564,6 @@ static void register_hpd_handlers(struct amdgpu_device *adev) ...@@ -3564,10 +3564,6 @@ static void register_hpd_handlers(struct amdgpu_device *adev)
handle_hpd_rx_irq, handle_hpd_rx_irq,
(void *) aconnector); (void *) aconnector);
} }
if (adev->dm.hpd_rx_offload_wq)
adev->dm.hpd_rx_offload_wq[connector->index].aconnector =
aconnector;
} }
} }
...@@ -4561,6 +4557,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) ...@@ -4561,6 +4557,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
goto fail; goto fail;
} }
if (dm->hpd_rx_offload_wq)
dm->hpd_rx_offload_wq[aconnector->base.index].aconnector =
aconnector;
if (!dc_link_detect_connection_type(link, &new_connection_type)) if (!dc_link_detect_connection_type(link, &new_connection_type))
DRM_ERROR("KMS: Failed to detect connector\n"); DRM_ERROR("KMS: Failed to detect connector\n");
...@@ -6534,10 +6534,15 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector) ...@@ -6534,10 +6534,15 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector) static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
{ {
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
struct dc_link *dc_link = aconnector->dc_link; struct dc_link *dc_link = aconnector->dc_link;
struct dc_sink *dc_em_sink = aconnector->dc_em_sink; struct dc_sink *dc_em_sink = aconnector->dc_em_sink;
struct edid *edid; struct edid *edid;
struct i2c_adapter *ddc;
if (dc_link->aux_mode)
ddc = &aconnector->dm_dp_aux.aux.ddc;
else
ddc = &aconnector->i2c->base;
/* /*
* Note: drm_get_edid gets edid in the following order: * Note: drm_get_edid gets edid in the following order:
...@@ -6545,7 +6550,7 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector) ...@@ -6545,7 +6550,7 @@ static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
* 2) firmware EDID if set via edid_firmware module parameter * 2) firmware EDID if set via edid_firmware module parameter
* 3) regular DDC read. * 3) regular DDC read.
*/ */
edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc); edid = drm_get_edid(connector, ddc);
if (!edid) { if (!edid) {
DRM_ERROR("No EDID found on connector: %s.\n", connector->name); DRM_ERROR("No EDID found on connector: %s.\n", connector->name);
return; return;
...@@ -6586,12 +6591,18 @@ static int get_modes(struct drm_connector *connector) ...@@ -6586,12 +6591,18 @@ static int get_modes(struct drm_connector *connector)
static void create_eml_sink(struct amdgpu_dm_connector *aconnector) static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
{ {
struct drm_connector *connector = &aconnector->base; struct drm_connector *connector = &aconnector->base;
struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(&aconnector->base); struct dc_link *dc_link = aconnector->dc_link;
struct dc_sink_init_data init_params = { struct dc_sink_init_data init_params = {
.link = aconnector->dc_link, .link = aconnector->dc_link,
.sink_signal = SIGNAL_TYPE_VIRTUAL .sink_signal = SIGNAL_TYPE_VIRTUAL
}; };
struct edid *edid; struct edid *edid;
struct i2c_adapter *ddc;
if (dc_link->aux_mode)
ddc = &aconnector->dm_dp_aux.aux.ddc;
else
ddc = &aconnector->i2c->base;
/* /*
* Note: drm_get_edid gets edid in the following order: * Note: drm_get_edid gets edid in the following order:
...@@ -6599,7 +6610,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) ...@@ -6599,7 +6610,7 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
* 2) firmware EDID if set via edid_firmware module parameter * 2) firmware EDID if set via edid_firmware module parameter
* 3) regular DDC read. * 3) regular DDC read.
*/ */
edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc); edid = drm_get_edid(connector, ddc);
if (!edid) { if (!edid) {
DRM_ERROR("No EDID found on connector: %s.\n", connector->name); DRM_ERROR("No EDID found on connector: %s.\n", connector->name);
return; return;
......
...@@ -125,7 +125,7 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv, ...@@ -125,7 +125,7 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv,
unsigned int count, unsigned int count,
union dmub_rb_cmd *cmd_list) union dmub_rb_cmd *cmd_list)
{ {
struct dc_context *dc_ctx = dc_dmub_srv->ctx; struct dc_context *dc_ctx;
struct dmub_srv *dmub; struct dmub_srv *dmub;
enum dmub_status status; enum dmub_status status;
int i; int i;
...@@ -133,6 +133,7 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv, ...@@ -133,6 +133,7 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv,
if (!dc_dmub_srv || !dc_dmub_srv->dmub) if (!dc_dmub_srv || !dc_dmub_srv->dmub)
return false; return false;
dc_ctx = dc_dmub_srv->ctx;
dmub = dc_dmub_srv->dmub; dmub = dc_dmub_srv->dmub;
for (i = 0 ; i < count; i++) { for (i = 0 ; i < count; i++) {
...@@ -1161,7 +1162,7 @@ void dc_dmub_srv_subvp_save_surf_addr(const struct dc_dmub_srv *dc_dmub_srv, con ...@@ -1161,7 +1162,7 @@ void dc_dmub_srv_subvp_save_surf_addr(const struct dc_dmub_srv *dc_dmub_srv, con
bool dc_dmub_srv_is_hw_pwr_up(struct dc_dmub_srv *dc_dmub_srv, bool wait) bool dc_dmub_srv_is_hw_pwr_up(struct dc_dmub_srv *dc_dmub_srv, bool wait)
{ {
struct dc_context *dc_ctx = dc_dmub_srv->ctx; struct dc_context *dc_ctx;
enum dmub_status status; enum dmub_status status;
if (!dc_dmub_srv || !dc_dmub_srv->dmub) if (!dc_dmub_srv || !dc_dmub_srv->dmub)
...@@ -1170,6 +1171,8 @@ bool dc_dmub_srv_is_hw_pwr_up(struct dc_dmub_srv *dc_dmub_srv, bool wait) ...@@ -1170,6 +1171,8 @@ bool dc_dmub_srv_is_hw_pwr_up(struct dc_dmub_srv *dc_dmub_srv, bool wait)
if (dc_dmub_srv->ctx->dc->debug.dmcub_emulation) if (dc_dmub_srv->ctx->dc->debug.dmcub_emulation)
return true; return true;
dc_ctx = dc_dmub_srv->ctx;
if (wait) { if (wait) {
if (dc_dmub_srv->ctx->dc->debug.disable_timeout) { if (dc_dmub_srv->ctx->dc->debug.disable_timeout) {
do { do {
......
...@@ -290,4 +290,5 @@ void dce_panel_cntl_construct( ...@@ -290,4 +290,5 @@ void dce_panel_cntl_construct(
dce_panel_cntl->base.funcs = &dce_link_panel_cntl_funcs; dce_panel_cntl->base.funcs = &dce_link_panel_cntl_funcs;
dce_panel_cntl->base.ctx = init_data->ctx; dce_panel_cntl->base.ctx = init_data->ctx;
dce_panel_cntl->base.inst = init_data->inst; dce_panel_cntl->base.inst = init_data->inst;
dce_panel_cntl->base.pwrseq_inst = 0;
} }
...@@ -215,4 +215,5 @@ void dcn301_panel_cntl_construct( ...@@ -215,4 +215,5 @@ void dcn301_panel_cntl_construct(
dcn301_panel_cntl->base.funcs = &dcn301_link_panel_cntl_funcs; dcn301_panel_cntl->base.funcs = &dcn301_link_panel_cntl_funcs;
dcn301_panel_cntl->base.ctx = init_data->ctx; dcn301_panel_cntl->base.ctx = init_data->ctx;
dcn301_panel_cntl->base.inst = init_data->inst; dcn301_panel_cntl->base.inst = init_data->inst;
dcn301_panel_cntl->base.pwrseq_inst = 0;
} }
...@@ -154,8 +154,24 @@ void dcn31_panel_cntl_construct( ...@@ -154,8 +154,24 @@ void dcn31_panel_cntl_construct(
struct dcn31_panel_cntl *dcn31_panel_cntl, struct dcn31_panel_cntl *dcn31_panel_cntl,
const struct panel_cntl_init_data *init_data) const struct panel_cntl_init_data *init_data)
{ {
uint8_t pwrseq_inst = 0xF;
dcn31_panel_cntl->base.funcs = &dcn31_link_panel_cntl_funcs; dcn31_panel_cntl->base.funcs = &dcn31_link_panel_cntl_funcs;
dcn31_panel_cntl->base.ctx = init_data->ctx; dcn31_panel_cntl->base.ctx = init_data->ctx;
dcn31_panel_cntl->base.inst = init_data->inst; dcn31_panel_cntl->base.inst = init_data->inst;
dcn31_panel_cntl->base.pwrseq_inst = init_data->pwrseq_inst;
switch (init_data->eng_id) {
case ENGINE_ID_DIGA:
pwrseq_inst = 0;
break;
case ENGINE_ID_DIGB:
pwrseq_inst = 1;
break;
default:
DC_LOG_WARNING("Unsupported pwrseq engine id: %d!\n", init_data->eng_id);
ASSERT(false);
break;
}
dcn31_panel_cntl->base.pwrseq_inst = pwrseq_inst;
} }
...@@ -398,7 +398,6 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc, ...@@ -398,7 +398,6 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc,
/* Copy clocks tables entries, if available */ /* Copy clocks tables entries, if available */
if (dml2->config.bbox_overrides.clks_table.num_states) { if (dml2->config.bbox_overrides.clks_table.num_states) {
p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states; p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states;
for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels; i++) { for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels; i++) {
p->in_states->state_array[i].dcfclk_mhz = dml2->config.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz; p->in_states->state_array[i].dcfclk_mhz = dml2->config.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz;
} }
...@@ -437,6 +436,14 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc, ...@@ -437,6 +436,14 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc,
} }
dml2_policy_build_synthetic_soc_states(s, p); dml2_policy_build_synthetic_soc_states(s, p);
if (dml2->v20.dml_core_ctx.project == dml_project_dcn35 ||
dml2->v20.dml_core_ctx.project == dml_project_dcn351) {
// Override last out_state with data from last in_state
// This will ensure that out_state contains max fclk
memcpy(&p->out_states->state_array[p->out_states->num_states - 1],
&p->in_states->state_array[p->in_states->num_states - 1],
sizeof(struct soc_state_bounding_box_st));
}
} }
void dml2_translate_ip_params(const struct dc *in, struct ip_params_st *out) void dml2_translate_ip_params(const struct dc *in, struct ip_params_st *out)
......
...@@ -57,7 +57,7 @@ struct panel_cntl_funcs { ...@@ -57,7 +57,7 @@ struct panel_cntl_funcs {
struct panel_cntl_init_data { struct panel_cntl_init_data {
struct dc_context *ctx; struct dc_context *ctx;
uint32_t inst; uint32_t inst;
uint32_t pwrseq_inst; uint32_t eng_id;
}; };
struct panel_cntl { struct panel_cntl {
......
...@@ -370,30 +370,6 @@ static enum transmitter translate_encoder_to_transmitter( ...@@ -370,30 +370,6 @@ static enum transmitter translate_encoder_to_transmitter(
} }
} }
static uint8_t translate_dig_inst_to_pwrseq_inst(struct dc_link *link)
{
uint8_t pwrseq_inst = 0xF;
struct dc_context *dc_ctx = link->dc->ctx;
DC_LOGGER_INIT(dc_ctx->logger);
switch (link->eng_id) {
case ENGINE_ID_DIGA:
pwrseq_inst = 0;
break;
case ENGINE_ID_DIGB:
pwrseq_inst = 1;
break;
default:
DC_LOG_WARNING("Unsupported pwrseq engine id: %d!\n", link->eng_id);
ASSERT(false);
break;
}
return pwrseq_inst;
}
static void link_destruct(struct dc_link *link) static void link_destruct(struct dc_link *link)
{ {
int i; int i;
...@@ -657,7 +633,7 @@ static bool construct_phy(struct dc_link *link, ...@@ -657,7 +633,7 @@ static bool construct_phy(struct dc_link *link,
link->link_id.id == CONNECTOR_ID_LVDS)) { link->link_id.id == CONNECTOR_ID_LVDS)) {
panel_cntl_init_data.ctx = dc_ctx; panel_cntl_init_data.ctx = dc_ctx;
panel_cntl_init_data.inst = panel_cntl_init_data.ctx->dc_edp_id_count; panel_cntl_init_data.inst = panel_cntl_init_data.ctx->dc_edp_id_count;
panel_cntl_init_data.pwrseq_inst = translate_dig_inst_to_pwrseq_inst(link); panel_cntl_init_data.eng_id = link->eng_id;
link->panel_cntl = link->panel_cntl =
link->dc->res_pool->funcs->panel_cntl_create( link->dc->res_pool->funcs->panel_cntl_create(
&panel_cntl_init_data); &panel_cntl_init_data);
......
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