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()
146 * usb_acpi_add_usb4_devlink - add device link to USB4 Host Interface for tunneled USB3 devices
164 if (!udev->parent || udev->parent->parent) in usb_acpi_add_usb4_devlink()
167 hub = usb_hub_to_struct_hub(udev->parent); in usb_acpi_add_usb4_devlink()
168 port_dev = hub->ports[udev->portnum - 1]; in usb_acpi_add_usb4_devlink()
171 fwnode_find_reference(dev_fwnode(&port_dev->dev), "usb4-host-interface", 0); in usb_acpi_add_usb4_devlink()
173 if (IS_ERR(nhi_fwnode) || !nhi_fwnode->dev) in usb_acpi_add_usb4_devlink()
176 link = device_link_add(&port_dev->child->dev, nhi_fwnode->dev, in usb_acpi_add_usb4_devlink()
181 dev_err(&port_dev->dev, "Failed to created device link from %s to %s\n", in usb_acpi_add_usb4_devlink()
182 dev_name(&port_dev->child->dev), dev_name(nhi_fwnode->dev)); in usb_acpi_add_usb4_devlink()
183 return -EINVAL; in usb_acpi_add_usb4_devlink()
186 dev_dbg(&port_dev->dev, "Created device link from %s to %s\n", in usb_acpi_add_usb4_devlink()
187 dev_name(&port_dev->child->dev), dev_name(nhi_fwnode->dev)); in usb_acpi_add_usb4_devlink()
193 * Private to usb-acpi, all the core needs to know is that
194 * port_dev->location is non-zero when it has been set by the firmware.
212 * a usb device is directly hard-wired to the port. If no visible and in usb_acpi_get_connect_type()
218 port_dev->location = USB_ACPI_LOCATION_VALID | in usb_acpi_get_connect_type()
219 pld->group_token << 8 | pld->group_position; in usb_acpi_get_connect_type()
226 if (!upc || (upc->type != ACPI_TYPE_PACKAGE) || upc->package.count != 4) in usb_acpi_get_connect_type()
230 if (upc->package.elements[0].integer.value) in usb_acpi_get_connect_type()
233 else if (pld->user_visible) in usb_acpi_get_connect_type()
240 port_dev->connect_type = connect_type; in usb_acpi_get_connect_type()
254 udev = to_usb_device(port_dev->dev.parent->parent); in usb_acpi_get_companion_for_port()
257 * The root hub ports' parent is the root hub. The non-root-hub in usb_acpi_get_companion_for_port()
261 if (!udev->parent) { in usb_acpi_get_companion_for_port()
262 adev = ACPI_COMPANION(&udev->dev); in usb_acpi_get_companion_for_port()
263 port1 = usb_hcd_find_raw_port_number(bus_to_hcd(udev->bus), in usb_acpi_get_companion_for_port()
264 port_dev->portnum); in usb_acpi_get_companion_for_port()
266 parent_handle = usb_get_hub_port_acpi_handle(udev->parent, in usb_acpi_get_companion_for_port()
267 udev->portnum); in usb_acpi_get_companion_for_port()
272 port1 = port_dev->portnum; in usb_acpi_get_companion_for_port()
287 usb_acpi_get_connect_type(port_dev, adev->handle); in usb_acpi_find_companion_for_port()
299 if (!udev->parent) { in usb_acpi_find_companion_for_device()
304 adev = ACPI_COMPANION(udev->bus->sysdev); in usb_acpi_find_companion_for_device()
308 hub = usb_hub_to_struct_hub(udev->parent); in usb_acpi_find_companion_for_device()
314 if (udev->speed >= USB_SPEED_SUPER && in usb_acpi_find_companion_for_device()
315 udev->tunnel_mode != USB_LINK_NATIVE) in usb_acpi_find_companion_for_device()
322 port_dev = hub->ports[udev->portnum - 1]; in usb_acpi_find_companion_for_device()