int usb_acpi_port_lpm_incapable(struct usb_device *hdev, int index)
{ union acpi_object *obj;
acpi_handle port_handle; int port1 = index + 1;
guid_t guid; int ret;
ret = guid_parse(UUID_USB_CONTROLLER_DSM, &guid); if (ret) return ret;
port_handle = usb_get_hub_port_acpi_handle(hdev, port1); if (!port_handle) {
dev_dbg(&hdev->dev, "port-%d no acpi handle\n", port1); return -ENODEV;
}
if (!acpi_check_dsm(port_handle, &guid, 0,
BIT(USB_DSM_DISABLE_U1_U2_FOR_PORT))) {
dev_dbg(&hdev->dev, "port-%d no _DSM function %d\n",
port1, USB_DSM_DISABLE_U1_U2_FOR_PORT); return -ENODEV;
}
/** *usb_acpi_set_power_state-controlusbport'spowerviaacpipower *resource *@hdev:USBdevicebelongingtotheusbhub *@index:portindexbasedzero *@enable:powerstateexpectedtobeset * *Noticetouseusb_acpi_power_manageable()tocheckwhethertheusbport *hasacpipowerresourcebeforeinvokingthisfunction. * *Returns0onsuccess,elsenegativeerrno.
*/ int usb_acpi_set_power_state(struct usb_device *hdev, int index, bool enable)
{ struct usb_hub *hub = usb_hub_to_struct_hub(hdev); struct usb_port *port_dev;
acpi_handle port_handle; unsignedchar state; int port1 = index + 1; int error = -EINVAL;
if (!hub) return -ENODEV;
port_dev = hub->ports[port1 - 1];
port_handle = (acpi_handle) usb_get_hub_port_acpi_handle(hdev, port1); if (!port_handle) return error;
if (enable)
state = ACPI_STATE_D0; else
state = ACPI_STATE_D3_COLD;
error = acpi_bus_set_power(port_handle, state); if (!error)
dev_dbg(&port_dev->dev, "acpi: power was set to %d\n", enable); else
dev_dbg(&port_dev->dev, "acpi: power failed to be set\n");
if (IS_ERR(nhi_fwnode) || !nhi_fwnode->dev) return0;
link = device_link_add(&port_dev->child->dev, nhi_fwnode->dev,
DL_FLAG_STATELESS |
DL_FLAG_RPM_ACTIVE |
DL_FLAG_PM_RUNTIME); if (!link) {
dev_err(&port_dev->dev, "Failed to created device link from %s to %s\n",
dev_name(&port_dev->child->dev), dev_name(nhi_fwnode->dev)); return -EINVAL;
}
dev_dbg(&port_dev->dev, "Created device link from %s to %s\n",
dev_name(&port_dev->child->dev), dev_name(nhi_fwnode->dev));
hub = usb_hub_to_struct_hub(udev->parent); if (!hub) return NULL;
/* Tunneled USB3 devices depend on USB4 Host Interface, set device link to it */ if (udev->speed >= USB_SPEED_SUPER &&
udev->tunnel_mode != USB_LINK_NATIVE)
usb_acpi_add_usb4_devlink(udev);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.