Skip to content

Commit 985cfe5

Browse files
Aapo Vienamowesteri
authored andcommitted
thunderbolt: debugfs: Fix margin debugfs node creation condition
The margin debugfs node controls the "Enable Margin Test" field of the lane margining operations. This field selects between either low or high voltage margin values for voltage margin test or left or right timing margin values for timing margin test. According to the USB4 specification, whether or not the "Enable Margin Test" control applies, depends on the values of the "Independent High/Low Voltage Margin" or "Independent Left/Right Timing Margin" capability fields for voltage and timing margin tests respectively. The pre-existing condition enabled the debugfs node also in the case where both low/high or left/right margins are returned, which is incorrect. This change only enables the debugfs node in question, if the specific required capability values are met. Signed-off-by: Aapo Vienamo <[email protected]> Fixes: d0f1e0c ("thunderbolt: Add support for receiver lane margining") Cc: [email protected] Signed-off-by: Mika Westerberg <[email protected]>
1 parent 1613e60 commit 985cfe5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/thunderbolt/debugfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,8 +943,9 @@ static void margining_port_init(struct tb_port *port)
943943
debugfs_create_file("run", 0600, dir, port, &margining_run_fops);
944944
debugfs_create_file("results", 0600, dir, port, &margining_results_fops);
945945
debugfs_create_file("test", 0600, dir, port, &margining_test_fops);
946-
if (independent_voltage_margins(usb4) ||
947-
(supports_time(usb4) && independent_time_margins(usb4)))
946+
if (independent_voltage_margins(usb4) == USB4_MARGIN_CAP_0_VOLTAGE_HL ||
947+
(supports_time(usb4) &&
948+
independent_time_margins(usb4) == USB4_MARGIN_CAP_1_TIME_LR))
948949
debugfs_create_file("margin", 0600, dir, port, &margining_margin_fops);
949950
}
950951

0 commit comments

Comments
 (0)