mb/google/rex/var/rex0: Change touch over spi interrupt trigger to edge

This CL corrects the trigger for HID over SPI from Level to Edge.

BUG:None
TEST:Tested with I2C and SPI

Change-Id: I78937af22df22d80a702477b6790a7aa40d782a4
Signed-off-by: Eran Mitrani <mitrani@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76116
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
diff --git a/src/mainboard/google/rex/variants/rex0/fw_config.c b/src/mainboard/google/rex/variants/rex0/fw_config.c
index 416b476..b3958b0 100644
--- a/src/mainboard/google/rex/variants/rex0/fw_config.c
+++ b/src/mainboard/google/rex/variants/rex0/fw_config.c
@@ -89,6 +89,16 @@
 	PAD_CFG_NF(GPP_F22, NONE, DEEP, NF8),
 };
 
+static const struct pad_config touchscreen_i2c_int_pads[] = {
+	/* GPP_C07 : [] ==> SOC_TCHSCR_INT */
+	PAD_CFG_GPI_APIC(GPP_C07, NONE, PLTRST, LEVEL, NONE),
+};
+
+static const struct pad_config touchscreen_spi_int_pads[] = {
+	/* GPP_C07 : [] ==> SOC_TCHSCR_INT */
+	PAD_CFG_GPI_APIC(GPP_C07, NONE, PLTRST, EDGE_SINGLE, INVERT),
+};
+
 void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
 {
 	if (!fw_config_is_provisioned()) {
@@ -121,4 +131,12 @@
 		printk(BIOS_INFO, "Configure GPIOs for ISH.\n");
 		GPIO_PADBASED_OVERRIDE(padbased_table, ish_enable_pads);
 	}
+
+	if (fw_config_probe(FW_CONFIG(TOUCHSCREEN, TOUCHSCREEN_I2C))) {
+		printk(BIOS_INFO, "Configure Touchscreen Interrupt for I2C.\n");
+		GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_i2c_int_pads);
+	} else { /* SPI */
+		printk(BIOS_INFO, "Configure Touchscreen Interrupt for SPI.\n");
+		GPIO_PADBASED_OVERRIDE(padbased_table, touchscreen_spi_int_pads);
+	}
 }
diff --git a/src/mainboard/google/rex/variants/rex0/gpio.c b/src/mainboard/google/rex/variants/rex0/gpio.c
index b30bff4..b4ae756 100644
--- a/src/mainboard/google/rex/variants/rex0/gpio.c
+++ b/src/mainboard/google/rex/variants/rex0/gpio.c
@@ -116,8 +116,6 @@
 	PAD_CFG_GPO(GPP_C05, 1, PLTRST),
 	/* GPP_C06 : [] ==> SOC_TCHSCR_RPT_EN */
 	PAD_CFG_GPO(GPP_C06, 0, DEEP),
-	/* GPP_C07 : [] ==> SOC_TCHSCR_INT */
-	PAD_CFG_GPI_APIC(GPP_C07, NONE, PLTRST, LEVEL, NONE),
 	/* GPP_C08 : [] ==> SOCHOT_ODL */
 	PAD_CFG_NF(GPP_C08, NONE, DEEP, NF2),
 	/* GPP_C09 : net NC is not present in the given design */
diff --git a/src/mainboard/google/rex/variants/rex0/include/variant/acpi/hid_spi_elan.asl b/src/mainboard/google/rex/variants/rex0/include/variant/acpi/hid_spi_elan.asl
index cc8cb935..5421a0a 100644
--- a/src/mainboard/google/rex/variants/rex0/include/variant/acpi/hid_spi_elan.asl
+++ b/src/mainboard/google/rex/variants/rex0/include/variant/acpi/hid_spi_elan.asl
@@ -39,7 +39,7 @@
 			0,			/* ResourceSourceIndex */
 			ResourceConsumer,	/* ResourceUsage */
 		)
-		Interrupt(ResourceConsumer, Level, ActiveLow, Shared)
+		Interrupt(ResourceConsumer, Edge, ActiveLow, Shared)
 		{
 			TOUCH_SCR_IRQ
 		}