drivers/i2c/da7219: Allow GPIO based interrupt

Allow specifying the DA7219 interrupt pin as either an Interrupt or
GpioInt.

BUG=b:72121803
TEST=(with whole patch series) Grunt Kernel discovers DA7219 on i2c0

Change-Id: I2d26731bf4c0ad590dad2c5d26c252371f415f9a
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-on: https://review.coreboot.org/23657
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
This commit is contained in:
Daniel Kurtz 2018-01-29 15:23:39 +05:30 committed by Martin Roth
parent 681bf41087
commit 2bfae02d1d
2 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,9 @@ struct drivers_i2c_da7219_config {
/* Interrupt configuration */
struct acpi_irq irq;
/* Use GPIO based interrupt instead of PIRQ */
struct acpi_gpio irq_gpio;
/* I2C Bus Frequency in Hertz (default 400kHz) */
unsigned bus_speed;

View File

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