Skip to content

Commit bfc7746

Browse files
committed
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: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 741922e + bbfaf2a commit bfc7746

File tree

9 files changed

+71
-53
lines changed

9 files changed

+71
-53
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,9 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
15281528
*/
15291529
void amdgpu_choose_low_power_state(struct amdgpu_device *adev)
15301530
{
1531+
if (adev->in_runpm)
1532+
return;
1533+
15311534
if (amdgpu_acpi_is_s0ix_active(adev))
15321535
adev->in_s0ix = true;
15331536
else if (amdgpu_acpi_is_s3_active(adev))

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,21 +1843,12 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
18431843
DRM_ERROR("amdgpu: fail to register dmub aux callback");
18441844
goto error;
18451845
}
1846-
if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD, dmub_hpd_callback, true)) {
1847-
DRM_ERROR("amdgpu: fail to register dmub hpd callback");
1848-
goto error;
1849-
}
1850-
if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD_IRQ, dmub_hpd_callback, true)) {
1851-
DRM_ERROR("amdgpu: fail to register dmub hpd callback");
1852-
goto error;
1853-
}
1854-
}
1855-
1856-
/* Enable outbox notification only after IRQ handlers are registered and DMUB is alive.
1857-
* It is expected that DMUB will resend any pending notifications at this point, for
1858-
* example HPD from DPIA.
1859-
*/
1860-
if (dc_is_dmub_outbox_supported(adev->dm.dc)) {
1846+
/* Enable outbox notification only after IRQ handlers are registered and DMUB is alive.
1847+
* It is expected that DMUB will resend any pending notifications at this point. Note
1848+
* that hpd and hpd_irq handler registration are deferred to register_hpd_handlers() to
1849+
* align legacy interface initialization sequence. Connection status will be proactivly
1850+
* detected once in the amdgpu_dm_initialize_drm_device.
1851+
*/
18611852
dc_enable_dmub_outbox(adev->dm.dc);
18621853

18631854
/* DPIA trace goes to dmesg logs only if outbox is enabled */
@@ -2287,6 +2278,7 @@ static int dm_sw_fini(void *handle)
22872278

22882279
if (adev->dm.dmub_srv) {
22892280
dmub_srv_destroy(adev->dm.dmub_srv);
2281+
kfree(adev->dm.dmub_srv);
22902282
adev->dm.dmub_srv = NULL;
22912283
}
22922284

@@ -3536,6 +3528,14 @@ static void register_hpd_handlers(struct amdgpu_device *adev)
35363528
int_params.requested_polarity = INTERRUPT_POLARITY_DEFAULT;
35373529
int_params.current_polarity = INTERRUPT_POLARITY_DEFAULT;
35383530

3531+
if (dc_is_dmub_outbox_supported(adev->dm.dc)) {
3532+
if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD, dmub_hpd_callback, true))
3533+
DRM_ERROR("amdgpu: fail to register dmub hpd callback");
3534+
3535+
if (!register_dmub_notify_callback(adev, DMUB_NOTIFICATION_HPD_IRQ, dmub_hpd_callback, true))
3536+
DRM_ERROR("amdgpu: fail to register dmub hpd callback");
3537+
}
3538+
35393539
list_for_each_entry(connector,
35403540
&dev->mode_config.connector_list, head) {
35413541

@@ -3564,10 +3564,6 @@ static void register_hpd_handlers(struct amdgpu_device *adev)
35643564
handle_hpd_rx_irq,
35653565
(void *) aconnector);
35663566
}
3567-
3568-
if (adev->dm.hpd_rx_offload_wq)
3569-
adev->dm.hpd_rx_offload_wq[connector->index].aconnector =
3570-
aconnector;
35713567
}
35723568
}
35733569

@@ -4561,6 +4557,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
45614557
goto fail;
45624558
}
45634559

4560+
if (dm->hpd_rx_offload_wq)
4561+
dm->hpd_rx_offload_wq[aconnector->base.index].aconnector =
4562+
aconnector;
4563+
45644564
if (!dc_link_detect_connection_type(link, &new_connection_type))
45654565
DRM_ERROR("KMS: Failed to detect connector\n");
45664566

@@ -6534,18 +6534,23 @@ amdgpu_dm_connector_late_register(struct drm_connector *connector)
65346534
static void amdgpu_dm_connector_funcs_force(struct drm_connector *connector)
65356535
{
65366536
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
6537-
struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
65386537
struct dc_link *dc_link = aconnector->dc_link;
65396538
struct dc_sink *dc_em_sink = aconnector->dc_em_sink;
65406539
struct edid *edid;
6540+
struct i2c_adapter *ddc;
6541+
6542+
if (dc_link->aux_mode)
6543+
ddc = &aconnector->dm_dp_aux.aux.ddc;
6544+
else
6545+
ddc = &aconnector->i2c->base;
65416546

65426547
/*
65436548
* Note: drm_get_edid gets edid in the following order:
65446549
* 1) override EDID if set via edid_override debugfs,
65456550
* 2) firmware EDID if set via edid_firmware module parameter
65466551
* 3) regular DDC read.
65476552
*/
6548-
edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
6553+
edid = drm_get_edid(connector, ddc);
65496554
if (!edid) {
65506555
DRM_ERROR("No EDID found on connector: %s.\n", connector->name);
65516556
return;
@@ -6586,20 +6591,26 @@ static int get_modes(struct drm_connector *connector)
65866591
static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
65876592
{
65886593
struct drm_connector *connector = &aconnector->base;
6589-
struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(&aconnector->base);
6594+
struct dc_link *dc_link = aconnector->dc_link;
65906595
struct dc_sink_init_data init_params = {
65916596
.link = aconnector->dc_link,
65926597
.sink_signal = SIGNAL_TYPE_VIRTUAL
65936598
};
65946599
struct edid *edid;
6600+
struct i2c_adapter *ddc;
6601+
6602+
if (dc_link->aux_mode)
6603+
ddc = &aconnector->dm_dp_aux.aux.ddc;
6604+
else
6605+
ddc = &aconnector->i2c->base;
65956606

65966607
/*
65976608
* Note: drm_get_edid gets edid in the following order:
65986609
* 1) override EDID if set via edid_override debugfs,
65996610
* 2) firmware EDID if set via edid_firmware module parameter
66006611
* 3) regular DDC read.
66016612
*/
6602-
edid = drm_get_edid(connector, &amdgpu_connector->ddc_bus->aux.ddc);
6613+
edid = drm_get_edid(connector, ddc);
66036614
if (!edid) {
66046615
DRM_ERROR("No EDID found on connector: %s.\n", connector->name);
66056616
return;

drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,15 @@ bool dc_dmub_srv_cmd_list_queue_execute(struct dc_dmub_srv *dc_dmub_srv,
125125
unsigned int count,
126126
union dmub_rb_cmd *cmd_list)
127127
{
128-
struct dc_context *dc_ctx = dc_dmub_srv->ctx;
128+
struct dc_context *dc_ctx;
129129
struct dmub_srv *dmub;
130130
enum dmub_status status;
131131
int i;
132132

133133
if (!dc_dmub_srv || !dc_dmub_srv->dmub)
134134
return false;
135135

136+
dc_ctx = dc_dmub_srv->ctx;
136137
dmub = dc_dmub_srv->dmub;
137138

138139
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
11611162

11621163
bool dc_dmub_srv_is_hw_pwr_up(struct dc_dmub_srv *dc_dmub_srv, bool wait)
11631164
{
1164-
struct dc_context *dc_ctx = dc_dmub_srv->ctx;
1165+
struct dc_context *dc_ctx;
11651166
enum dmub_status status;
11661167

11671168
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)
11701171
if (dc_dmub_srv->ctx->dc->debug.dmcub_emulation)
11711172
return true;
11721173

1174+
dc_ctx = dc_dmub_srv->ctx;
1175+
11731176
if (wait) {
11741177
if (dc_dmub_srv->ctx->dc->debug.disable_timeout) {
11751178
do {

drivers/gpu/drm/amd/display/dc/dce/dce_panel_cntl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,4 +290,5 @@ void dce_panel_cntl_construct(
290290
dce_panel_cntl->base.funcs = &dce_link_panel_cntl_funcs;
291291
dce_panel_cntl->base.ctx = init_data->ctx;
292292
dce_panel_cntl->base.inst = init_data->inst;
293+
dce_panel_cntl->base.pwrseq_inst = 0;
293294
}

drivers/gpu/drm/amd/display/dc/dcn301/dcn301_panel_cntl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,4 +215,5 @@ void dcn301_panel_cntl_construct(
215215
dcn301_panel_cntl->base.funcs = &dcn301_link_panel_cntl_funcs;
216216
dcn301_panel_cntl->base.ctx = init_data->ctx;
217217
dcn301_panel_cntl->base.inst = init_data->inst;
218+
dcn301_panel_cntl->base.pwrseq_inst = 0;
218219
}

drivers/gpu/drm/amd/display/dc/dcn31/dcn31_panel_cntl.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,24 @@ void dcn31_panel_cntl_construct(
154154
struct dcn31_panel_cntl *dcn31_panel_cntl,
155155
const struct panel_cntl_init_data *init_data)
156156
{
157+
uint8_t pwrseq_inst = 0xF;
158+
157159
dcn31_panel_cntl->base.funcs = &dcn31_link_panel_cntl_funcs;
158160
dcn31_panel_cntl->base.ctx = init_data->ctx;
159161
dcn31_panel_cntl->base.inst = init_data->inst;
160-
dcn31_panel_cntl->base.pwrseq_inst = init_data->pwrseq_inst;
162+
163+
switch (init_data->eng_id) {
164+
case ENGINE_ID_DIGA:
165+
pwrseq_inst = 0;
166+
break;
167+
case ENGINE_ID_DIGB:
168+
pwrseq_inst = 1;
169+
break;
170+
default:
171+
DC_LOG_WARNING("Unsupported pwrseq engine id: %d!\n", init_data->eng_id);
172+
ASSERT(false);
173+
break;
174+
}
175+
176+
dcn31_panel_cntl->base.pwrseq_inst = pwrseq_inst;
161177
}

drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc,
398398
/* Copy clocks tables entries, if available */
399399
if (dml2->config.bbox_overrides.clks_table.num_states) {
400400
p->in_states->num_states = dml2->config.bbox_overrides.clks_table.num_states;
401-
402401
for (i = 0; i < dml2->config.bbox_overrides.clks_table.num_entries_per_clk.num_dcfclk_levels; i++) {
403402
p->in_states->state_array[i].dcfclk_mhz = dml2->config.bbox_overrides.clks_table.clk_entries[i].dcfclk_mhz;
404403
}
@@ -437,6 +436,14 @@ void dml2_init_soc_states(struct dml2_context *dml2, const struct dc *in_dc,
437436
}
438437

439438
dml2_policy_build_synthetic_soc_states(s, p);
439+
if (dml2->v20.dml_core_ctx.project == dml_project_dcn35 ||
440+
dml2->v20.dml_core_ctx.project == dml_project_dcn351) {
441+
// Override last out_state with data from last in_state
442+
// This will ensure that out_state contains max fclk
443+
memcpy(&p->out_states->state_array[p->out_states->num_states - 1],
444+
&p->in_states->state_array[p->in_states->num_states - 1],
445+
sizeof(struct soc_state_bounding_box_st));
446+
}
440447
}
441448

442449
void dml2_translate_ip_params(const struct dc *in, struct ip_params_st *out)

drivers/gpu/drm/amd/display/dc/inc/hw/panel_cntl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct panel_cntl_funcs {
5757
struct panel_cntl_init_data {
5858
struct dc_context *ctx;
5959
uint32_t inst;
60-
uint32_t pwrseq_inst;
60+
uint32_t eng_id;
6161
};
6262

6363
struct panel_cntl {

drivers/gpu/drm/amd/display/dc/link/link_factory.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -370,30 +370,6 @@ static enum transmitter translate_encoder_to_transmitter(
370370
}
371371
}
372372

373-
static uint8_t translate_dig_inst_to_pwrseq_inst(struct dc_link *link)
374-
{
375-
uint8_t pwrseq_inst = 0xF;
376-
struct dc_context *dc_ctx = link->dc->ctx;
377-
378-
DC_LOGGER_INIT(dc_ctx->logger);
379-
380-
switch (link->eng_id) {
381-
case ENGINE_ID_DIGA:
382-
pwrseq_inst = 0;
383-
break;
384-
case ENGINE_ID_DIGB:
385-
pwrseq_inst = 1;
386-
break;
387-
default:
388-
DC_LOG_WARNING("Unsupported pwrseq engine id: %d!\n", link->eng_id);
389-
ASSERT(false);
390-
break;
391-
}
392-
393-
return pwrseq_inst;
394-
}
395-
396-
397373
static void link_destruct(struct dc_link *link)
398374
{
399375
int i;
@@ -657,7 +633,7 @@ static bool construct_phy(struct dc_link *link,
657633
link->link_id.id == CONNECTOR_ID_LVDS)) {
658634
panel_cntl_init_data.ctx = dc_ctx;
659635
panel_cntl_init_data.inst = panel_cntl_init_data.ctx->dc_edp_id_count;
660-
panel_cntl_init_data.pwrseq_inst = translate_dig_inst_to_pwrseq_inst(link);
636+
panel_cntl_init_data.eng_id = link->eng_id;
661637
link->panel_cntl =
662638
link->dc->res_pool->funcs->panel_cntl_create(
663639
&panel_cntl_init_data);

0 commit comments

Comments
 (0)