drivers/i2c/nau8825: Support nau8825 for ACPI GPIO descriptors

Add definitions to describe GPIOs in generated ACPI objects.
The method allow either write a GpioInt() or Interrupt() descriptor.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
Change-Id: I37fec7b0b9324dbfb61b7a8bea80f45026c54409
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51922
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Seven Lee 2021-03-29 20:00:41 +08:00 committed by Patrick Georgi
parent 647e2c9029
commit b8159df9fd
2 changed files with 6 additions and 1 deletions

View File

@ -11,6 +11,7 @@
struct drivers_i2c_nau8825_config { struct drivers_i2c_nau8825_config {
/* Interrupt configuration */ /* Interrupt configuration */
struct acpi_irq irq; struct acpi_irq irq;
struct acpi_gpio irq_gpio;
/* I2C Bus Frequency in Hertz (default 400kHz) */ /* I2C Bus Frequency in Hertz (default 400kHz) */
unsigned int bus_speed; unsigned int bus_speed;

View File

@ -47,7 +47,11 @@ static void nau8825_fill_ssdt(const struct device *dev)
acpigen_write_name("_CRS"); acpigen_write_name("_CRS");
acpigen_write_resourcetemplate_header(); acpigen_write_resourcetemplate_header();
acpi_device_write_i2c(&i2c); acpi_device_write_i2c(&i2c);
acpi_device_write_interrupt(&config->irq); /* Allow either GpioInt() or Interrupt() */
if (config->irq_gpio.pin_count)
acpi_device_write_gpio(&config->irq_gpio);
else
acpi_device_write_interrupt(&config->irq);
acpigen_write_resourcetemplate_footer(); acpigen_write_resourcetemplate_footer();
/* Device Properties */ /* Device Properties */