Lines Matching refs:udev
253 struct usb_device *udev = to_usb_device(dev); in usb_probe_device() local
264 error = usb_autoresume_device(udev); in usb_probe_device()
269 error = usb_generic_driver_probe(udev); in usb_probe_device()
294 error = udriver->probe(udev); in usb_probe_device()
297 udev->use_generic_driver = 1; in usb_probe_device()
306 struct usb_device *udev = to_usb_device(dev); in usb_unbind_device() local
310 udriver->disconnect(udev); in usb_unbind_device()
312 usb_generic_driver_disconnect(udev); in usb_unbind_device()
314 usb_autosuspend_device(udev); in usb_unbind_device()
323 struct usb_device *udev = interface_to_usbdev(intf); in usb_probe_interface() local
332 if (usb_device_is_owned(udev)) in usb_probe_interface()
335 if (udev->authorized == 0) { in usb_probe_interface()
352 error = usb_autoresume_device(udev); in usb_probe_interface()
379 lpm_disable_error = usb_unlocked_disable_lpm(udev); in usb_probe_interface()
390 error = usb_set_interface(udev, intf->altsetting[0]. in usb_probe_interface()
405 usb_unlocked_enable_lpm(udev); in usb_probe_interface()
407 usb_autosuspend_device(udev); in usb_probe_interface()
417 usb_unlocked_enable_lpm(udev); in usb_probe_interface()
424 usb_autosuspend_device(udev); in usb_probe_interface()
434 struct usb_device *udev; in usb_unbind_interface() local
441 udev = interface_to_usbdev(intf); in usb_unbind_interface()
442 error = usb_autoresume_device(udev); in usb_unbind_interface()
450 lpm_disable_error = usb_unlocked_disable_lpm(udev); in usb_unbind_interface()
456 if (!driver->soft_unbind || udev->state == USB_STATE_NOTATTACHED) in usb_unbind_interface()
457 usb_disable_interface(udev, intf, false); in usb_unbind_interface()
489 usb_enable_interface(udev, intf, false); in usb_unbind_interface()
491 r = usb_set_interface(udev, intf->altsetting[0]. in usb_unbind_interface()
505 usb_unlocked_enable_lpm(udev); in usb_unbind_interface()
513 usb_autosuspend_device(udev); in usb_unbind_interface()
825 const struct usb_device_id *usb_device_match_id(struct usb_device *udev, in usb_device_match_id() argument
832 if (usb_match_device(udev, id)) in usb_device_match_id()
839 bool usb_driver_applicable(struct usb_device *udev, in usb_driver_applicable() argument
843 return usb_device_match_id(udev, udrv->id_table) != NULL && in usb_driver_applicable()
844 udrv->match(udev); in usb_driver_applicable()
847 return usb_device_match_id(udev, udrv->id_table) != NULL; in usb_driver_applicable()
850 return udrv->match(udev); in usb_driver_applicable()
859 struct usb_device *udev; in usb_device_match() local
866 udev = to_usb_device(dev); in usb_device_match()
876 return usb_driver_applicable(udev, udrv); in usb_device_match()
946 struct usb_device *udev; in __usb_bus_reprobe_drivers() local
953 udev = to_usb_device(dev); in __usb_bus_reprobe_drivers()
954 if (!usb_driver_applicable(udev, new_udriver)) in __usb_bus_reprobe_drivers()
1130 static void unbind_marked_interfaces(struct usb_device *udev) in unbind_marked_interfaces() argument
1136 config = udev->actconfig; in unbind_marked_interfaces()
1177 static void rebind_marked_interfaces(struct usb_device *udev) in rebind_marked_interfaces() argument
1183 config = udev->actconfig; in rebind_marked_interfaces()
1200 void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev) in usb_unbind_and_rebind_marked_interfaces() argument
1202 unbind_marked_interfaces(udev); in usb_unbind_and_rebind_marked_interfaces()
1203 rebind_marked_interfaces(udev); in usb_unbind_and_rebind_marked_interfaces()
1214 static void unbind_no_pm_drivers_interfaces(struct usb_device *udev) in unbind_no_pm_drivers_interfaces() argument
1221 config = udev->actconfig; in unbind_no_pm_drivers_interfaces()
1235 static int usb_suspend_device(struct usb_device *udev, pm_message_t msg) in usb_suspend_device() argument
1240 if (udev->state == USB_STATE_NOTATTACHED || in usb_suspend_device()
1241 udev->state == USB_STATE_SUSPENDED) in usb_suspend_device()
1245 if (udev->dev.driver) in usb_suspend_device()
1246 udriver = to_usb_device_driver(udev->dev.driver); in usb_suspend_device()
1248 udev->do_remote_wakeup = 0; in usb_suspend_device()
1252 status = udriver->suspend(udev, msg); in usb_suspend_device()
1254 status = usb_generic_driver_suspend(udev, msg); in usb_suspend_device()
1257 dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); in usb_suspend_device()
1261 static int usb_resume_device(struct usb_device *udev, pm_message_t msg) in usb_resume_device() argument
1266 if (udev->state == USB_STATE_NOTATTACHED) in usb_resume_device()
1270 if (udev->dev.driver == NULL) { in usb_resume_device()
1278 if (!PMSG_IS_AUTO(msg) && udev->parent && udev->bus->hs_companion) in usb_resume_device()
1279 device_pm_wait_for_dev(&udev->dev, in usb_resume_device()
1280 &udev->bus->hs_companion->root_hub->dev); in usb_resume_device()
1282 if (udev->quirks & USB_QUIRK_RESET_RESUME) in usb_resume_device()
1283 udev->reset_resume = 1; in usb_resume_device()
1285 udriver = to_usb_device_driver(udev->dev.driver); in usb_resume_device()
1287 status = usb_generic_driver_resume(udev, msg); in usb_resume_device()
1289 status = udriver->resume(udev, msg); in usb_resume_device()
1292 dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); in usb_resume_device()
1296 static int usb_suspend_interface(struct usb_device *udev, in usb_suspend_interface() argument
1302 if (udev->state == USB_STATE_NOTATTACHED || in usb_suspend_interface()
1317 static int usb_resume_interface(struct usb_device *udev, in usb_resume_interface() argument
1323 if (udev->state == USB_STATE_NOTATTACHED) in usb_resume_interface()
1335 usb_set_interface(udev, intf->altsetting[0]. in usb_resume_interface()
1398 static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) in usb_suspend_both() argument
1405 if (udev->state == USB_STATE_NOTATTACHED || in usb_suspend_both()
1406 udev->state == USB_STATE_SUSPENDED) in usb_suspend_both()
1409 trace_android_rvh_usb_dev_suspend(udev, msg, &bypass); in usb_suspend_both()
1414 if (udev->actconfig) { in usb_suspend_both()
1415 n = udev->actconfig->desc.bNumInterfaces; in usb_suspend_both()
1417 intf = udev->actconfig->interface[i]; in usb_suspend_both()
1418 status = usb_suspend_interface(udev, intf, msg); in usb_suspend_both()
1428 status = usb_suspend_device(udev, msg); in usb_suspend_both()
1436 if (udev->parent && !PMSG_IS_AUTO(msg)) in usb_suspend_both()
1447 err = usb_get_std_status(udev, USB_RECIP_DEVICE, 0, in usb_suspend_both()
1450 dev_err(&udev->dev, in usb_suspend_both()
1460 if (udev->actconfig) { in usb_suspend_both()
1463 intf = udev->actconfig->interface[i]; in usb_suspend_both()
1464 usb_resume_interface(udev, intf, msg, 0); in usb_suspend_both()
1472 udev->can_submit = 0; in usb_suspend_both()
1474 usb_hcd_flush_endpoint(udev, udev->ep_out[i]); in usb_suspend_both()
1475 usb_hcd_flush_endpoint(udev, udev->ep_in[i]); in usb_suspend_both()
1480 dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); in usb_suspend_both()
1504 static int usb_resume_both(struct usb_device *udev, pm_message_t msg) in usb_resume_both() argument
1511 if (udev->state == USB_STATE_NOTATTACHED) { in usb_resume_both()
1516 trace_android_vh_usb_dev_resume(udev, msg, &bypass); in usb_resume_both()
1520 udev->can_submit = 1; in usb_resume_both()
1523 if (udev->state == USB_STATE_SUSPENDED || udev->reset_resume) in usb_resume_both()
1524 status = usb_resume_device(udev, msg); in usb_resume_both()
1527 if (status == 0 && udev->actconfig) { in usb_resume_both()
1528 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { in usb_resume_both()
1529 intf = udev->actconfig->interface[i]; in usb_resume_both()
1530 usb_resume_interface(udev, intf, msg, in usb_resume_both()
1531 udev->reset_resume); in usb_resume_both()
1534 usb_mark_last_busy(udev); in usb_resume_both()
1537 dev_vdbg(&udev->dev, "%s: status %d\n", __func__, status); in usb_resume_both()
1539 udev->reset_resume = 0; in usb_resume_both()
1543 static void choose_wakeup(struct usb_device *udev, pm_message_t msg) in choose_wakeup() argument
1552 if (udev->state != USB_STATE_SUSPENDED) in choose_wakeup()
1553 udev->do_remote_wakeup = 0; in choose_wakeup()
1560 w = device_may_wakeup(&udev->dev); in choose_wakeup()
1565 if (udev->state == USB_STATE_SUSPENDED && w != udev->do_remote_wakeup) in choose_wakeup()
1566 pm_runtime_resume(&udev->dev); in choose_wakeup()
1567 udev->do_remote_wakeup = w; in choose_wakeup()
1573 struct usb_device *udev = to_usb_device(dev); in usb_suspend() local
1576 unbind_no_pm_drivers_interfaces(udev); in usb_suspend()
1582 choose_wakeup(udev, msg); in usb_suspend()
1583 r = usb_suspend_both(udev, msg); in usb_suspend()
1587 if (udev->quirks & USB_QUIRK_DISCONNECT_SUSPEND) in usb_suspend()
1588 usb_port_disable(udev); in usb_suspend()
1596 struct usb_device *udev = to_usb_device(dev); in usb_resume_complete() local
1601 if (udev->state != USB_STATE_NOTATTACHED) in usb_resume_complete()
1602 rebind_marked_interfaces(udev); in usb_resume_complete()
1609 struct usb_device *udev = to_usb_device(dev); in usb_resume() local
1619 status = usb_resume_both(udev, msg); in usb_resume()
1624 unbind_marked_interfaces(udev); in usb_resume()
1645 void usb_enable_autosuspend(struct usb_device *udev) in usb_enable_autosuspend() argument
1647 pm_runtime_allow(&udev->dev); in usb_enable_autosuspend()
1660 void usb_disable_autosuspend(struct usb_device *udev) in usb_disable_autosuspend() argument
1662 pm_runtime_forbid(&udev->dev); in usb_disable_autosuspend()
1682 void usb_autosuspend_device(struct usb_device *udev) in usb_autosuspend_device() argument
1686 usb_mark_last_busy(udev); in usb_autosuspend_device()
1687 status = pm_runtime_put_sync_autosuspend(&udev->dev); in usb_autosuspend_device()
1688 dev_vdbg(&udev->dev, "%s: cnt %d -> %d\n", in usb_autosuspend_device()
1689 __func__, atomic_read(&udev->dev.power.usage_count), in usb_autosuspend_device()
1713 int usb_autoresume_device(struct usb_device *udev) in usb_autoresume_device() argument
1717 status = pm_runtime_get_sync(&udev->dev); in usb_autoresume_device()
1719 pm_runtime_put_sync(&udev->dev); in usb_autoresume_device()
1720 dev_vdbg(&udev->dev, "%s: cnt %d -> %d\n", in usb_autoresume_device()
1721 __func__, atomic_read(&udev->dev.power.usage_count), in usb_autoresume_device()
1745 struct usb_device *udev = interface_to_usbdev(intf); in usb_autopm_put_interface() local
1748 usb_mark_last_busy(udev); in usb_autopm_put_interface()
1773 struct usb_device *udev = interface_to_usbdev(intf); in usb_autopm_put_interface_async() local
1776 usb_mark_last_busy(udev); in usb_autopm_put_interface_async()
1795 struct usb_device *udev = interface_to_usbdev(intf); in usb_autopm_put_interface_no_suspend() local
1797 usb_mark_last_busy(udev); in usb_autopm_put_interface_no_suspend()
1881 struct usb_device *udev = interface_to_usbdev(intf); in usb_autopm_get_interface_no_resume() local
1883 usb_mark_last_busy(udev); in usb_autopm_get_interface_no_resume()
1889 static int autosuspend_check(struct usb_device *udev) in autosuspend_check() argument
1894 if (udev->state == USB_STATE_NOTATTACHED) in autosuspend_check()
1901 if (udev->actconfig) { in autosuspend_check()
1902 for (i = 0; i < udev->actconfig->desc.bNumInterfaces; i++) { in autosuspend_check()
1903 intf = udev->actconfig->interface[i]; in autosuspend_check()
1920 if (udev->quirks & USB_QUIRK_RESET_RESUME) { in autosuspend_check()
1930 if (w && !device_can_wakeup(&udev->dev)) { in autosuspend_check()
1931 dev_dbg(&udev->dev, "remote wakeup needed for autosuspend\n"); in autosuspend_check()
1940 if (w && udev->parent == udev->bus->root_hub && in autosuspend_check()
1941 bus_to_hcd(udev->bus)->cant_recv_wakeups) { in autosuspend_check()
1942 dev_dbg(&udev->dev, "HCD doesn't handle wakeup requests\n"); in autosuspend_check()
1946 udev->do_remote_wakeup = w; in autosuspend_check()
1952 struct usb_device *udev = to_usb_device(dev); in usb_runtime_suspend() local
1959 if (autosuspend_check(udev) != 0) in usb_runtime_suspend()
1962 status = usb_suspend_both(udev, PMSG_AUTO_SUSPEND); in usb_runtime_suspend()
1966 usb_mark_last_busy(udev); in usb_runtime_suspend()
1974 if (status != 0 && udev->parent) in usb_runtime_suspend()
1981 struct usb_device *udev = to_usb_device(dev); in usb_runtime_resume() local
1987 status = usb_resume_both(udev, PMSG_AUTO_RESUME); in usb_runtime_resume()
1993 struct usb_device *udev = to_usb_device(dev); in usb_runtime_idle() local
1998 if (autosuspend_check(udev) == 0) in usb_runtime_idle()
2004 static int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) in usb_set_usb2_hardware_lpm() argument
2006 struct usb_hcd *hcd = bus_to_hcd(udev->bus); in usb_set_usb2_hardware_lpm()
2010 ret = hcd->driver->set_usb2_hw_lpm(hcd, udev, enable); in usb_set_usb2_hardware_lpm()
2012 udev->usb2_hw_lpm_enabled = enable; in usb_set_usb2_hardware_lpm()
2018 int usb_enable_usb2_hardware_lpm(struct usb_device *udev) in usb_enable_usb2_hardware_lpm() argument
2020 if (!udev->usb2_hw_lpm_capable || in usb_enable_usb2_hardware_lpm()
2021 !udev->usb2_hw_lpm_allowed || in usb_enable_usb2_hardware_lpm()
2022 udev->usb2_hw_lpm_enabled) in usb_enable_usb2_hardware_lpm()
2025 return usb_set_usb2_hardware_lpm(udev, 1); in usb_enable_usb2_hardware_lpm()
2028 int usb_disable_usb2_hardware_lpm(struct usb_device *udev) in usb_disable_usb2_hardware_lpm() argument
2030 if (!udev->usb2_hw_lpm_enabled) in usb_disable_usb2_hardware_lpm()
2033 return usb_set_usb2_hardware_lpm(udev, 0); in usb_disable_usb2_hardware_lpm()