diff options
Diffstat (limited to 'src/mainboard/google/rex/mainboard.c')
-rw-r--r-- | src/mainboard/google/rex/mainboard.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/mainboard/google/rex/mainboard.c b/src/mainboard/google/rex/mainboard.c index 2414eddc77..a076ec210d 100644 --- a/src/mainboard/google/rex/mainboard.c +++ b/src/mainboard/google/rex/mainboard.c @@ -1,12 +1,16 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include <acpi/acpi.h> +#include <acpi/acpigen.h> #include <baseboard/variants.h> #include <device/device.h> +#include <drivers/wwan/fm/chip.h> #include <ec/ec.h> #include <fw_config.h> #include <vendorcode/google/chromeos/chromeos.h> +WEAK_DEV_PTR(rp6_wwan); + static void mainboard_init(void *chip_info) { const struct pad_config *pads; @@ -15,9 +19,37 @@ static void mainboard_init(void *chip_info) gpio_configure_pads(pads, num); } +static void mainboard_generate_wwan_shutdown(const struct device *dev) +{ + const struct drivers_wwan_fm_config *config = config_of(dev); + const struct device *parent = dev->bus->dev; + + if (!config) + return; + if (config->rtd3dev) { + acpigen_write_store(); + acpigen_emit_namestring(acpi_device_path_join(parent, "RTD3._STA")); + acpigen_emit_byte(LOCAL0_OP); + acpigen_write_if_lequal_op_int(LOCAL0_OP, ONE_OP); + { + acpigen_emit_namestring(acpi_device_path_join(dev, "DPTS")); + acpigen_emit_byte(ARG0_OP); + } + acpigen_write_if_end(); + } +} + static void mainboard_fill_ssdt(const struct device *dev) { - /* TODO: Add mainboard-specific SSDT entries */ + const struct device *wwan = DEV_PTR(rp6_wwan); + + if (wwan) { + acpigen_write_scope("\\_SB"); + acpigen_write_method_serialized("MPTS", 1); + mainboard_generate_wwan_shutdown(wwan); + acpigen_write_method_end(); /* Method */ + acpigen_write_scope_end(); /* Scope */ + } } static void add_fw_config_oem_string(const struct fw_config *config, void *arg) |