Lines Matching refs:margining
230 return usb4->margining->caps[0] & USB4_MARGIN_CAP_0_MODES_SW; in supports_software()
235 return usb4->margining->caps[0] & USB4_MARGIN_CAP_0_MODES_HW; in supports_hardware()
240 return usb4->margining->caps[0] & USB4_MARGIN_CAP_0_2_LANES; in both_lanes()
245 return (usb4->margining->caps[0] & USB4_MARGIN_CAP_0_VOLTAGE_INDP_MASK) >> in independent_voltage_margins()
251 return usb4->margining->caps[0] & USB4_MARGIN_CAP_0_TIME; in supports_time()
257 return (usb4->margining->caps[1] & USB4_MARGIN_CAP_1_TIME_INDP_MASK) >> in independent_time_margins()
276 if (usb4->margining->software) { in margining_ber_level_write()
293 if (val < usb4->margining->min_ber_level || in margining_ber_level_write()
294 val > usb4->margining->max_ber_level) { in margining_ber_level_write()
299 usb4->margining->ber_level = val; in margining_ber_level_write()
322 if (usb4->margining->software) in margining_ber_level_show()
324 ber_level_show(s, usb4->margining->ber_level); in margining_ber_level_show()
340 cap0 = usb4->margining->caps[0]; in margining_caps_show()
342 cap1 = usb4->margining->caps[1]; in margining_caps_show()
350 ber_level_show(s, usb4->margining->min_ber_level); in margining_caps_show()
352 ber_level_show(s, usb4->margining->max_ber_level); in margining_caps_show()
360 usb4->margining->voltage_steps); in margining_caps_show()
362 usb4->margining->max_voltage_offset); in margining_caps_show()
394 usb4->margining->time_steps); in margining_caps_show()
396 usb4->margining->max_time_offset); in margining_caps_show()
429 usb4->margining->lanes = 0; in margining_lanes_write()
431 usb4->margining->lanes = 1; in margining_lanes_write()
435 usb4->margining->lanes = 7; in margining_lanes_write()
459 lanes = usb4->margining->lanes; in margining_lanes_show()
503 usb4->margining->software = true; in margining_mode_write()
508 usb4->margining->software = false; in margining_mode_write()
533 if (usb4->margining->software) in margining_mode_show()
540 if (usb4->margining->software) in margining_mode_show()
558 struct tb_margining *margining; in margining_run_write() local
593 margining = usb4->margining; in margining_run_write()
595 if (margining->software) { in margining_run_write()
597 margining->time ? "time" : "voltage", margining->lanes); in margining_run_write()
598 ret = usb4_port_sw_margin(port, margining->lanes, margining->time, in margining_run_write()
599 margining->right_high, in margining_run_write()
604 ret = usb4_port_sw_margin_errors(port, &margining->results[0]); in margining_run_write()
607 margining->time ? "time" : "voltage", margining->lanes); in margining_run_write()
609 margining->results[0] = 0; in margining_run_write()
610 margining->results[1] = 0; in margining_run_write()
611 ret = usb4_port_hw_margin(port, margining->lanes, in margining_run_write()
612 margining->ber_level, margining->time, in margining_run_write()
613 margining->right_high, margining->results); in margining_run_write()
643 usb4->margining->results[0] = 0; in margining_results_write()
644 usb4->margining->results[1] = 0; in margining_results_write()
651 const struct tb_margining *margining, u8 val) in voltage_margin_show() argument
656 voltage = tmp * margining->max_voltage_offset / margining->voltage_steps; in voltage_margin_show()
664 const struct tb_margining *margining, u8 val) in time_margin_show() argument
669 interval = tmp * margining->max_time_offset / margining->time_steps; in time_margin_show()
680 struct tb_margining *margining; in margining_results_show() local
686 margining = usb4->margining; in margining_results_show()
688 seq_printf(s, "0x%08x\n", margining->results[0]); in margining_results_show()
690 if (!margining->software) { in margining_results_show()
693 seq_printf(s, "0x%08x\n", margining->results[1]); in margining_results_show()
695 if (margining->time) { in margining_results_show()
696 if (!margining->lanes || margining->lanes == 7) { in margining_results_show()
697 val = margining->results[1]; in margining_results_show()
699 time_margin_show(s, margining, val); in margining_results_show()
700 val = margining->results[1] >> in margining_results_show()
703 time_margin_show(s, margining, val); in margining_results_show()
705 if (margining->lanes == 1 || margining->lanes == 7) { in margining_results_show()
706 val = margining->results[1] >> in margining_results_show()
709 time_margin_show(s, margining, val); in margining_results_show()
710 val = margining->results[1] >> in margining_results_show()
713 time_margin_show(s, margining, val); in margining_results_show()
716 if (!margining->lanes || margining->lanes == 7) { in margining_results_show()
717 val = margining->results[1]; in margining_results_show()
719 voltage_margin_show(s, margining, val); in margining_results_show()
720 val = margining->results[1] >> in margining_results_show()
723 voltage_margin_show(s, margining, val); in margining_results_show()
725 if (margining->lanes == 1 || margining->lanes == 7) { in margining_results_show()
726 val = margining->results[1] >> in margining_results_show()
729 voltage_margin_show(s, margining, val); in margining_results_show()
730 val = margining->results[1] >> in margining_results_show()
733 voltage_margin_show(s, margining, val); in margining_results_show()
766 usb4->margining->time = true; in margining_test_write()
768 usb4->margining->time = false; in margining_test_write()
789 if (usb4->margining->time) in margining_test_show()
824 if (usb4->margining->time) { in margining_margin_write()
826 usb4->margining->right_high = false; in margining_margin_write()
828 usb4->margining->right_high = true; in margining_margin_write()
833 usb4->margining->right_high = false; in margining_margin_write()
835 usb4->margining->right_high = true; in margining_margin_write()
856 if (usb4->margining->time) { in margining_margin_show()
857 if (usb4->margining->right_high) in margining_margin_show()
862 if (usb4->margining->right_high) in margining_margin_show()
875 struct tb_margining *margining; in margining_port_init() local
889 margining = kzalloc(sizeof(*margining), GFP_KERNEL); in margining_port_init()
890 if (!margining) in margining_port_init()
893 ret = usb4_port_margining_caps(port, margining->caps); in margining_port_init()
895 kfree(margining); in margining_port_init()
899 usb4->margining = margining; in margining_port_init()
903 margining->software = true; in margining_port_init()
905 val = (margining->caps[0] & USB4_MARGIN_CAP_0_VOLTAGE_STEPS_MASK) >> in margining_port_init()
907 margining->voltage_steps = val; in margining_port_init()
908 val = (margining->caps[0] & USB4_MARGIN_CAP_0_MAX_VOLTAGE_OFFSET_MASK) >> in margining_port_init()
910 margining->max_voltage_offset = 74 + val * 2; in margining_port_init()
913 val = (margining->caps[1] & USB4_MARGIN_CAP_1_TIME_STEPS_MASK) >> in margining_port_init()
915 margining->time_steps = val; in margining_port_init()
916 val = (margining->caps[1] & USB4_MARGIN_CAP_1_TIME_OFFSET_MASK) >> in margining_port_init()
922 margining->max_time_offset = 200 + 10 * val; in margining_port_init()
927 val = (margining->caps[1] & USB4_MARGIN_CAP_1_MIN_BER_MASK) >> in margining_port_init()
929 margining->min_ber_level = val; in margining_port_init()
930 val = (margining->caps[1] & USB4_MARGIN_CAP_1_MAX_BER_MASK) >> in margining_port_init()
932 margining->max_ber_level = val; in margining_port_init()
935 margining->ber_level = margining->min_ber_level; in margining_port_init()
964 kfree(port->usb4->margining); in margining_port_remove()
965 port->usb4->margining = NULL; in margining_port_remove()