diff options
-rw-r--r-- | src/drivers/usb/acpi/chip.h | 2 | ||||
-rw-r--r-- | src/drivers/usb/acpi/usb_acpi.c | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/drivers/usb/acpi/chip.h b/src/drivers/usb/acpi/chip.h index f3f629abff..6429f13630 100644 --- a/src/drivers/usb/acpi/chip.h +++ b/src/drivers/usb/acpi/chip.h @@ -49,6 +49,8 @@ struct drivers_usb_acpi_config { /* Define a custom physical location for the port */ bool use_custom_pld; struct acpi_pld custom_pld; + + struct acpi_gpio reset_gpio; }; #endif /* __USB_ACPI_CHIP_H__ */ diff --git a/src/drivers/usb/acpi/usb_acpi.c b/src/drivers/usb/acpi/usb_acpi.c index 65f1f82acd..f049e68c22 100644 --- a/src/drivers/usb/acpi/usb_acpi.c +++ b/src/drivers/usb/acpi/usb_acpi.c @@ -23,6 +23,17 @@ #include <string.h> #include "chip.h" +static bool usb_acpi_add_gpios_to_crs(struct drivers_usb_acpi_config *cfg) +{ + /* + * Return false if reset GPIO is not provided. + */ + if (cfg->reset_gpio.pin_count == 0) + return false; + + return true; +} + static void usb_acpi_fill_ssdt_generator(struct device *dev) { struct drivers_usb_acpi_config *config = dev->chip_info; @@ -50,6 +61,21 @@ static void usb_acpi_fill_ssdt_generator(struct device *dev) acpigen_write_pld(&pld); } + /* Resources */ + if (usb_acpi_add_gpios_to_crs(config) == true) { + struct acpi_dp *dsd; + + acpigen_write_name("_CRS"); + acpigen_write_resourcetemplate_header(); + acpi_device_write_gpio(&config->reset_gpio); + acpigen_write_resourcetemplate_footer(); + + dsd = acpi_dp_new_table("_DSD"); + acpi_dp_add_gpio(dsd, "reset-gpio", path, 0, 0, + config->reset_gpio.polarity); + acpi_dp_write(dsd); + } + acpigen_pop_len(); printk(BIOS_INFO, "%s: %s at %s\n", path, |