Skip to content

Commit 6fc325a

Browse files
Rodrigo Siqueiragregkh
Rodrigo Siqueira
authored andcommitted
drm/amd/display: Stop if retimer is not available
[ Upstream commit a0e4001 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 10a144b commit 6fc325a

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
@@ -1733,8 +1733,7 @@ static void write_i2c_retimer_setting(
17331733
slave_address, buffer[0], buffer[1], i2c_success?1:0);
17341734

17351735
if (!i2c_success)
1736-
/* Write failure */
1737-
ASSERT(i2c_success);
1736+
goto i2c_write_fail;
17381737

17391738
/* Based on DP159 specs, APPLY_RX_TX_CHANGE bit in 0x0A
17401739
* needs to be set to 1 on every 0xA-0xC write.
@@ -1752,8 +1751,7 @@ static void write_i2c_retimer_setting(
17521751
pipe_ctx->stream->link->ddc,
17531752
slave_address, &offset, 1, &value, 1);
17541753
if (!i2c_success)
1755-
/* Write failure */
1756-
ASSERT(i2c_success);
1754+
goto i2c_write_fail;
17571755
}
17581756

17591757
buffer[0] = offset;
@@ -1765,8 +1763,7 @@ static void write_i2c_retimer_setting(
17651763
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
17661764
slave_address, buffer[0], buffer[1], i2c_success?1:0);
17671765
if (!i2c_success)
1768-
/* Write failure */
1769-
ASSERT(i2c_success);
1766+
goto i2c_write_fail;
17701767
}
17711768
}
17721769
}
@@ -1786,8 +1783,7 @@ static void write_i2c_retimer_setting(
17861783
slave_address, buffer[0], buffer[1], i2c_success?1:0);
17871784

17881785
if (!i2c_success)
1789-
/* Write failure */
1790-
ASSERT(i2c_success);
1786+
goto i2c_write_fail;
17911787

17921788
/* Based on DP159 specs, APPLY_RX_TX_CHANGE bit in 0x0A
17931789
* needs to be set to 1 on every 0xA-0xC write.
@@ -1805,8 +1801,7 @@ static void write_i2c_retimer_setting(
18051801
pipe_ctx->stream->link->ddc,
18061802
slave_address, &offset, 1, &value, 1);
18071803
if (!i2c_success)
1808-
/* Write failure */
1809-
ASSERT(i2c_success);
1804+
goto i2c_write_fail;
18101805
}
18111806

18121807
buffer[0] = offset;
@@ -1818,8 +1813,7 @@ static void write_i2c_retimer_setting(
18181813
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18191814
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18201815
if (!i2c_success)
1821-
/* Write failure */
1822-
ASSERT(i2c_success);
1816+
goto i2c_write_fail;
18231817
}
18241818
}
18251819
}
@@ -1837,8 +1831,7 @@ static void write_i2c_retimer_setting(
18371831
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18381832
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18391833
if (!i2c_success)
1840-
/* Write failure */
1841-
ASSERT(i2c_success);
1834+
goto i2c_write_fail;
18421835

18431836
/* Write offset 0x00 to 0x23 */
18441837
buffer[0] = 0x00;
@@ -1849,8 +1842,7 @@ static void write_i2c_retimer_setting(
18491842
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18501843
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18511844
if (!i2c_success)
1852-
/* Write failure */
1853-
ASSERT(i2c_success);
1845+
goto i2c_write_fail;
18541846

18551847
/* Write offset 0xff to 0x00 */
18561848
buffer[0] = 0xff;
@@ -1861,10 +1853,14 @@ static void write_i2c_retimer_setting(
18611853
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18621854
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18631855
if (!i2c_success)
1864-
/* Write failure */
1865-
ASSERT(i2c_success);
1856+
goto i2c_write_fail;
18661857

18671858
}
1859+
1860+
return;
1861+
1862+
i2c_write_fail:
1863+
DC_LOG_DEBUG("Set retimer failed");
18681864
}
18691865

18701866
static void write_i2c_default_retimer_setting(
@@ -1889,8 +1885,7 @@ static void write_i2c_default_retimer_setting(
18891885
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
18901886
slave_address, buffer[0], buffer[1], i2c_success?1:0);
18911887
if (!i2c_success)
1892-
/* Write failure */
1893-
ASSERT(i2c_success);
1888+
goto i2c_write_fail;
18941889

18951890
/* Write offset 0x0A to 0x17 */
18961891
buffer[0] = 0x0A;
@@ -1901,8 +1896,7 @@ static void write_i2c_default_retimer_setting(
19011896
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19021897
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19031898
if (!i2c_success)
1904-
/* Write failure */
1905-
ASSERT(i2c_success);
1899+
goto i2c_write_fail;
19061900

19071901
/* Write offset 0x0B to 0xDA or 0xD8 */
19081902
buffer[0] = 0x0B;
@@ -1913,8 +1907,7 @@ static void write_i2c_default_retimer_setting(
19131907
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19141908
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19151909
if (!i2c_success)
1916-
/* Write failure */
1917-
ASSERT(i2c_success);
1910+
goto i2c_write_fail;
19181911

19191912
/* Write offset 0x0A to 0x17 */
19201913
buffer[0] = 0x0A;
@@ -1925,8 +1918,7 @@ static void write_i2c_default_retimer_setting(
19251918
offset = 0x%x, reg_val= 0x%x, i2c_success = %d\n",
19261919
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19271920
if (!i2c_success)
1928-
/* Write failure */
1929-
ASSERT(i2c_success);
1921+
goto i2c_write_fail;
19301922

19311923
/* Write offset 0x0C to 0x1D or 0x91 */
19321924
buffer[0] = 0x0C;
@@ -1937,8 +1929,7 @@ static void write_i2c_default_retimer_setting(
19371929
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19381930
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19391931
if (!i2c_success)
1940-
/* Write failure */
1941-
ASSERT(i2c_success);
1932+
goto i2c_write_fail;
19421933

19431934
/* Write offset 0x0A to 0x17 */
19441935
buffer[0] = 0x0A;
@@ -1949,8 +1940,7 @@ static void write_i2c_default_retimer_setting(
19491940
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19501941
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19511942
if (!i2c_success)
1952-
/* Write failure */
1953-
ASSERT(i2c_success);
1943+
goto i2c_write_fail;
19541944

19551945

19561946
if (is_vga_mode) {
@@ -1965,8 +1955,7 @@ static void write_i2c_default_retimer_setting(
19651955
offset = 0x%x, reg_val = 0x%x, i2c_success = %d\n",
19661956
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19671957
if (!i2c_success)
1968-
/* Write failure */
1969-
ASSERT(i2c_success);
1958+
goto i2c_write_fail;
19701959

19711960
/* Write offset 0x00 to 0x23 */
19721961
buffer[0] = 0x00;
@@ -1977,8 +1966,7 @@ static void write_i2c_default_retimer_setting(
19771966
offset = 0x%x, reg_val= 0x%x, i2c_success = %d\n",
19781967
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19791968
if (!i2c_success)
1980-
/* Write failure */
1981-
ASSERT(i2c_success);
1969+
goto i2c_write_fail;
19821970

19831971
/* Write offset 0xff to 0x00 */
19841972
buffer[0] = 0xff;
@@ -1989,9 +1977,13 @@ static void write_i2c_default_retimer_setting(
19891977
offset = 0x%x, reg_val= 0x%x, i2c_success = %d end here\n",
19901978
slave_address, buffer[0], buffer[1], i2c_success?1:0);
19911979
if (!i2c_success)
1992-
/* Write failure */
1993-
ASSERT(i2c_success);
1980+
goto i2c_write_fail;
19941981
}
1982+
1983+
return;
1984+
1985+
i2c_write_fail:
1986+
DC_LOG_DEBUG("Set default retimer failed");
19951987
}
19961988

19971989
static void write_i2c_redriver_setting(
@@ -2020,8 +2012,7 @@ static void write_i2c_redriver_setting(
20202012
slave_address, buffer[3], buffer[4], buffer[5], buffer[6], i2c_success?1:0);
20212013

20222014
if (!i2c_success)
2023-
/* Write failure */
2024-
ASSERT(i2c_success);
2015+
DC_LOG_DEBUG("Set redriver failed");
20252016
}
20262017

20272018
static void enable_link_hdmi(struct pipe_ctx *pipe_ctx)

0 commit comments

Comments
 (0)