Lines Matching refs:usb4

225 static bool supports_software(const struct usb4_port *usb4)  in supports_software()  argument
227 return usb4->margining->caps[0] & USB4_MARGIN_CAP_0_MODES_SW; in supports_software()
230 static bool supports_hardware(const struct usb4_port *usb4) in supports_hardware() argument
232 return usb4->margining->caps[0] & USB4_MARGIN_CAP_0_MODES_HW; in supports_hardware()
235 static bool both_lanes(const struct usb4_port *usb4) in both_lanes() argument
237 return usb4->margining->caps[0] & USB4_MARGIN_CAP_0_2_LANES; in both_lanes()
240 static unsigned int independent_voltage_margins(const struct usb4_port *usb4) in independent_voltage_margins() argument
242 return (usb4->margining->caps[0] & USB4_MARGIN_CAP_0_VOLTAGE_INDP_MASK) >> in independent_voltage_margins()
246 static bool supports_time(const struct usb4_port *usb4) in supports_time() argument
248 return usb4->margining->caps[0] & USB4_MARGIN_CAP_0_TIME; in supports_time()
252 static unsigned int independent_time_margins(const struct usb4_port *usb4) in independent_time_margins() argument
254 return (usb4->margining->caps[1] & USB4_MARGIN_CAP_1_TIME_INDP_MASK) >> in independent_time_margins()
264 struct usb4_port *usb4 = port->usb4; in margining_ber_level_write() local
273 if (usb4->margining->software) { in margining_ber_level_write()
290 if (val < usb4->margining->min_ber_level || in margining_ber_level_write()
291 val > usb4->margining->max_ber_level) { in margining_ber_level_write()
296 usb4->margining->ber_level = val; in margining_ber_level_write()
317 struct usb4_port *usb4 = port->usb4; in margining_ber_level_show() local
319 if (usb4->margining->software) in margining_ber_level_show()
321 ber_level_show(s, usb4->margining->ber_level); in margining_ber_level_show()
329 struct usb4_port *usb4 = port->usb4; in margining_caps_show() local
337 cap0 = usb4->margining->caps[0]; in margining_caps_show()
339 cap1 = usb4->margining->caps[1]; in margining_caps_show()
343 supports_software(usb4) ? "yes" : "no"); in margining_caps_show()
344 if (supports_hardware(usb4)) { in margining_caps_show()
347 ber_level_show(s, usb4->margining->min_ber_level); in margining_caps_show()
349 ber_level_show(s, usb4->margining->max_ber_level); in margining_caps_show()
355 both_lanes(usb4) ? "yes" : "no"); in margining_caps_show()
357 usb4->margining->voltage_steps); in margining_caps_show()
359 usb4->margining->max_voltage_offset); in margining_caps_show()
361 switch (independent_voltage_margins(usb4)) { in margining_caps_show()
373 if (supports_time(usb4)) { in margining_caps_show()
378 switch (independent_time_margins(usb4)) { in margining_caps_show()
391 usb4->margining->time_steps); in margining_caps_show()
393 usb4->margining->max_time_offset); in margining_caps_show()
409 struct usb4_port *usb4 = port->usb4; in margining_lanes_write() local
426 usb4->margining->lanes = 0; in margining_lanes_write()
428 usb4->margining->lanes = 1; in margining_lanes_write()
431 if (both_lanes(usb4)) in margining_lanes_write()
432 usb4->margining->lanes = 7; in margining_lanes_write()
449 struct usb4_port *usb4 = port->usb4; in margining_lanes_show() local
456 lanes = usb4->margining->lanes; in margining_lanes_show()
457 if (both_lanes(usb4)) { in margining_lanes_show()
482 struct usb4_port *usb4 = port->usb4; in margining_mode_write() local
499 if (supports_software(usb4)) in margining_mode_write()
500 usb4->margining->software = true; in margining_mode_write()
504 if (supports_hardware(usb4)) in margining_mode_write()
505 usb4->margining->software = false; in margining_mode_write()
522 const struct usb4_port *usb4 = port->usb4; in margining_mode_show() local
529 if (supports_software(usb4)) { in margining_mode_show()
530 if (usb4->margining->software) in margining_mode_show()
536 if (supports_hardware(usb4)) { in margining_mode_show()
537 if (usb4->margining->software) in margining_mode_show()
553 struct usb4_port *usb4 = port->usb4; in margining_run_write() local
580 margining = usb4->margining; in margining_run_write()
620 struct usb4_port *usb4 = port->usb4; in margining_results_write() local
627 usb4->margining->results[0] = 0; in margining_results_write()
628 usb4->margining->results[1] = 0; in margining_results_write()
663 struct usb4_port *usb4 = port->usb4; in margining_results_show() local
670 margining = usb4->margining; in margining_results_show()
733 struct usb4_port *usb4 = port->usb4; in margining_test_write() local
749 if (!strcmp(buf, "time") && supports_time(usb4)) in margining_test_write()
750 usb4->margining->time = true; in margining_test_write()
752 usb4->margining->time = false; in margining_test_write()
766 struct usb4_port *usb4 = port->usb4; in margining_test_show() local
772 if (supports_time(usb4)) { in margining_test_show()
773 if (usb4->margining->time) in margining_test_show()
792 struct usb4_port *usb4 = port->usb4; in margining_margin_write() local
808 if (usb4->margining->time) { in margining_margin_write()
810 usb4->margining->right_high = false; in margining_margin_write()
812 usb4->margining->right_high = true; in margining_margin_write()
817 usb4->margining->right_high = false; in margining_margin_write()
819 usb4->margining->right_high = true; in margining_margin_write()
834 struct usb4_port *usb4 = port->usb4; in margining_margin_show() local
840 if (usb4->margining->time) { in margining_margin_show()
841 if (usb4->margining->right_high) in margining_margin_show()
846 if (usb4->margining->right_high) in margining_margin_show()
861 struct usb4_port *usb4; in margining_port_init() local
866 usb4 = port->usb4; in margining_port_init()
867 if (!usb4) in margining_port_init()
883 usb4->margining = margining; in margining_port_init()
886 if (supports_software(usb4)) in margining_port_init()
896 if (supports_time(usb4)) { in margining_port_init()
910 if (supports_hardware(usb4)) { in margining_port_init()
930 if (independent_voltage_margins(usb4) || in margining_port_init()
931 (supports_time(usb4) && independent_time_margins(usb4))) in margining_port_init()
940 if (!port->usb4) in margining_port_remove()
947 kfree(port->usb4->margining); in margining_port_remove()
948 port->usb4->margining = NULL; in margining_port_remove()