Lines Matching +full:self +full:- +full:powered

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>
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()
67 c = udev->config; in usb_choose_configuration()
68 num_configs = udev->descriptor.bNumConfigurations; in usb_choose_configuration()
73 if (c->desc.bNumInterfaces > 0) in usb_choose_configuration()
74 desc = &c->intf_cache[0]->altsetting->desc; in usb_choose_configuration()
77 * HP's USB bus-powered keyboard has only one configuration in usb_choose_configuration()
78 * and it claims to be self-powered; other devices may have in usb_choose_configuration()
88 * have any other way to tell whether a device is self-powered, in usb_choose_configuration()
97 /* Rule out self-powered configs for a bus-powered device */ in usb_choose_configuration()
98 if (bus_powered && (c->desc.bmAttributes & in usb_choose_configuration()
106 * to be self-powered when they are really bus-powered. in usb_choose_configuration()
116 if (usb_get_max_power(udev, c) > udev->bus_mA) { in usb_choose_configuration()
147 * pet nonstandard Ethernet-over-USB protocols, ignore it unless in usb_choose_configuration()
161 * first interface is for a non-vendor-specific class. in usb_choose_configuration()
163 * than a vendor-specific driver. */ in usb_choose_configuration()
164 else if (udev->descriptor.bDeviceClass != in usb_choose_configuration()
166 (desc && desc->bInterfaceClass != in usb_choose_configuration()
172 /* If all the remaining configs are vendor-specific, in usb_choose_configuration()
179 dev_info(&udev->dev, "rejected %d configuration%s " in usb_choose_configuration()
184 i = best->desc.bConfigurationValue; in usb_choose_configuration()
185 dev_dbg(&udev->dev, in usb_choose_configuration()
189 i = -1; in usb_choose_configuration()
190 dev_warn(&udev->dev, in usb_choose_configuration()
213 if (udev->use_generic_driver) in usb_generic_driver_match()
233 if (udev->authorized == 0) in usb_generic_driver_probe()
234 dev_err(&udev->dev, "Device is not authorized for usage\n"); in usb_generic_driver_probe()
239 if (err && err != -ENODEV) { in usb_generic_driver_probe()
240 dev_err(&udev->dev, "can't set config #%d, error %d\n", in usb_generic_driver_probe()
259 if (udev->actconfig) in usb_generic_driver_disconnect()
260 usb_set_configuration(udev, -1); in usb_generic_driver_disconnect()
271 * so we have to shut down their downstream HC-to-USB in usb_generic_driver_suspend()
274 if (!udev->parent) in usb_generic_driver_suspend()
278 * Non-root USB2 devices don't need to do anything for FREEZE in usb_generic_driver_suspend()
283 && (udev->speed < USB_SPEED_SUPER)) in usb_generic_driver_suspend()
299 * so we have to start up their downstream HC-to-USB in usb_generic_driver_resume()
302 if (!udev->parent) in usb_generic_driver_resume()