// SPDX-License-Identifier: GPL-2.0 /* * USB-ACPI glue code * * Copyright 2012 Red Hat <[email protected]> */ #include <linux/module.h> #include <linux/usb.h> #include <linux/device.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/acpi.h> #include <linux/pci.h> #include <linux/usb/hcd.h> #include "hub.h" /** * usb_acpi_power_manageable - check whether usb port has * acpi power resource. * @hdev: USB device belonging to the usb hub * @index: port index based zero * * Return true if the port has acpi power resource and false if no. */ bool usb_acpi_power_manageable(struct usb_device *hdev, int index) { … } EXPORT_SYMBOL_GPL(…); #define UUID_USB_CONTROLLER_DSM … #define USB_DSM_DISABLE_U1_U2_FOR_PORT … /** * usb_acpi_port_lpm_incapable - check if lpm should be disabled for a port. * @hdev: USB device belonging to the usb hub * @index: zero based port index * * Some USB3 ports may not support USB3 link power management U1/U2 states * due to different retimer setup. ACPI provides _DSM method which returns 0x01 * if U1 and U2 states should be disabled. Evaluate _DSM with: * Arg0: UUID = ce2ee385-00e6-48cb-9f05-2edb927c4899 * Arg1: Revision ID = 0 * Arg2: Function Index = 5 * Arg3: (empty) * * Return 1 if USB3 port is LPM incapable, negative on error, otherwise 0 */ int usb_acpi_port_lpm_incapable(struct usb_device *hdev, int index) { … } EXPORT_SYMBOL_GPL(…); /** * usb_acpi_set_power_state - control usb port's power via acpi power * resource * @hdev: USB device belonging to the usb hub * @index: port index based zero * @enable: power state expected to be set * * Notice to use usb_acpi_power_manageable() to check whether the usb port * has acpi power resource before invoking this function. * * Returns 0 on success, else negative errno. */ int usb_acpi_set_power_state(struct usb_device *hdev, int index, bool enable) { … } EXPORT_SYMBOL_GPL(…); /* * Private to usb-acpi, all the core needs to know is that * port_dev->location is non-zero when it has been set by the firmware. */ #define USB_ACPI_LOCATION_VALID … static void usb_acpi_get_connect_type(struct usb_port *port_dev, acpi_handle *handle) { … } static struct acpi_device * usb_acpi_get_companion_for_port(struct usb_port *port_dev) { … } static struct acpi_device * usb_acpi_find_companion_for_port(struct usb_port *port_dev) { … } static struct acpi_device * usb_acpi_find_companion_for_device(struct usb_device *udev) { … } static struct acpi_device *usb_acpi_find_companion(struct device *dev) { … } static bool usb_acpi_bus_match(struct device *dev) { … } static struct acpi_bus_type usb_acpi_bus = …; int usb_acpi_register(void) { … } void usb_acpi_unregister(void) { … }