drivers/usb/acpi: Add USB _DSM method to enable/disable USB LPM per port
This patch supports projects to use _DSM to control USB3 U1/U2 transition per port. More details can be found in https://web.archive.org/web/20230116084819/https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/usb-device-specific-method---dsm- The ACPI and USB driver of linux kernel need corresponding functions to support this feature. Please see https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/log/?h=port_check_acpi_dsm BUG=b:253402457 TEST=tested on felwinter and found _DSM method is created. Change-Id: Iffb2498e26352a3f120c097c50587324e311e8ba Signed-off-by: Kane Chen <kane.chen@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/71924 Reviewed-by: Kapil Porwal <kapilporwal@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
This commit is contained in:
parent
56d8313925
commit
56e448b8d5
|
@ -47,3 +47,26 @@ void acpigen_write_dsm_i2c_hid(struct dsm_i2c_hid_config *config)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------- End: I2C HID DSM ------------------------- */
|
/* ------------------- End: I2C HID DSM ------------------------- */
|
||||||
|
|
||||||
|
#define USB_DSM_UUID "CE2EE385-00E6-48CB-9F05-2EDB927C4899"
|
||||||
|
|
||||||
|
static void usb_dsm_func5_cb(void *arg)
|
||||||
|
{
|
||||||
|
struct dsm_usb_config *config = arg;
|
||||||
|
acpigen_write_return_byte(config->usb_lpm_incapable);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void (*usb_dsm_callbacks[6])(void *) = {
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
usb_dsm_func5_cb,
|
||||||
|
};
|
||||||
|
|
||||||
|
void acpigen_write_dsm_usb(struct dsm_usb_config *config)
|
||||||
|
{
|
||||||
|
acpigen_write_dsm(USB_DSM_UUID, usb_dsm_callbacks,
|
||||||
|
ARRAY_SIZE(usb_dsm_callbacks), config);
|
||||||
|
}
|
||||||
|
|
|
@ -72,6 +72,12 @@ struct drivers_usb_acpi_config {
|
||||||
* will always return ON.
|
* will always return ON.
|
||||||
*/
|
*/
|
||||||
bool use_gpio_for_status;
|
bool use_gpio_for_status;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generate _DSM method Function 5 to disable USB U1/U2 transition
|
||||||
|
* for a port
|
||||||
|
*/
|
||||||
|
bool usb_lpm_incapable;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Method to get PLD structure from USB device */
|
/* Method to get PLD structure from USB device */
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <acpi/acpi_device.h>
|
#include <acpi/acpi_device.h>
|
||||||
#include <acpi/acpi_pld.h>
|
#include <acpi/acpi_pld.h>
|
||||||
#include <acpi/acpigen.h>
|
#include <acpi/acpigen.h>
|
||||||
|
#include <acpi/acpigen_dsm.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <device/path.h>
|
#include <device/path.h>
|
||||||
|
@ -38,6 +39,7 @@ static void usb_acpi_fill_ssdt_generator(const struct device *dev)
|
||||||
struct drivers_usb_acpi_config *config = dev->chip_info;
|
struct drivers_usb_acpi_config *config = dev->chip_info;
|
||||||
const char *path = acpi_device_path(dev);
|
const char *path = acpi_device_path(dev);
|
||||||
struct acpi_pld pld;
|
struct acpi_pld pld;
|
||||||
|
struct dsm_usb_config usb_cfg;
|
||||||
|
|
||||||
if (!path || !config)
|
if (!path || !config)
|
||||||
return;
|
return;
|
||||||
|
@ -56,6 +58,11 @@ static void usb_acpi_fill_ssdt_generator(const struct device *dev)
|
||||||
else
|
else
|
||||||
printk(BIOS_ERR, "Error retrieving PLD for %s\n", path);
|
printk(BIOS_ERR, "Error retrieving PLD for %s\n", path);
|
||||||
|
|
||||||
|
if (config->usb_lpm_incapable) {
|
||||||
|
usb_cfg.usb_lpm_incapable = 1;
|
||||||
|
acpigen_write_dsm_usb(&usb_cfg);
|
||||||
|
}
|
||||||
|
|
||||||
/* Resources */
|
/* Resources */
|
||||||
if (usb_acpi_add_gpios_to_crs(config) == true) {
|
if (usb_acpi_add_gpios_to_crs(config) == true) {
|
||||||
struct acpi_dp *dsd;
|
struct acpi_dp *dsd;
|
||||||
|
|
|
@ -11,4 +11,9 @@ struct dsm_i2c_hid_config {
|
||||||
|
|
||||||
void acpigen_write_dsm_i2c_hid(struct dsm_i2c_hid_config *config);
|
void acpigen_write_dsm_i2c_hid(struct dsm_i2c_hid_config *config);
|
||||||
|
|
||||||
|
struct dsm_usb_config {
|
||||||
|
uint8_t usb_lpm_incapable;
|
||||||
|
};
|
||||||
|
void acpigen_write_dsm_usb(struct dsm_usb_config *config);
|
||||||
|
|
||||||
#endif /* __ACPI_ACPIGEN_DSM_H__ */
|
#endif /* __ACPI_ACPIGEN_DSM_H__ */
|
||||||
|
|
Loading…
Reference in New Issue