Lines Matching +full:zero +full:- +full:based
1 // SPDX-License-Identifier: GPL-2.0
3 * USB-ACPI glue code
19 * usb_acpi_power_manageable - check whether usb port has
22 * @index: port index based zero
40 #define UUID_USB_CONTROLLER_DSM "ce2ee385-00e6-48cb-9f05-2edb927c4899"
44 * usb_acpi_port_lpm_incapable - check if lpm should be disabled for a port.
46 * @index: zero based port index
51 * Arg0: UUID = ce2ee385-00e6-48cb-9f05-2edb927c4899
73 dev_dbg(&hdev->dev, "port-%d no acpi handle\n", port1); in usb_acpi_port_lpm_incapable()
74 return -ENODEV; in usb_acpi_port_lpm_incapable()
79 dev_dbg(&hdev->dev, "port-%d no _DSM function %d\n", in usb_acpi_port_lpm_incapable()
81 return -ENODEV; in usb_acpi_port_lpm_incapable()
88 dev_dbg(&hdev->dev, "evaluate port-%d _DSM failed\n", port1); in usb_acpi_port_lpm_incapable()
89 return -EINVAL; in usb_acpi_port_lpm_incapable()
92 if (obj->integer.value == 0x01) in usb_acpi_port_lpm_incapable()
102 * usb_acpi_set_power_state - control usb port's power via acpi power
105 * @index: port index based zero
120 int error = -EINVAL; in usb_acpi_set_power_state()
123 return -ENODEV; in usb_acpi_set_power_state()
124 port_dev = hub->ports[port1 - 1]; in usb_acpi_set_power_state()
137 dev_dbg(&port_dev->dev, "acpi: power was set to %d\n", enable); in usb_acpi_set_power_state()
139 dev_dbg(&port_dev->dev, "acpi: power failed to be set\n"); in usb_acpi_set_power_state()
158 * a usb device is directly hard-wired to the port. If no visible and in usb_acpi_get_connect_type()
166 if (!upc || (upc->type != ACPI_TYPE_PACKAGE) || upc->package.count != 4) in usb_acpi_get_connect_type()
169 if (upc->package.elements[0].integer.value) in usb_acpi_get_connect_type()
170 if (pld->user_visible) in usb_acpi_get_connect_type()
174 else if (!pld->user_visible) in usb_acpi_get_connect_type()
183 * Private to usb-acpi, all the core needs to know is that
184 * port_dev->location is non-zero when it has been set by the firmware.
197 udev = to_usb_device(port_dev->dev.parent->parent); in usb_acpi_get_companion_for_port()
200 * The root hub ports' parent is the root hub. The non-root-hub in usb_acpi_get_companion_for_port()
204 if (!udev->parent) { in usb_acpi_get_companion_for_port()
205 adev = ACPI_COMPANION(&udev->dev); in usb_acpi_get_companion_for_port()
206 port1 = usb_hcd_find_raw_port_number(bus_to_hcd(udev->bus), in usb_acpi_get_companion_for_port()
207 port_dev->portnum); in usb_acpi_get_companion_for_port()
209 parent_handle = usb_get_hub_port_acpi_handle(udev->parent, in usb_acpi_get_companion_for_port()
210 udev->portnum); in usb_acpi_get_companion_for_port()
215 port1 = port_dev->portnum; in usb_acpi_get_companion_for_port()
233 handle = adev->handle; in usb_acpi_find_companion_for_port()
236 port_dev->location = USB_ACPI_LOCATION_VALID in usb_acpi_find_companion_for_port()
237 | pld->group_token << 8 | pld->group_position; in usb_acpi_find_companion_for_port()
238 port_dev->connect_type = usb_acpi_get_connect_type(handle, pld); in usb_acpi_find_companion_for_port()
252 if (!udev->parent) { in usb_acpi_find_companion_for_device()
257 adev = ACPI_COMPANION(udev->bus->sysdev); in usb_acpi_find_companion_for_device()
261 hub = usb_hub_to_struct_hub(udev->parent); in usb_acpi_find_companion_for_device()
269 port_dev = hub->ports[udev->portnum - 1]; in usb_acpi_find_companion_for_device()