Lines Matching refs:udev
1208 static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, in xhci_check_args() argument
1214 if (!hcd || (check_ep && !ep) || !udev) { in xhci_check_args()
1218 if (!udev->parent) { in xhci_check_args()
1225 if (!udev->slot_id || !xhci->devs[udev->slot_id]) { in xhci_check_args()
1231 virt_dev = xhci->devs[udev->slot_id]; in xhci_check_args()
1232 if (virt_dev->udev != udev) { in xhci_check_args()
1246 struct usb_device *udev, struct xhci_command *command,
1654 int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, in xhci_drop_endpoint() argument
1666 ret = xhci_check_args(hcd, udev, ep, 1, true, __func__); in xhci_drop_endpoint()
1673 xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); in xhci_drop_endpoint()
1681 in_ctx = xhci->devs[udev->slot_id]->in_ctx; in xhci_drop_endpoint()
1682 out_ctx = xhci->devs[udev->slot_id]->out_ctx; in xhci_drop_endpoint()
1700 if (xhci->devs[udev->slot_id]->eps[ep_index].ring != NULL) in xhci_drop_endpoint()
1712 xhci_endpoint_zero(xhci, xhci->devs[udev->slot_id], ep); in xhci_drop_endpoint()
1716 udev->slot_id, in xhci_drop_endpoint()
1735 int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, in xhci_add_endpoint() argument
1747 ret = xhci_check_args(hcd, udev, ep, 1, true, __func__); in xhci_add_endpoint()
1768 virt_dev = xhci->devs[udev->slot_id]; in xhci_add_endpoint()
1803 if (xhci_endpoint_init(xhci, virt_dev, udev, ep, GFP_NOIO) < 0) { in xhci_add_endpoint()
1804 dev_dbg(&udev->dev, "%s - could not initialize ep %#x\n", in xhci_add_endpoint()
1821 ep->hcpriv = udev; in xhci_add_endpoint()
1825 udev->slot_id, in xhci_add_endpoint()
1866 struct usb_device *udev, u32 *cmd_status) in xhci_configure_endpoint_result() argument
1877 dev_warn(&udev->dev, in xhci_configure_endpoint_result()
1884 dev_warn(&udev->dev, in xhci_configure_endpoint_result()
1891 dev_warn(&udev->dev, "ERROR: Endpoint drop flag = 0, " in xhci_configure_endpoint_result()
1897 dev_warn(&udev->dev, in xhci_configure_endpoint_result()
1916 struct usb_device *udev, u32 *cmd_status) in xhci_evaluate_context_result() argument
1919 struct xhci_virt_device *virt_dev = xhci->devs[udev->slot_id]; in xhci_evaluate_context_result()
1928 dev_warn(&udev->dev, in xhci_evaluate_context_result()
1933 dev_warn(&udev->dev, in xhci_evaluate_context_result()
1938 dev_warn(&udev->dev, in xhci_evaluate_context_result()
1944 dev_warn(&udev->dev, in xhci_evaluate_context_result()
1950 dev_warn(&udev->dev, "WARN: Max Exit Latency too large\n"); in xhci_evaluate_context_result()
2074 static unsigned int xhci_get_block_size(struct usb_device *udev) in xhci_get_block_size() argument
2076 switch (udev->speed) { in xhci_get_block_size()
2208 if (virt_dev->udev->speed == USB_SPEED_SUPER) in xhci_check_bw_table()
2211 if (virt_dev->udev->speed == USB_SPEED_HIGH) { in xhci_check_bw_table()
2224 block_size = xhci_get_block_size(virt_dev->udev); in xhci_check_bw_table()
2341 if (!virt_dev->tt_info && virt_dev->udev->speed == USB_SPEED_HIGH) { in xhci_check_bw_table()
2399 struct usb_device *udev, in xhci_drop_ep_from_interval_table() argument
2409 if (udev->speed == USB_SPEED_SUPER) { in xhci_drop_ep_from_interval_table()
2411 xhci->devs[udev->slot_id]->bw_table->ss_bw_in -= in xhci_drop_ep_from_interval_table()
2414 xhci->devs[udev->slot_id]->bw_table->ss_bw_out -= in xhci_drop_ep_from_interval_table()
2427 if (udev->speed == USB_SPEED_HIGH) in xhci_drop_ep_from_interval_table()
2436 switch (udev->speed) { in xhci_drop_ep_from_interval_table()
2462 struct usb_device *udev, in xhci_add_ep_to_interval_table() argument
2473 if (udev->speed == USB_SPEED_SUPER) { in xhci_add_ep_to_interval_table()
2475 xhci->devs[udev->slot_id]->bw_table->ss_bw_in += in xhci_add_ep_to_interval_table()
2478 xhci->devs[udev->slot_id]->bw_table->ss_bw_out += in xhci_add_ep_to_interval_table()
2486 if (udev->speed == USB_SPEED_HIGH) in xhci_add_ep_to_interval_table()
2495 switch (udev->speed) { in xhci_add_ep_to_interval_table()
2585 virt_dev->udev, in xhci_reserve_bandwidth()
2597 virt_dev->udev, in xhci_reserve_bandwidth()
2622 virt_dev->udev, in xhci_reserve_bandwidth()
2634 virt_dev->udev, in xhci_reserve_bandwidth()
2646 struct usb_device *udev, in xhci_configure_endpoint() argument
2659 virt_dev = xhci->devs[udev->slot_id]; in xhci_configure_endpoint()
2689 udev->slot_id, must_succeed); in xhci_configure_endpoint()
2693 udev->slot_id, must_succeed); in xhci_configure_endpoint()
2709 ret = xhci_configure_endpoint_result(xhci, udev, in xhci_configure_endpoint()
2712 ret = xhci_evaluate_context_result(xhci, udev, in xhci_configure_endpoint()
2753 int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) in xhci_check_bandwidth() argument
2763 ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__); in xhci_check_bandwidth()
2771 xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); in xhci_check_bandwidth()
2772 virt_dev = xhci->devs[udev->slot_id]; in xhci_check_bandwidth()
2814 ret = xhci_configure_endpoint(xhci, udev, command, in xhci_check_bandwidth()
2857 void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev) in xhci_reset_bandwidth() argument
2863 ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__); in xhci_reset_bandwidth()
2868 xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev); in xhci_reset_bandwidth()
2869 virt_dev = xhci->devs[udev->slot_id]; in xhci_reset_bandwidth()
2939 struct usb_device *udev = td->urb->dev; in xhci_cleanup_stalled_ring() local
2943 ep = &xhci->devs[udev->slot_id]->eps[ep_index]; in xhci_cleanup_stalled_ring()
2947 xhci_find_new_dequeue_state(xhci, udev->slot_id, in xhci_cleanup_stalled_ring()
2959 xhci_queue_new_dequeue_state(xhci, udev->slot_id, in xhci_cleanup_stalled_ring()
2970 xhci_setup_input_ctx_for_quirk(xhci, udev->slot_id, in xhci_cleanup_stalled_ring()
3005 struct usb_device *udev, struct usb_host_endpoint *ep, in xhci_check_streams_endpoint() argument
3014 ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__); in xhci_check_streams_endpoint()
3071 struct usb_device *udev, in xhci_calculate_streams_and_bitmask() argument
3081 ret = xhci_check_streams_endpoint(xhci, udev, in xhci_calculate_streams_and_bitmask()
3082 eps[i], udev->slot_id); in xhci_calculate_streams_and_bitmask()
3103 struct usb_device *udev, in xhci_calculate_no_streams_bitmask() argument
3112 slot_id = udev->slot_id; in xhci_calculate_no_streams_bitmask()
3159 int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev, in xhci_alloc_streams() argument
3209 ret = xhci_calculate_streams_and_bitmask(xhci, udev, eps, in xhci_alloc_streams()
3223 vdev = xhci->devs[udev->slot_id]; in xhci_alloc_streams()
3273 ret = xhci_configure_endpoint(xhci, udev, config_cmd, in xhci_alloc_streams()
3288 udev->slot_id, ep_index); in xhci_alloc_streams()
3320 int xhci_free_streams(struct usb_hcd *hcd, struct usb_device *udev, in xhci_free_streams() argument
3334 vdev = xhci->devs[udev->slot_id]; in xhci_free_streams()
3339 udev, eps, num_eps); in xhci_free_streams()
3364 xhci->devs[udev->slot_id]->eps[ep_index].ep_state |= in xhci_free_streams()
3380 ret = xhci_configure_endpoint(xhci, udev, command, in xhci_free_streams()
3452 int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) in xhci_discover_or_reset_device() argument
3464 ret = xhci_check_args(hcd, udev, NULL, 0, false, __func__); in xhci_discover_or_reset_device()
3468 slot_id = udev->slot_id; in xhci_discover_or_reset_device()
3473 ret = xhci_alloc_dev(hcd, udev); in xhci_discover_or_reset_device()
3483 if (virt_dev->udev != udev) { in xhci_discover_or_reset_device()
3491 ret = xhci_alloc_dev(hcd, udev); in xhci_discover_or_reset_device()
3593 udev, in xhci_discover_or_reset_device()
3615 void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev) in xhci_free_dev() argument
3638 ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__); in xhci_free_dev()
3647 virt_dev = xhci->devs[udev->slot_id]; in xhci_free_dev()
3660 xhci_free_virt_device(xhci, udev->slot_id); in xhci_free_dev()
3667 udev->slot_id)) { in xhci_free_dev()
3708 int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev) in xhci_alloc_dev() argument
3763 if (!xhci_alloc_virt_device(xhci, slot_id, udev, GFP_NOIO)) { in xhci_alloc_dev()
3767 udev->slot_id = slot_id; in xhci_alloc_dev()
3790 udev->slot_id)) in xhci_alloc_dev()
3802 static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, in xhci_setup_device() argument
3820 if (!udev->slot_id) { in xhci_setup_device()
3822 "Bad Slot ID %d", udev->slot_id); in xhci_setup_device()
3827 virt_dev = xhci->devs[udev->slot_id]; in xhci_setup_device()
3836 udev->slot_id); in xhci_setup_device()
3873 xhci_setup_addressable_virt_dev(xhci, udev); in xhci_setup_device()
3876 xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev); in xhci_setup_device()
3880 xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); in xhci_setup_device()
3887 udev->slot_id, setup); in xhci_setup_device()
3913 act, udev->slot_id); in xhci_setup_device()
3917 dev_warn(&udev->dev, "Device not responding to setup %s.\n", act); in xhci_setup_device()
3921 dev_warn(&udev->dev, in xhci_setup_device()
3933 xhci_dbg(xhci, "Slot ID %d Output Context:\n", udev->slot_id); in xhci_setup_device()
3946 udev->slot_id, in xhci_setup_device()
3947 &xhci->dcbaa->dev_context_ptrs[udev->slot_id], in xhci_setup_device()
3949 le64_to_cpu(xhci->dcbaa->dev_context_ptrs[udev->slot_id])); in xhci_setup_device()
3953 xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); in xhci_setup_device()
3957 xhci_dbg(xhci, "Slot ID %d Output Context:\n", udev->slot_id); in xhci_setup_device()
3979 int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) in xhci_address_device() argument
3981 return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ADDRESS); in xhci_address_device()
3984 int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev) in xhci_enable_device() argument
3986 return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ONLY); in xhci_enable_device()
4016 struct usb_device *udev, u16 max_exit_latency) in xhci_change_max_exit_latency() argument
4027 virt_dev = xhci->devs[udev->slot_id]; in xhci_change_max_exit_latency()
4061 xhci_dbg(xhci, "Slot %u Input Context:\n", udev->slot_id); in xhci_change_max_exit_latency()
4065 ret = xhci_configure_endpoint(xhci, udev, command, in xhci_change_max_exit_latency()
4067 xhci_dbg(xhci, "Slot %u Output Context:\n", udev->slot_id); in xhci_change_max_exit_latency()
4086 struct usb_device *udev) in xhci_calculate_hird_besl() argument
4093 field = le32_to_cpu(udev->bos->ext_cap->bmAttributes); in xhci_calculate_hird_besl()
4120 static int xhci_calculate_usb2_hw_lpm_params(struct usb_device *udev) in xhci_calculate_usb2_hw_lpm_params() argument
4127 field = le32_to_cpu(udev->bos->ext_cap->bmAttributes); in xhci_calculate_usb2_hw_lpm_params()
4130 l1 = udev->l1_params.timeout / 256; in xhci_calculate_usb2_hw_lpm_params()
4142 struct usb_device *udev, int enable) in xhci_set_usb2_hardware_lpm() argument
4154 !udev->lpm_capable) in xhci_set_usb2_hardware_lpm()
4157 if (!udev->parent || udev->parent->parent || in xhci_set_usb2_hardware_lpm()
4158 udev->descriptor.bDeviceClass == USB_CLASS_HUB) in xhci_set_usb2_hardware_lpm()
4161 if (udev->usb2_hw_lpm_capable != 1) in xhci_set_usb2_hardware_lpm()
4167 port_num = udev->portnum - 1; in xhci_set_usb2_hardware_lpm()
4171 field = le32_to_cpu(udev->bos->ext_cap->bmAttributes); in xhci_set_usb2_hardware_lpm()
4178 if (udev->usb2_hw_lpm_besl_capable) { in xhci_set_usb2_hardware_lpm()
4187 hird = udev->l1_params.besl; in xhci_set_usb2_hardware_lpm()
4200 ret = xhci_change_max_exit_latency(xhci, udev, in xhci_set_usb2_hardware_lpm()
4208 hlpm_val = xhci_calculate_usb2_hw_lpm_params(udev); in xhci_set_usb2_hardware_lpm()
4213 hird = xhci_calculate_hird_besl(xhci, udev); in xhci_set_usb2_hardware_lpm()
4217 pm_val |= PORT_HIRD(hird) | PORT_RWE | PORT_L1DS(udev->slot_id); in xhci_set_usb2_hardware_lpm()
4229 if (udev->usb2_hw_lpm_besl_capable) { in xhci_set_usb2_hardware_lpm()
4232 xhci_change_max_exit_latency(xhci, udev, 0); in xhci_set_usb2_hardware_lpm()
4265 int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) in xhci_update_device() argument
4268 int portnum = udev->portnum - 1; in xhci_update_device()
4271 !udev->lpm_capable) in xhci_update_device()
4275 if (!udev->parent || udev->parent->parent || in xhci_update_device()
4276 udev->descriptor.bDeviceClass == USB_CLASS_HUB) in xhci_update_device()
4282 udev->usb2_hw_lpm_capable = 1; in xhci_update_device()
4283 udev->l1_params.timeout = XHCI_L1_TIMEOUT; in xhci_update_device()
4284 udev->l1_params.besl = XHCI_DEFAULT_BESL; in xhci_update_device()
4287 udev->usb2_hw_lpm_besl_capable = 1; in xhci_update_device()
4302 static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, in xhci_get_timeout_no_hub_lpm() argument
4313 sel = DIV_ROUND_UP(udev->u1_params.sel, 1000); in xhci_get_timeout_no_hub_lpm()
4314 pel = DIV_ROUND_UP(udev->u1_params.pel, 1000); in xhci_get_timeout_no_hub_lpm()
4319 sel = DIV_ROUND_UP(udev->u2_params.sel, 1000); in xhci_get_timeout_no_hub_lpm()
4320 pel = DIV_ROUND_UP(udev->u2_params.pel, 1000); in xhci_get_timeout_no_hub_lpm()
4325 dev_warn(&udev->dev, "%s: Can't get timeout for non-U1 or U2 state.\n", in xhci_get_timeout_no_hub_lpm()
4334 dev_dbg(&udev->dev, "Device-initiated %s disabled " in xhci_get_timeout_no_hub_lpm()
4338 dev_dbg(&udev->dev, "Device-initiated %s disabled " in xhci_get_timeout_no_hub_lpm()
4353 struct usb_device *udev, in xhci_calculate_intel_u1_timeout() argument
4363 timeout_ns = udev->u1_params.sel * 3; in xhci_calculate_intel_u1_timeout()
4366 timeout_ns = udev->u1_params.sel * 5; in xhci_calculate_intel_u1_timeout()
4371 timeout_ns = udev->u1_params.sel * 3; in xhci_calculate_intel_u1_timeout()
4378 if (timeout_ns < udev->u1_params.sel * 2) in xhci_calculate_intel_u1_timeout()
4379 timeout_ns = udev->u1_params.sel * 2; in xhci_calculate_intel_u1_timeout()
4390 struct usb_device *udev, in xhci_calculate_u1_timeout() argument
4396 timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); in xhci_calculate_u1_timeout()
4398 timeout_ns = udev->u1_params.sel; in xhci_calculate_u1_timeout()
4413 dev_dbg(&udev->dev, "Hub-initiated U1 disabled " in xhci_calculate_u1_timeout()
4415 return xhci_get_timeout_no_hub_lpm(udev, USB3_LPM_U1); in xhci_calculate_u1_timeout()
4425 struct usb_device *udev, in xhci_calculate_intel_u2_timeout() argument
4437 u2_del_ns = le16_to_cpu(udev->bos->ss_cap->bU2DevExitLat) * 1000ULL; in xhci_calculate_intel_u2_timeout()
4446 struct usb_device *udev, in xhci_calculate_u2_timeout() argument
4452 timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); in xhci_calculate_u2_timeout()
4454 timeout_ns = udev->u2_params.sel; in xhci_calculate_u2_timeout()
4463 dev_dbg(&udev->dev, "Hub-initiated U2 disabled " in xhci_calculate_u2_timeout()
4465 return xhci_get_timeout_no_hub_lpm(udev, USB3_LPM_U2); in xhci_calculate_u2_timeout()
4469 struct usb_device *udev, in xhci_call_host_update_timeout_for_endpoint() argument
4475 return xhci_calculate_u1_timeout(xhci, udev, desc); in xhci_call_host_update_timeout_for_endpoint()
4477 return xhci_calculate_u2_timeout(xhci, udev, desc); in xhci_call_host_update_timeout_for_endpoint()
4483 struct usb_device *udev, in xhci_update_timeout_for_endpoint() argument
4490 alt_timeout = xhci_call_host_update_timeout_for_endpoint(xhci, udev, in xhci_update_timeout_for_endpoint()
4508 struct usb_device *udev, in xhci_update_timeout_for_interface() argument
4516 if (xhci_update_timeout_for_endpoint(xhci, udev, in xhci_update_timeout_for_interface()
4524 static int xhci_check_intel_tier_policy(struct usb_device *udev, in xhci_check_intel_tier_policy() argument
4534 for (parent = udev->parent, num_hubs = 0; parent->parent; in xhci_check_intel_tier_policy()
4541 dev_dbg(&udev->dev, "Disabling U1 link state for device" in xhci_check_intel_tier_policy()
4543 dev_dbg(&udev->dev, "Plug device into first-tier hub " in xhci_check_intel_tier_policy()
4549 struct usb_device *udev, in xhci_check_tier_policy() argument
4553 return xhci_check_intel_tier_policy(udev, state); in xhci_check_tier_policy()
4564 struct usb_device *udev, enum usb3_link_state state) in xhci_calculate_lpm_timeout() argument
4577 dev_warn(&udev->dev, "Can't enable unknown link state %i\n", in xhci_calculate_lpm_timeout()
4582 if (xhci_check_tier_policy(xhci, udev, state) < 0) in xhci_calculate_lpm_timeout()
4588 if (xhci_update_timeout_for_endpoint(xhci, udev, &udev->ep0.desc, in xhci_calculate_lpm_timeout()
4592 config = udev->actconfig; in xhci_calculate_lpm_timeout()
4609 dev_dbg(&udev->dev, "Hub-initiated %s disabled " in xhci_calculate_lpm_timeout()
4612 return xhci_get_timeout_no_hub_lpm(udev, state); in xhci_calculate_lpm_timeout()
4620 if (xhci_update_timeout_for_interface(xhci, udev, in xhci_calculate_lpm_timeout()
4628 static int calculate_max_exit_latency(struct usb_device *udev, in calculate_max_exit_latency() argument
4653 if ((udev->u1_params.timeout != USB3_LPM_DISABLED && !disabling_u1) || in calculate_max_exit_latency()
4655 u1_mel_us = DIV_ROUND_UP(udev->u1_params.mel, 1000); in calculate_max_exit_latency()
4656 if ((udev->u2_params.timeout != USB3_LPM_DISABLED && !disabling_u2) || in calculate_max_exit_latency()
4658 u2_mel_us = DIV_ROUND_UP(udev->u2_params.mel, 1000); in calculate_max_exit_latency()
4666 dev_warn(&udev->dev, "Link PM max exit latency of %lluus " in calculate_max_exit_latency()
4675 struct usb_device *udev, enum usb3_link_state state) in xhci_enable_usb3_lpm_timeout() argument
4688 !xhci->devs[udev->slot_id]) in xhci_enable_usb3_lpm_timeout()
4691 hub_encoded_timeout = xhci_calculate_lpm_timeout(hcd, udev, state); in xhci_enable_usb3_lpm_timeout()
4692 mel = calculate_max_exit_latency(udev, state, hub_encoded_timeout); in xhci_enable_usb3_lpm_timeout()
4699 ret = xhci_change_max_exit_latency(xhci, udev, mel); in xhci_enable_usb3_lpm_timeout()
4706 struct usb_device *udev, enum usb3_link_state state) in xhci_disable_usb3_lpm_timeout() argument
4714 !xhci->devs[udev->slot_id]) in xhci_disable_usb3_lpm_timeout()
4717 mel = calculate_max_exit_latency(udev, state, USB3_LPM_DISABLED); in xhci_disable_usb3_lpm_timeout()
4718 ret = xhci_change_max_exit_latency(xhci, udev, mel); in xhci_disable_usb3_lpm_timeout()
4726 struct usb_device *udev, int enable) in xhci_set_usb2_hardware_lpm() argument
4731 int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev) in xhci_update_device() argument
4737 struct usb_device *udev, enum usb3_link_state state) in xhci_enable_usb3_lpm_timeout() argument
4743 struct usb_device *udev, enum usb3_link_state state) in xhci_disable_usb3_lpm_timeout() argument