Skip to content

Commit a0e4001

Browse files
Rodrigo Siqueiraalexdeucher
Rodrigo Siqueira
authored andcommitted
drm/amd/display: Stop if retimer is not available
Raven provides retimer feature support that requires i2c interaction in order to make it work well, all settings required for this configuration are loaded from the Atom bios which include the i2c address. If the retimer feature is not available, we should abort the attempt to set this feature, otherwise, it makes the following line return I2C_CHANNEL_OPERATION_NO_RESPONSE: i2c_success = i2c_write(pipe_ctx, slave_address, buffer, sizeof(buffer)); ... if (!i2c_success) ASSERT(i2c_success); This ends up causing problems with hotplugging HDMI displays on Raven, and causes retimer settings to warn like so: WARNING: CPU: 1 PID: 429 at drivers/gpu/drm/amd/amdgpu/../dal/dc/core/dc_link.c:1998 write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu] Modules linked in: edac_mce_amd ccp kvm irqbypass binfmt_misc crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi snd_hda_intel amdgpu(+) snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_seq_midi snd_seq_midi_event snd_rawmidi aesni_intel snd_seq amd_iommu_v2 gpu_sched aes_x86_64 crypto_simd cryptd glue_helper snd_seq_device ttm drm_kms_helper snd_timer eeepc_wmi wmi_bmof asus_wmi sparse_keymap drm mxm_wmi snd k10temp fb_sys_fops syscopyarea sysfillrect sysimgblt soundcore joydev input_leds mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables autofs4 igb i2c_algo_bit hid_generic usbhid i2c_piix4 dca ahci hid libahci video wmi gpio_amdpt gpio_generic CPU: 1 PID: 429 Comm: systemd-udevd Tainted: G W 5.2.0-rc1sept162019+ #1 Hardware name: System manufacturer System Product Name/ROG STRIX B450-F GAMING, BIOS 2605 08/06/2019 RIP: 0010:write_i2c_retimer_setting+0xc2/0x3c0 [amdgpu] Code: ff 0f b6 4d ce 44 0f b6 45 cf 44 0f b6 c8 45 89 cf 44 89 e2 48 c7 c6 f0 34 bc c0 bf 04 00 00 00 e8 63 b0 90 ff 45 84 ff 75 02 <0f> 0b 42 0f b6 04 73 8d 50 f6 80 fa 02 77 8c 3c 0a 0f 85 c8 00 00 RSP: 0018:ffffa99d02726fd0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffffa99d02727035 RCX: 0000000000000006 RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff976acc857440 RBP: ffffa99d02727018 R08: 0000000000000002 R09: 000000000002a600 R10: ffffe90610193680 R11: 00000000000005e3 R12: 000000000000005d R13: ffff976ac4b201b8 R14: 0000000000000001 R15: 0000000000000000 FS: 00007f14f99e1680(0000) GS:ffff976acc840000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fdf212843b8 CR3: 0000000408906000 CR4: 00000000003406e0 Call Trace: core_link_enable_stream+0x626/0x680 [amdgpu] dce110_apply_ctx_to_hw+0x414/0x4e0 [amdgpu] dc_commit_state+0x331/0x5e0 [amdgpu] ? drm_calc_timestamping_constants+0xf9/0x150 [drm] amdgpu_dm_atomic_commit_tail+0x395/0x1e00 [amdgpu] ? dm_plane_helper_prepare_fb+0x20c/0x280 [amdgpu] commit_tail+0x42/0x70 [drm_kms_helper] drm_atomic_helper_commit+0x10c/0x120 [drm_kms_helper] amdgpu_dm_atomic_commit+0x95/0xa0 [amdgpu] drm_atomic_commit+0x4a/0x50 [drm] restore_fbdev_mode_atomic+0x1c0/0x1e0 [drm_kms_helper] restore_fbdev_mode+0x4c/0x160 [drm_kms_helper] ? _cond_resched+0x19/0x40 drm_fb_helper_restore_fbdev_mode_unlocked+0x4e/0xa0 [drm_kms_helper] drm_fb_helper_set_par+0x2d/0x50 [drm_kms_helper] fbcon_init+0x471/0x630 visual_init+0xd5/0x130 do_bind_con_driver+0x20a/0x430 do_take_over_console+0x7d/0x1b0 do_fbcon_takeover+0x5c/0xb0 fbcon_event_notify+0x6cd/0x8a0 notifier_call_chain+0x4c/0x70 blocking_notifier_call_chain+0x43/0x60 fb_notifier_call_chain+0x1b/0x20 register_framebuffer+0x254/0x360 __drm_fb_helper_initial_config_and_unlock+0x2c5/0x510 [drm_kms_helper] drm_fb_helper_initial_config+0x35/0x40 [drm_kms_helper] amdgpu_fbdev_init+0xcd/0x100 [amdgpu] amdgpu_device_init+0x1156/0x1930 [amdgpu] amdgpu_driver_load_kms+0x8d/0x2e0 [amdgpu] drm_dev_register+0x12b/0x1c0 [drm] amdgpu_pci_probe+0xd3/0x160 [amdgpu] local_pci_probe+0x47/0xa0 pci_device_probe+0x142/0x1b0 really_probe+0xf5/0x3d0 driver_probe_device+0x11b/0x130 device_driver_attach+0x58/0x60 __driver_attach+0xa3/0x140 ? device_driver_attach+0x60/0x60 ? device_driver_attach+0x60/0x60 bus_for_each_dev+0x74/0xb0 ? kmem_cache_alloc_trace+0x1a3/0x1c0 driver_attach+0x1e/0x20 bus_add_driver+0x147/0x220 ? 0xffffffffc0cb9000 driver_register+0x60/0x100 ? 0xffffffffc0cb9000 __pci_register_driver+0x5a/0x60 amdgpu_init+0x74/0x83 [amdgpu] do_one_initcall+0x4a/0x1fa ? _cond_resched+0x19/0x40 ? kmem_cache_alloc_trace+0x3f/0x1c0 ? __vunmap+0x1cc/0x200 do_init_module+0x5f/0x227 load_module+0x2330/0x2b40 __do_sys_finit_module+0xfc/0x120 ? __do_sys_finit_module+0xfc/0x120 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x5a/0x130 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f14f9500839 Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48 RSP: 002b:00007fff9bc4f5a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000055afb5abce30 RCX: 00007f14f9500839 RDX: 0000000000000000 RSI: 000055afb5ace0f0 RDI: 0000000000000017 RBP: 000055afb5ace0f0 R08: 0000000000000000 R09: 000000000000000a R10: 0000000000000017 R11: 0000000000000246 R12: 0000000000000000 R13: 000055afb5aad800 R14: 0000000000020000 R15: 0000000000000000 ---[ end trace c286e96563966f08 ]--- This commit reworks the way that we handle i2c write for retimer in the way that we abort this configuration if the feature is not available in the device. For debug sake, we kept a simple log message in case the retimer is not available. Signed-off-by: Rodrigo Siqueira <[email protected]> Reviewed-by: Hersen Wu <[email protected]> Acked-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 1450d23 commit a0e4001

File tree

1 file changed

+29
-38
lines changed

1 file changed

+29
-38
lines changed

drivers/gpu/drm/amd/display/dc/core/dc_link.c

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,7 @@ static void write_i2c_retimer_setting(
17651765
slave_address, buffer[0], buffer[1], i2c_success?1:0);
17661766

17671767
if (!i2c_success)
1768-
/* Write failure */
1769-
ASSERT(i2c_success);
1768+
goto i2c_write_fail;
17701769

17711770
/* Based on DP159 specs, APPLY_RX_TX_CHANGE bit in 0x0A
17721771
* needs to be set to 1 on every 0xA-0xC write.
@@ -1784,8 +1783,7 @@ static void write_i2c_retimer_setting(
17841783
pipe_ctx->stream->link->ddc,
17851784
slave_address, &offset, 1, &value, 1);
17861785
if (!i2c_success)
1787-
/* Write failure */
1788-
ASSERT(i2c_success);
1786+
goto i2c_write_fail;
17891787
}
17901788

17911789
buffer[0] = offset;
@@ -1797,8 +1795,7 @@ static void write_i2c_retimer_setting(
17971795
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
17981796
slave_address, buffer[0], buffer[1], i2c_success?1:0);
17991797
if (!i2c_success)
1800-
/* Write failure */
1801-
ASSERT(i2c_success);
1798+
goto i2c_write_fail;
18021799
}
18031800
}
18041801
}
@@ -1818,8 +1815,7 @@ static void write_i2c_retimer_setting(
18181815
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18191816

18201817
if (!i2c_success)
1821-
/* Write failure */
1822-
ASSERT(i2c_success);
1818+
goto i2c_write_fail;
18231819

18241820
/* Based on DP159 specs, APPLY_RX_TX_CHANGE bit in 0x0A
18251821
* needs to be set to 1 on every 0xA-0xC write.
@@ -1837,8 +1833,7 @@ static void write_i2c_retimer_setting(
18371833
pipe_ctx->stream->link->ddc,
18381834
slave_address, &offset, 1, &value, 1);
18391835
if (!i2c_success)
1840-
/* Write failure */
1841-
ASSERT(i2c_success);
1836+
goto i2c_write_fail;
18421837
}
18431838

18441839
buffer[0] = offset;
@@ -1850,8 +1845,7 @@ static void write_i2c_retimer_setting(
18501845
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18511846
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18521847
if (!i2c_success)
1853-
/* Write failure */
1854-
ASSERT(i2c_success);
1848+
goto i2c_write_fail;
18551849
}
18561850
}
18571851
}
@@ -1869,8 +1863,7 @@ static void write_i2c_retimer_setting(
18691863
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18701864
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18711865
if (!i2c_success)
1872-
/* Write failure */
1873-
ASSERT(i2c_success);
1866+
goto i2c_write_fail;
18741867

18751868
/* Write offset 0x00 to 0x23 */
18761869
buffer[0] = 0x00;
@@ -1881,8 +1874,7 @@ static void write_i2c_retimer_setting(
18811874
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18821875
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18831876
if (!i2c_success)
1884-
/* Write failure */
1885-
ASSERT(i2c_success);
1877+
goto i2c_write_fail;
18861878

18871879
/* Write offset 0xff to 0x00 */
18881880
buffer[0] = 0xff;
@@ -1893,10 +1885,14 @@ static void write_i2c_retimer_setting(
18931885
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18941886
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18951887
if (!i2c_success)
1896-
/* Write failure */
1897-
ASSERT(i2c_success);
1888+
goto i2c_write_fail;
18981889

18991890
}
1891+
1892+
return;
1893+
1894+
i2c_write_fail:
1895+
DC_LOG_DEBUG("Set retimer failed");
19001896
}
19011897

19021898
static void write_i2c_default_retimer_setting(
@@ -1921,8 +1917,7 @@ static void write_i2c_default_retimer_setting(
19211917
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19221918
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19231919
if (!i2c_success)
1924-
/* Write failure */
1925-
ASSERT(i2c_success);
1920+
goto i2c_write_fail;
19261921

19271922
/* Write offset 0x0A to 0x17 */
19281923
buffer[0] = 0x0A;
@@ -1933,8 +1928,7 @@ static void write_i2c_default_retimer_setting(
19331928
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19341929
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19351930
if (!i2c_success)
1936-
/* Write failure */
1937-
ASSERT(i2c_success);
1931+
goto i2c_write_fail;
19381932

19391933
/* Write offset 0x0B to 0xDA or 0xD8 */
19401934
buffer[0] = 0x0B;
@@ -1945,8 +1939,7 @@ static void write_i2c_default_retimer_setting(
19451939
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19461940
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19471941
if (!i2c_success)
1948-
/* Write failure */
1949-
ASSERT(i2c_success);
1942+
goto i2c_write_fail;
19501943

19511944
/* Write offset 0x0A to 0x17 */
19521945
buffer[0] = 0x0A;
@@ -1957,8 +1950,7 @@ static void write_i2c_default_retimer_setting(
19571950
offset = 0x%x, reg_val= 0x%x, i2c_success = %d\n",
19581951
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19591952
if (!i2c_success)
1960-
/* Write failure */
1961-
ASSERT(i2c_success);
1953+
goto i2c_write_fail;
19621954

19631955
/* Write offset 0x0C to 0x1D or 0x91 */
19641956
buffer[0] = 0x0C;
@@ -1969,8 +1961,7 @@ static void write_i2c_default_retimer_setting(
19691961
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19701962
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19711963
if (!i2c_success)
1972-
/* Write failure */
1973-
ASSERT(i2c_success);
1964+
goto i2c_write_fail;
19741965

19751966
/* Write offset 0x0A to 0x17 */
19761967
buffer[0] = 0x0A;
@@ -1981,8 +1972,7 @@ static void write_i2c_default_retimer_setting(
19811972
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19821973
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19831974
if (!i2c_success)
1984-
/* Write failure */
1985-
ASSERT(i2c_success);
1975+
goto i2c_write_fail;
19861976

19871977

19881978
if (is_vga_mode) {
@@ -1997,8 +1987,7 @@ static void write_i2c_default_retimer_setting(
19971987
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19981988
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19991989
if (!i2c_success)
2000-
/* Write failure */
2001-
ASSERT(i2c_success);
1990+
goto i2c_write_fail;
20021991

20031992
/* Write offset 0x00 to 0x23 */
20041993
buffer[0] = 0x00;
@@ -2009,8 +1998,7 @@ static void write_i2c_default_retimer_setting(
20091998
offset = 0x%x, reg_val= 0x%x, i2c_success = %d\n",
20101999
slave_address, buffer[0], buffer[1], i2c_success?1:0);
20112000
if (!i2c_success)
2012-
/* Write failure */
2013-
ASSERT(i2c_success);
2001+
goto i2c_write_fail;
20142002

20152003
/* Write offset 0xff to 0x00 */
20162004
buffer[0] = 0xff;
@@ -2021,9 +2009,13 @@ static void write_i2c_default_retimer_setting(
20212009
offset = 0x%x, reg_val= 0x%x, i2c_success = %d end here\n",
20222010
slave_address, buffer[0], buffer[1], i2c_success?1:0);
20232011
if (!i2c_success)
2024-
/* Write failure */
2025-
ASSERT(i2c_success);
2012+
goto i2c_write_fail;
20262013
}
2014+
2015+
return;
2016+
2017+
i2c_write_fail:
2018+
DC_LOG_DEBUG("Set default retimer failed");
20272019
}
20282020

20292021
static void write_i2c_redriver_setting(
@@ -2052,8 +2044,7 @@ static void write_i2c_redriver_setting(
20522044
slave_address, buffer[3], buffer[4], buffer[5], buffer[6], i2c_success?1:0);
20532045

20542046
if (!i2c_success)
2055-
/* Write failure */
2056-
ASSERT(i2c_success);
2047+
DC_LOG_DEBUG("Set redriver failed");
20572048
}
20582049

20592050
static void disable_link(struct dc_link *link, enum signal_type signal)

0 commit comments

Comments
 (0)