Lines Matching refs:hdev
107 if (hub_is_superspeed(hub->hdev)) in portspeed()
118 struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev) in usb_hub_to_struct_hub() argument
120 if (!hdev || !hdev->actconfig || !hdev->maxchild) in usb_hub_to_struct_hub()
122 return usb_get_intfdata(hdev->actconfig->interface[0]); in usb_hub_to_struct_hub()
360 static int get_hub_descriptor(struct usb_device *hdev, void *data) in get_hub_descriptor() argument
365 if (hub_is_superspeed(hdev)) { in get_hub_descriptor()
374 ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), in get_hub_descriptor()
387 static int clear_hub_feature(struct usb_device *hdev, int feature) in clear_hub_feature() argument
389 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), in clear_hub_feature()
396 int usb_clear_port_feature(struct usb_device *hdev, int port1, int feature) in usb_clear_port_feature() argument
398 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), in usb_clear_port_feature()
406 static int set_port_feature(struct usb_device *hdev, int port1, int feature) in set_port_feature() argument
408 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), in set_port_feature()
438 status = set_port_feature(hub->hdev, (selector << 8) | port1, in set_port_led()
450 struct usb_device *hdev = hub->hdev; in led_work() local
455 if (hdev->state != USB_STATE_CONFIGURED || hub->quiescing) in led_work()
458 for (i = 0; i < hdev->maxchild; i++) { in led_work()
507 cursor %= hdev->maxchild; in led_work()
524 static int get_hub_status(struct usb_device *hdev, in get_hub_status() argument
531 status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), in get_hub_status()
541 static int get_port_status(struct usb_device *hdev, int port1, in get_port_status() argument
548 status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0), in get_port_status()
561 ret = get_port_status(hub->hdev, port1, &hub->status->port); in hub_port_status()
605 void usb_kick_hub_wq(struct usb_device *hdev) in usb_kick_hub_wq() argument
607 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); in usb_kick_hub_wq()
621 void usb_wakeup_notification(struct usb_device *hdev, in usb_wakeup_notification() argument
626 if (!hdev) in usb_wakeup_notification()
629 hub = usb_hub_to_struct_hub(hdev); in usb_wakeup_notification()
685 hub_clear_tt_buffer(struct usb_device *hdev, u16 devinfo, u16 tt) in hub_clear_tt_buffer() argument
690 int status = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), in hub_clear_tt_buffer()
696 return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), in hub_clear_tt_buffer()
717 struct usb_device *hdev = hub->hdev; in hub_tt_work() local
727 status = hub_clear_tt_buffer(hdev, clear->devinfo, clear->tt); in hub_tt_work()
729 dev_err(&hdev->dev, in hub_tt_work()
756 int usb_hub_set_port_power(struct usb_device *hdev, struct usb_hub *hub, in usb_hub_set_port_power() argument
762 ret = set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); in usb_hub_set_port_power()
764 ret = usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_POWER); in usb_hub_set_port_power()
847 for (port1 = 1; port1 <= hub->hdev->maxchild; port1++) in hub_power_on()
849 set_port_feature(hub->hdev, port1, USB_PORT_FEAT_POWER); in hub_power_on()
851 usb_clear_port_feature(hub->hdev, port1, in hub_power_on()
863 ret = get_hub_status(hub->hdev, &hub->status->hub); in hub_hub_status()
880 return set_port_feature(hub->hdev, in hub_set_port_link_state()
901 if (!hub_is_superspeed(hub->hdev)) in hub_usb3_port_disable()
950 struct usb_device *hdev = hub->hdev; in hub_port_disable() local
956 if (hub_is_superspeed(hub->hdev)) in hub_port_disable()
959 ret = usb_clear_port_feature(hdev, port1, in hub_port_disable()
1029 struct usb_device *hdev = hub->hdev; in hub_activate() local
1064 if (hdev->parent && hub_is_superspeed(hdev)) { in hub_activate()
1065 ret = usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0), in hub_activate()
1067 hdev->level - 1, 0, NULL, 0, in hub_activate()
1104 hcd = bus_to_hcd(hdev->bus); in hub_activate()
1106 ret = hcd->driver->update_hub_device(hcd, hdev, in hub_activate()
1128 for (port1 = 1; port1 <= hdev->maxchild; ++port1) { in hub_activate()
1157 if (!hub_is_superspeed(hdev)) in hub_activate()
1158 usb_clear_port_feature(hdev, port1, in hub_activate()
1165 usb_clear_port_feature(hub->hdev, port1, in hub_activate()
1170 usb_clear_port_feature(hub->hdev, port1, in hub_activate()
1175 usb_clear_port_feature(hub->hdev, port1, in hub_activate()
1179 hub_is_superspeed(hub->hdev)) { in hub_activate()
1181 usb_clear_port_feature(hub->hdev, port1, in hub_activate()
1211 if (portchange || (hub_is_superspeed(hub->hdev) && in hub_activate()
1299 struct usb_device *hdev = hub->hdev; in hub_quiesce() local
1309 for (i = 0; i < hdev->maxchild; ++i) { in hub_quiesce()
1327 for (i = 0; i < hub->hdev->maxchild; ++i) in hub_pm_barrier_for_all_ports()
1357 struct usb_device *hdev = hub->hdev; in hub_configure() local
1391 ret = get_hub_descriptor(hdev, hub->descriptor); in hub_configure()
1416 if (hub_is_superspeed(hdev)) { in hub_configure()
1426 !(hub_is_superspeed(hdev))) { in hub_configure()
1467 switch (hdev->descriptor.bDeviceProtocol) { in hub_configure()
1472 hub->tt.hub = hdev; in hub_configure()
1475 ret = usb_set_interface(hdev, 0, 1); in hub_configure()
1482 hub->tt.hub = hdev; in hub_configure()
1489 hdev->descriptor.bDeviceProtocol); in hub_configure()
1496 if (hdev->descriptor.bDeviceProtocol != 0) { in hub_configure()
1535 ret = usb_get_status(hdev, USB_RECIP_DEVICE, 0, &hubstatus); in hub_configure()
1540 hcd = bus_to_hcd(hdev->bus); in hub_configure()
1541 if (hdev == hdev->bus->root_hub) { in hub_configure()
1543 hdev->bus_mA = hcd->power_budget; in hub_configure()
1545 hdev->bus_mA = full_load * maxchild; in hub_configure()
1546 if (hdev->bus_mA >= full_load) in hub_configure()
1549 hub->mA_per_port = hdev->bus_mA; in hub_configure()
1553 int remaining = hdev->bus_mA - in hub_configure()
1582 if (hdev->actconfig->desc.bmAttributes & USB_CONFIG_ATT_SELFPOWER) in hub_configure()
1597 pipe = usb_rcvintpipe(hdev, endpoint->bEndpointAddress); in hub_configure()
1598 maxp = usb_maxpacket(hdev, pipe, usb_pipeout(pipe)); in hub_configure()
1609 usb_fill_int_urb(hub->urb, hdev, pipe, *hub->buffer, maxp, hub_irq, in hub_configure()
1625 hdev->maxchild = i; in hub_configure()
1626 for (i = 0; i < hdev->maxchild; i++) { in hub_configure()
1640 ret = hcd->driver->update_hub_device(hcd, hdev, in hub_configure()
1648 usb_hub_adjust_deviceremovable(hdev, hub->descriptor); in hub_configure()
1664 usb_put_dev(hub->hdev); in hub_release()
1674 struct usb_device *hdev = interface_to_usbdev(intf); in hub_disconnect() local
1691 port1 = hdev->maxchild; in hub_disconnect()
1692 hdev->maxchild = 0; in hub_disconnect()
1701 if (hub->hdev->speed == USB_SPEED_HIGH) in hub_disconnect()
1718 struct usb_device *hdev; in hub_probe() local
1722 hdev = interface_to_usbdev(intf); in hub_probe()
1761 if (hdev->dev.power.autosuspend_delay >= 0) in hub_probe()
1762 pm_runtime_set_autosuspend_delay(&hdev->dev, 0); in hub_probe()
1770 if (hdev->parent) { /* normal device */ in hub_probe()
1771 usb_enable_autosuspend(hdev); in hub_probe()
1773 const struct hc_driver *drv = bus_to_hcd(hdev->bus)->driver; in hub_probe()
1776 usb_enable_autosuspend(hdev); in hub_probe()
1779 if (hdev->level == MAX_TOPO_LEVEL) { in hub_probe()
1786 if (hdev->parent) { in hub_probe()
1822 hub->hdev = hdev; in hub_probe()
1827 usb_get_dev(hdev); in hub_probe()
1833 if (hdev->speed == USB_SPEED_HIGH) in hub_probe()
1849 struct usb_device *hdev = interface_to_usbdev(intf); in hub_ioctl() local
1850 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); in hub_ioctl()
1859 if (hdev->devnum <= 0) in hub_ioctl()
1862 info->nports = hdev->maxchild; in hub_ioctl()
1885 static int find_port_owner(struct usb_device *hdev, unsigned port1, in find_port_owner() argument
1888 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); in find_port_owner()
1890 if (hdev->state == USB_STATE_NOTATTACHED) in find_port_owner()
1892 if (port1 == 0 || port1 > hdev->maxchild) in find_port_owner()
1903 int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, in usb_hub_claim_port() argument
1909 rc = find_port_owner(hdev, port1, &powner); in usb_hub_claim_port()
1919 int usb_hub_release_port(struct usb_device *hdev, unsigned port1, in usb_hub_release_port() argument
1925 rc = find_port_owner(hdev, port1, &powner); in usb_hub_release_port()
1935 void usb_hub_release_all_ports(struct usb_device *hdev, struct usb_dev_state *owner) in usb_hub_release_all_ports() argument
1937 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); in usb_hub_release_all_ports()
1940 for (n = 0; n < hdev->maxchild; n++) { in usb_hub_release_all_ports()
2372 struct usb_device *hdev = udev->parent; in set_usb_port_removable() local
2378 if (!hdev) in set_usb_port_removable()
2408 if (hub_is_superspeed(hdev)) { in set_usb_port_removable()
2620 if (hub->hdev->parent != NULL) /* not a root hub? */ in hub_is_wusb()
2622 hcd = container_of(hub->hdev->bus, struct usb_hcd, self); in hub_is_wusb()
2662 if (!hub_is_superspeed(hub->hdev)) in hub_port_warm_reset_required()
2718 if (!hub_is_superspeed(hub->hdev) && in hub_port_wait_reset()
2730 else if (hub_is_superspeed(hub->hdev)) in hub_port_wait_reset()
2749 if (!hub_is_superspeed(hub->hdev)) { in hub_port_reset()
2773 status = set_port_feature(hub->hdev, port1, (warm ? in hub_port_reset()
2793 usb_clear_port_feature(hub->hdev, port1, in hub_port_reset()
2796 if (!hub_is_superspeed(hub->hdev)) in hub_port_reset()
2799 usb_clear_port_feature(hub->hdev, port1, in hub_port_reset()
2801 usb_clear_port_feature(hub->hdev, port1, in hub_port_reset()
2803 usb_clear_port_feature(hub->hdev, port1, in hub_port_reset()
2858 if (!hub_is_superspeed(hub->hdev)) in hub_port_reset()
2869 if (hub_is_superspeed(hub->hdev)) { in port_is_power_on()
2901 if (hub_is_superspeed(hub->hdev)) { in port_is_suspended()
2961 usb_clear_port_feature(hub->hdev, port1, in check_port_resume_type()
2964 usb_clear_port_feature(hub->hdev, port1, in check_port_resume_type()
3167 if (hub_is_superspeed(hub->hdev)) in usb_port_suspend()
3182 status = set_port_feature(hub->hdev, port1, in usb_port_suspend()
3224 usb_mark_last_busy(hub->hdev); in usb_port_suspend()
3420 if (hub_is_superspeed(hub->hdev)) in usb_port_resume()
3423 status = usb_clear_port_feature(hub->hdev, in usb_port_resume()
3446 if (hub_is_superspeed(hub->hdev)) { in usb_port_resume()
3448 usb_clear_port_feature(hub->hdev, port1, in usb_port_resume()
3452 usb_clear_port_feature(hub->hdev, port1, in usb_port_resume()
3457 if (udev->persist_enabled && hub_is_superspeed(hub->hdev)) in usb_port_resume()
3506 struct usb_device *hdev; in hub_handle_remote_wakeup() local
3511 hdev = hub->hdev; in hub_handle_remote_wakeup()
3513 if (!hub_is_superspeed(hdev)) { in hub_handle_remote_wakeup()
3516 usb_clear_port_feature(hdev, port, USB_PORT_FEAT_C_SUSPEND); in hub_handle_remote_wakeup()
3545 for (port1 = 1; port1 <= hub->hdev->maxchild; ++port1) { in check_ports_changed()
3559 struct usb_device *hdev = hub->hdev; in hub_suspend() local
3568 for (port1 = 1; port1 <= hdev->maxchild; port1++) { in hub_suspend()
3583 if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) { in hub_suspend()
3588 pm_wakeup_event(&hdev->dev, 2000); in hub_suspend()
3592 if (hub_is_superspeed(hdev) && hdev->do_remote_wakeup) { in hub_suspend()
3594 for (port1 = 1; port1 <= hdev->maxchild; port1++) { in hub_suspend()
3595 status = set_port_feature(hdev, in hub_suspend()
4165 usb_clear_port_feature(hub->hdev, port1, in hub_port_debounce()
4278 struct usb_device *hdev = hub->hdev; in hub_port_init() local
4279 struct usb_hcd *hcd = bus_to_hcd(hdev->bus); in hub_port_init()
4289 if (!hdev->parent) { in hub_port_init()
4291 if (port1 == hdev->bus->otg_port) in hub_port_init()
4292 hdev->bus->b_hnp_enable = 0; in hub_port_init()
4300 mutex_lock(&hdev->bus->usb_address0_mutex); in hub_port_init()
4356 if (hdev->tt) { in hub_port_init()
4357 udev->tt = hdev->tt; in hub_port_init()
4358 udev->ttport = hdev->ttport; in hub_port_init()
4360 && hdev->speed == USB_SPEED_HIGH) { in hub_port_init()
4582 mutex_unlock(&hdev->bus->usb_address0_mutex); in hub_port_init()
4617 struct usb_device *hdev = hub->hdev; in hub_power_remaining() local
4624 remaining = hdev->bus_mA - hub->descriptor->bHubContrCurrent; in hub_power_remaining()
4625 for (port1 = 1; port1 <= hdev->maxchild; ++port1) { in hub_power_remaining()
4644 else if (port1 != udev->bus->otg_port || hdev->parent) in hub_power_remaining()
4666 struct usb_device *hdev = hub->hdev; in hub_port_connect() local
4667 struct usb_hcd *hcd = bus_to_hcd(hdev->bus); in hub_port_connect()
4674 if (hcd->usb_phy && !hdev->parent) in hub_port_connect()
4714 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); in hub_port_connect()
4720 if (hub_is_superspeed(hub->hdev)) in hub_port_connect()
4731 udev = usb_alloc_dev(hdev, hdev->bus, port1); in hub_port_connect()
4740 udev->level = hdev->level + 1; in hub_port_connect()
4744 if (hub_is_superspeed(hub->hdev)) in hub_port_connect()
4816 if (hdev->state == USB_STATE_NOTATTACHED) in hub_port_connect()
4833 if (hcd->usb_phy && !hdev->parent) in hub_port_connect()
4858 if (hub->hdev->parent || in hub_port_connect()
4868 if (hcd->driver->relinquish_port && !hub->hdev->parent) in hub_port_connect()
4899 if (hub->hdev->bus->is_b_host) in hub_port_connect_change()
4940 struct usb_device *hdev = hub->hdev; in port_event() local
4951 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); in port_event()
4959 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE); in port_event()
4977 usb_clear_port_feature(hdev, port1, in port_event()
4988 usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_RESET); in port_event()
4991 && hub_is_superspeed(hdev)) { in port_event()
4993 usb_clear_port_feature(hdev, port1, in port_event()
4998 usb_clear_port_feature(hdev, port1, in port_event()
5003 usb_clear_port_feature(hdev, port1, in port_event()
5041 struct usb_device *hdev; in hub_event() local
5050 hdev = hub->hdev; in hub_event()
5055 hdev->state, hdev->maxchild, in hub_event()
5062 usb_lock_device(hdev); in hub_event()
5067 if (hdev->state == USB_STATE_NOTATTACHED) { in hub_event()
5087 ret = usb_reset_device(hdev); in hub_event()
5098 for (i = 1; i <= hdev->maxchild; i++) { in hub_event()
5130 clear_hub_feature(hdev, C_HUB_LOCAL_POWER); in hub_event()
5142 clear_hub_feature(hdev, C_HUB_OVER_CURRENT); in hub_event()
5155 usb_unlock_device(hdev); in hub_event()
5658 struct usb_device *usb_hub_find_child(struct usb_device *hdev, in usb_hub_find_child() argument
5661 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); in usb_hub_find_child()
5663 if (port1 < 1 || port1 > hdev->maxchild) in usb_hub_find_child()
5669 void usb_hub_adjust_deviceremovable(struct usb_device *hdev, in usb_hub_adjust_deviceremovable() argument
5672 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); in usb_hub_adjust_deviceremovable()
5679 if (!hub_is_superspeed(hdev)) { in usb_hub_adjust_deviceremovable()
5680 for (i = 1; i <= hdev->maxchild; i++) { in usb_hub_adjust_deviceremovable()
5696 for (i = 1; i <= hdev->maxchild; i++) { in usb_hub_adjust_deviceremovable()
5723 acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev, in usb_get_hub_port_acpi_handle() argument
5726 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); in usb_get_hub_port_acpi_handle()