Lines Matching defs:hdev

140 	if (hub_is_superspeedplus(hub->hdev))
142 if (hub_is_superspeed(hub->hdev))
152 /* Note that hdev or one of its children must be locked! */
153 struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev)
155 if (!hdev || !hdev->actconfig || !hdev->maxchild)
157 return usb_get_intfdata(hdev->actconfig->interface[0]);
247 if (!hub->hdev->parent)
406 static int get_hub_descriptor(struct usb_device *hdev,
412 if (hub_is_superspeed(hdev)) {
421 ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
425 if (hub_is_superspeed(hdev)) {
442 static int clear_hub_feature(struct usb_device *hdev, int feature)
444 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
451 int usb_clear_port_feature(struct usb_device *hdev, int port1, int feature)
453 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
461 static int set_port_feature(struct usb_device *hdev, int port1, int feature)
463 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
493 status = set_port_feature(hub->hdev, (selector << 8) | port1,
505 struct usb_device *hdev = hub->hdev;
510 if (hdev->state != USB_STATE_CONFIGURED || hub->quiescing)
513 for (i = 0; i < hdev->maxchild; i++) {
562 cursor %= hdev->maxchild;
579 static int get_hub_status(struct usb_device *hdev,
586 status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
597 static int get_port_status(struct usb_device *hdev, int port1,
604 status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
621 ret = get_port_status(hub->hdev, port1, &hub->status->port, type, len);
644 struct usb_device *hdev = hub->hdev;
651 if (is_root_hub(hdev)) {
652 struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
732 void usb_kick_hub_wq(struct usb_device *hdev)
734 struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
748 void usb_wakeup_notification(struct usb_device *hdev,
754 if (!hdev)
757 hub = usb_hub_to_struct_hub(hdev);
812 hub_clear_tt_buffer(struct usb_device *hdev, u16 devinfo, u16 tt)
817 int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
823 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
844 struct usb_device *hdev = hub->hdev;
854 status = hub_clear_tt_buffer(hdev, clear->devinfo, clear->tt);
856 dev_err(&hdev->dev,
873 * @hdev: USB device belonging to the usb hub
883 int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub,
889 ret = set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
891 ret = usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
974 for (port1 = 1; port1 <= hub->hdev->maxchild; port1++)
976 set_port_feature(hub->hdev, port1, USB_PORT_FEAT_POWER);
978 usb_clear_port_feature(hub->hdev, port1,
990 ret = get_hub_status(hub->hdev, &hub->status->hub);
1007 return set_port_feature(hub->hdev,
1078 struct usb_device *hdev = hub->hdev;
1088 device_lock(&hdev->dev);
1110 if (hdev->parent && hub_is_superspeed(hdev)) {
1111 ret = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
1113 hdev->level - 1, 0, NULL, 0,
1150 hcd = bus_to_hcd(hdev->bus);
1152 ret = hcd->driver->update_hub_device(hcd, hdev,
1166 } else if (hub_is_superspeed(hub->hdev))
1175 for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
1207 if (!hub_is_superspeed(hdev))
1208 usb_clear_port_feature(hdev, port1,
1222 if (hub_is_superspeed(hdev) &&
1230 usb_clear_port_feature(hub->hdev, port1,
1235 usb_clear_port_feature(hub->hdev, port1,
1240 usb_clear_port_feature(hub->hdev, port1,
1244 hub_is_superspeed(hub->hdev)) {
1246 usb_clear_port_feature(hub->hdev, port1,
1281 if (portchange || (hub_is_superspeed(hub->hdev) &&
1319 device_unlock(&hdev->dev);
1342 device_unlock(&hdev->dev);
1369 struct usb_device *hdev = hub->hdev;
1380 for (i = 0; i < hdev->maxchild; ++i) {
1399 for (i = 0; i < hub->hdev->maxchild; ++i)
1429 struct usb_device *hdev = hub->hdev;
1463 ret = get_hub_descriptor(hdev, hub->descriptor);
1470 if (hub_is_superspeed(hdev))
1487 if (hub_is_superspeed(hdev) || hub_is_superspeedplus(hdev)) {
1490 if (hdev->parent)
1491 delay += hdev->parent->hub_delay;
1494 hdev->hub_delay = min_t(u32, delay, USB_TP_TRANSMISSION_DELAY_MAX);
1508 if (hub_is_superspeed(hdev)) {
1518 !(hub_is_superspeed(hdev))) {
1559 switch (hdev->descriptor.bDeviceProtocol) {
1564 hub->tt.hub = hdev;
1567 ret = usb_set_interface(hdev, 0, 1);
1574 hub->tt.hub = hdev;
1581 hdev->descriptor.bDeviceProtocol);
1588 if (hdev->descriptor.bDeviceProtocol != 0) {
1627 ret = usb_get_std_status(hdev, USB_RECIP_DEVICE, 0, &hubstatus);
1632 hcd = bus_to_hcd(hdev->bus);
1633 if (hdev == hdev->bus->root_hub) {
1635 hdev->bus_mA = hcd->power_budget;
1637 hdev->bus_mA = full_load * maxchild;
1638 if (hdev->bus_mA >= full_load)
1641 hub->mA_per_port = hdev->bus_mA;
1645 int remaining = hdev->bus_mA -
1674 if (hdev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_SELFPOWER)
1689 pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress);
1690 maxp = usb_maxpacket(hdev, pipe);
1701 usb_fill_int_urb(hub->urb, hdev, pipe, *hub->buffer, maxp, hub_irq,
1717 hdev->maxchild = i;
1718 for (i = 0; i < hdev->maxchild; i++) {
1732 ret = hcd->driver->update_hub_device(hcd, hdev,
1740 usb_hub_adjust_deviceremovable(hdev, hub->descriptor);
1756 usb_put_dev(hub->hdev);
1776 struct usb_device *hdev = interface_to_usbdev(intf);
1793 port1 = hdev->maxchild;
1794 hdev->maxchild = 0;
1803 if (hub->hdev->speed == USB_SPEED_HIGH)
1844 struct usb_device *hdev;
1848 hdev = interface_to_usbdev(intf);
1887 if (hdev->dev.power.autosuspend_delay >= 0)
1888 pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
1896 if (hdev->parent) { /* normal device */
1897 usb_enable_autosuspend(hdev);
1899 const struct hc_driver *drv = bus_to_hcd(hdev->bus)->driver;
1902 usb_enable_autosuspend(hdev);
1905 if (hdev->level == MAX_TOPO_LEVEL) {
1912 if (hdev->parent) {
1932 hub->hdev = hdev;
1940 usb_get_dev(hdev);
1946 if (hdev->speed == USB_SPEED_HIGH)
1962 usb_set_interface(hdev, 0, 0);
1966 onboard_dev_create_pdevs(hdev, &hub->onboard_devs);
1978 struct usb_device *hdev = interface_to_usbdev(intf);
1979 struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
1988 if (hdev->devnum <= 0)
1991 info->nports = hdev->maxchild;
2014 static int find_port_owner(struct usb_device *hdev, unsigned port1,
2017 struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
2019 if (hdev->state == USB_STATE_NOTATTACHED)
2021 if (port1 == 0 || port1 > hdev->maxchild)
2031 /* In the following three functions, the caller must hold hdev's lock */
2032 int usb_hub_claim_port(struct usb_device *hdev, unsigned port1,
2038 rc = find_port_owner(hdev, port1, &powner);
2048 int usb_hub_release_port(struct usb_device *hdev, unsigned port1,
2054 rc = find_port_owner(hdev, port1, &powner);
2064 void usb_hub_release_all_ports(struct usb_device *hdev, struct usb_dev_state *owner)
2066 struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
2069 for (n = 0; n < hdev->maxchild; n++) {
2523 struct usb_device *hdev = udev->parent;
2531 if (!hdev)
2561 if (hub_is_superspeed(hdev)) {
2761 * @hdev: The hub device
2768 static enum usb_ssp_rate get_port_ssp_rate(struct usb_device *hdev,
2778 if (!hdev->bos)
2781 ssp_cap = hdev->bos->ssp_cap;
2896 if (!hub_is_superspeed(hub->hdev))
2922 if (hub_is_superspeedplus(hub->hdev))
2967 if (!hub_is_superspeed(hub->hdev) &&
2969 usb_clear_port_feature(hub->hdev, port1,
2980 if (hub_is_superspeedplus(hub->hdev)) {
2984 udev->ssp_rate = get_port_ssp_rate(hub->hdev, ext_portstatus);
2992 else if (hub_is_superspeed(hub->hdev))
3012 if (!hub_is_superspeed(hub->hdev)) {
3037 status = set_port_feature(hub->hdev, port1, (warm ?
3061 usb_clear_port_feature(hub->hdev, port1,
3064 if (!hub_is_superspeed(hub->hdev))
3067 usb_clear_port_feature(hub->hdev, port1,
3069 usb_clear_port_feature(hub->hdev, port1,
3073 usb_clear_port_feature(hub->hdev, port1,
3116 if (hub->hdev->quirks & USB_QUIRK_HUB_SLOW_RESET)
3139 if (!hub_is_superspeed(hub->hdev))
3192 if (hub_is_superspeed(hub->hdev)) {
3224 if (hub_is_superspeed(hub->hdev)) {
3284 usb_clear_port_feature(hub->hdev, port1,
3287 usb_clear_port_feature(hub->hdev, port1,
3493 if (hub_is_superspeed(hub->hdev))
3508 status = set_port_feature(hub->hdev, port1,
3568 usb_mark_last_busy(hub->hdev);
3775 if (hub_is_superspeed(hub->hdev))
3778 status = usb_clear_port_feature(hub->hdev,
3798 if (hub_is_superspeed(hub->hdev)) {
3800 usb_clear_port_feature(hub->hdev, port1,
3804 usb_clear_port_feature(hub->hdev, port1,
3859 struct usb_device *hdev;
3865 hdev = hub->hdev;
3867 if (!hub_is_superspeed(hdev)) {
3870 usb_clear_port_feature(hdev, port, USB_PORT_FEAT_C_SUSPEND);
3901 for (port1 = 1; port1 <= hub->hdev->maxchild; ++port1) {
3915 struct usb_device *hdev = hub->hdev;
3923 for (port1 = 1; port1 <= hdev->maxchild; port1++) {
3938 if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) {
3943 pm_wakeup_event(&hdev->dev, 2000);
3947 if (hub_is_superspeed(hdev) && hdev->do_remote_wakeup) {
3949 for (port1 = 1; port1 <= hdev->maxchild; port1++) {
3950 set_port_feature(hdev,
3969 struct usb_device *hdev = hub->hdev;
3975 if (hdev->parent)
3978 hcd = bus_to_hcd(hdev->bus);
3990 for (i = 0; i < hdev->maxchild; ++i) {
4598 struct usb_device *hdev = hub->hdev;
4602 if (hub_is_superspeed(hub->hdev)) {
4607 ret = usb_clear_port_feature(hdev, port1,
4673 usb_clear_port_feature(hub->hdev, port1,
4708 if (hub->hdev->quirks & USB_QUIRK_SHORT_SET_ADDRESS_REQ_TIMEOUT)
4859 struct usb_device *hdev = hub->hdev;
4860 struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
4880 if (!hdev->parent) {
4882 if (port1 == hdev->bus->otg_port)
4883 hdev->bus->b_hnp_enable = 0;
4957 if (hdev->tt) {
4958 udev->tt = hdev->tt;
4959 udev->ttport = hdev->ttport;
4961 && hdev->speed == USB_SPEED_HIGH) {
5215 struct usb_device *hdev = hub->hdev;
5222 remaining = hdev->bus_mA - hub->descriptor->bHubContrCurrent;
5223 for (port1 = 1; port1 <= hdev->maxchild; ++port1) {
5242 else if (port1 != udev->bus->otg_port || hdev->parent)
5350 struct usb_device *hdev = hub->hdev;
5351 struct usb_hcd *hcd = bus_to_hcd(hdev->bus);
5359 if (hcd->usb_phy && !hdev->parent)
5399 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
5405 if (hub_is_superspeed(hub->hdev))
5424 udev = usb_alloc_dev(hdev, hdev->bus, port1);
5435 udev->level = hdev->level + 1;
5438 if (hub_is_superspeed(hub->hdev))
5501 * no one will look at it until hdev is unlocked.
5512 if (hdev->state == USB_STATE_NOTATTACHED)
5529 if (hcd->usb_phy && !hdev->parent)
5561 usb_hub_set_port_power(hdev, hub, port1, false);
5563 usb_hub_set_port_power(hdev, hub, port1, true);
5567 if (hub->hdev->parent ||
5577 if (hcd->driver->relinquish_port && !hub->hdev->parent) {
5610 if (hub->hdev->bus->is_b_host)
5706 struct usb_device *hdev = hub->hdev;
5718 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION);
5726 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE);
5747 usb_clear_port_feature(hdev, port1,
5758 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_RESET);
5761 && hub_is_superspeed(hdev)) {
5763 usb_clear_port_feature(hdev, port1,
5768 usb_clear_port_feature(hdev, port1,
5773 usb_clear_port_feature(hdev, port1,
5826 struct usb_device *hdev;
5835 hdev = hub->hdev;
5839 kcov_remote_start_usb((u64)hdev->bus->busnum);
5842 hdev->state, hdev->maxchild,
5849 usb_lock_device(hdev);
5854 if (hdev->state == USB_STATE_NOTATTACHED) {
5874 ret = usb_reset_device(hdev);
5885 for (i = 1; i <= hdev->maxchild; i++) {
5917 clear_hub_feature(hdev, C_HUB_LOCAL_POWER);
5929 clear_hub_feature(hdev, C_HUB_OVER_CURRENT);
5942 usb_unlock_device(hdev);
6387 * @hdev: USB device belonging to the usb hub
6397 struct usb_device *usb_hub_find_child(struct usb_device *hdev,
6400 struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
6402 if (port1 < 1 || port1 > hdev->maxchild)
6408 void usb_hub_adjust_deviceremovable(struct usb_device *hdev,
6411 struct usb_hub *hub = usb_hub_to_struct_hub(hdev);
6418 if (!hub_is_superspeed(hdev)) {
6419 for (i = 1; i <= hdev->maxchild; i++) {
6435 for (i = 1; i <= hdev->maxchild; i++) {
6456 * @hdev: USB device belonging to the usb hub
6462 acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev,
6465 struct usb_hub *hub = usb_hub_to_struct_hub(hdev);