Lines Matching +full:powered +full:- +full:on

1 // SPDX-License-Identifier: GPL-2.0
3 * drivers/usb/core/generic.c - generic driver for USB devices (not interfaces)
5 * (C) Copyright 2005 Greg Kroah-Hartman <gregkh@suse.de>
7 * based on drivers/usb/usb.c which had the following copyrights:
9 * (C) Copyright Johannes Erdfelt 1999-2001
14 * (C) Copyright David Brownell 2000-2004
17 * (C) Copyright Greg Kroah-Hartman 2002-2003
34 return desc->bInterfaceClass == USB_CLASS_COMM in is_rndis()
35 && desc->bInterfaceSubClass == 2 in is_rndis()
36 && desc->bInterfaceProtocol == 0xff; in is_rndis()
41 return desc->bInterfaceClass == USB_CLASS_MISC in is_activesync()
42 && desc->bInterfaceSubClass == 1 in is_activesync()
43 && desc->bInterfaceProtocol == 1; in is_activesync()
48 return desc->bInterfaceClass == USB_CLASS_AUDIO; in is_audio()
53 return desc->bInterfaceProtocol == UAC_VERSION_3; in is_uac3_config()
69 if (!udev->dev.driver) in usb_choose_configuration()
70 return -1; in usb_choose_configuration()
71 udriver = to_usb_device_driver(udev->dev.driver); in usb_choose_configuration()
76 if (udriver->choose_configuration) { in usb_choose_configuration()
77 i = udriver->choose_configuration(udev); in usb_choose_configuration()
83 c = udev->config; in usb_choose_configuration()
84 num_configs = udev->descriptor.bNumConfigurations; in usb_choose_configuration()
89 if (c->desc.bNumInterfaces > 0) in usb_choose_configuration()
90 desc = &c->intf_cache[0]->altsetting->desc; in usb_choose_configuration()
93 * HP's USB bus-powered keyboard has only one configuration in usb_choose_configuration()
94 * and it claims to be self-powered; other devices may have in usb_choose_configuration()
104 * have any other way to tell whether a device is self-powered, in usb_choose_configuration()
113 /* Rule out self-powered configs for a bus-powered device */ in usb_choose_configuration()
114 if (bus_powered && (c->desc.bmAttributes & in usb_choose_configuration()
122 * to be self-powered when they are really bus-powered. in usb_choose_configuration()
132 if (usb_get_max_power(udev, c) > udev->bus_mA) { in usb_choose_configuration()
163 * pet nonstandard Ethernet-over-USB protocols, ignore it unless in usb_choose_configuration()
177 * first interface is for a non-vendor-specific class. in usb_choose_configuration()
179 * than a vendor-specific driver. */ in usb_choose_configuration()
180 else if (udev->descriptor.bDeviceClass != in usb_choose_configuration()
182 (desc && desc->bInterfaceClass != in usb_choose_configuration()
188 /* If all the remaining configs are vendor-specific, in usb_choose_configuration()
195 dev_info(&udev->dev, "rejected %d configuration%s " in usb_choose_configuration()
200 i = best->desc.bConfigurationValue; in usb_choose_configuration()
201 dev_dbg(&udev->dev, in usb_choose_configuration()
205 i = -1; in usb_choose_configuration()
206 dev_warn(&udev->dev, in usb_choose_configuration()
229 if (udev->use_generic_driver) in usb_generic_driver_match()
249 if (udev->authorized == 0) in usb_generic_driver_probe()
250 dev_err(&udev->dev, "Device is not authorized for usage\n"); in usb_generic_driver_probe()
255 if (err && err != -ENODEV) { in usb_generic_driver_probe()
256 dev_err(&udev->dev, "can't set config #%d, error %d\n", in usb_generic_driver_probe()
275 if (udev->actconfig) in usb_generic_driver_disconnect()
276 usb_set_configuration(udev, -1); in usb_generic_driver_disconnect()
287 * so we have to shut down their downstream HC-to-USB in usb_generic_driver_suspend()
290 if (!udev->parent) in usb_generic_driver_suspend()
294 * Non-root USB2 devices don't need to do anything for FREEZE in usb_generic_driver_suspend()
299 && (udev->speed < USB_SPEED_SUPER)) in usb_generic_driver_suspend()
315 * so we have to start up their downstream HC-to-USB in usb_generic_driver_resume()
318 if (!udev->parent) in usb_generic_driver_resume()