Paweł Anikiel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/78297?usp=email )
Change subject: drivers/wwan/fm: Wake up FM350 from PEWAKE# signal change ......................................................................
drivers/wwan/fm: Wake up FM350 from PEWAKE# signal change
BUG=b:301150499 TEST=Compiled and tested on google/redrix
Change-Id: I32257689da85ea71f9de781093b3ede0cfe70a0e Signed-off-by: Paweł Anikiel panikiel@google.com --- M src/drivers/wwan/fm/acpi_fm350gl.c M src/mainboard/google/brya/variants/redrix/overridetree.cb 2 files changed, 51 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/78297/1
diff --git a/src/drivers/wwan/fm/acpi_fm350gl.c b/src/drivers/wwan/fm/acpi_fm350gl.c index 139fd15..850a10b 100644 --- a/src/drivers/wwan/fm/acpi_fm350gl.c +++ b/src/drivers/wwan/fm/acpi_fm350gl.c @@ -2,6 +2,10 @@
#include <acpi/acpigen.h> #include <acpi/acpi_device.h> +#include <stdio.h> +#if CONFIG(GENERIC_GPIO_LIB) +#include <gpio.h> +#endif #include "chip.h" #include "soc/intel/common/block/include/intelblocks/acpi.h" #include "soc/intel/common/block/pcie/rtd3/chip.h" @@ -263,6 +267,49 @@ return "PXSX"; }
+static void +wwan_fm350gl_acpi_event_interrupts(const struct acpi_gpio *wake_gpio) +{ + acpigen_write_name("_AEI"); + acpigen_write_resourcetemplate_header(); + acpi_device_write_gpio(wake_gpio); + acpigen_write_resourcetemplate_footer(); +} + +static void +wwan_fm350gl_acpi_method_edge_event(const struct device *dev, + const struct acpi_gpio *wake_gpio) +{ + char name[5]; + uint16_t pin; + + pin = wake_gpio->pins[0]; +#if CONFIG(GENERIC_GPIO_LIB) + pin = gpio_acpi_pin(pin); +#endif + snprintf(name, sizeof(name), "_E%02X", pin); + + acpigen_write_method_serialized(name, 0); + acpigen_notify(acpi_device_path(dev), 0x02); /* NOTIFY_DEVICE_WAKE */ + acpigen_write_method_end(); +} + +static void wwan_fm350gl_acpi_gpio_events(const struct device *dev) +{ + const struct drivers_wwan_fm_config *config = config_of(dev); + const struct acpi_gpio *wake_gpio = &config->wake_gpio; + + /* Write into GPIO controller's scope */ +#if CONFIG(GENERIC_GPIO_LIB) + acpigen_write_scope(wake_gpio->resource ? : gpio_acpi_path(wake_gpio->pins[0])); +#else + acpigen_write_scope(wake_gpio->resource); +#endif + wwan_fm350gl_acpi_event_interrupts(wake_gpio); + wwan_fm350gl_acpi_method_edge_event(dev, wake_gpio); + acpigen_write_scope_end(); +} + static void wwan_fm350gl_acpi_fill_ssdt(const struct device *dev) { const struct drivers_wwan_fm_config *config = config_of(dev); @@ -323,6 +370,9 @@ acpigen_write_device_end(); /* Device */ } acpigen_write_scope_end(); /* Scope */ + + if (config->wake_gpio.pin_count) + wwan_fm350gl_acpi_gpio_events(dev); }
static struct device_operations wwan_fm350gl_ops = { diff --git a/src/mainboard/google/brya/variants/redrix/overridetree.cb b/src/mainboard/google/brya/variants/redrix/overridetree.cb index cc4961a..f5556f0 100644 --- a/src/mainboard/google/brya/variants/redrix/overridetree.cb +++ b/src/mainboard/google/brya/variants/redrix/overridetree.cb @@ -238,7 +238,7 @@ register "fcpo_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_F21)" register "reset_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_E16)" register "perst_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_E0)" - register "wake_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A7)" + register "wake_gpio" = "ACPI_GPIO_IRQ_EDGE_LOW(GPP_A7)" register "add_acpi_dma_property" = "true" use rp6_rtd3 as rtd3dev device generic 0 alias rp6_wwan on