mb/google/fatcat: Implement S0ix hooks aka MS0X method

Implemented runtime ASL method (MS0X) being called by PEPD device
_DSM to configure `GPIO_SLP_S0_GATE` PIN at S0ix entry/exit.

Test on francka: GPIO_SLP_S0_GATE (GPP_F23)
Scope (\_SB)
{
    Method (MS0X, 1, Serialized)
    {
        If ((Arg0 == One))
        {
            \_SB.PCI0.CTXS (0x47)
        }
        Else
        {
            \_SB.PCI0.STXS (0x47)
        }
    }
}

BUG=b:399264399
TEST=Run suspend_stress_test on francka and verify that the device can
suspend.

Change-Id: Idd9fcd07ab09f4dc905e4fa029b9b2f897ad015c
Signed-off-by: Ian Feng <ian_feng@compal.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86981
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Dinesh Gehlot <digehlot@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
Ian Feng 2025-03-24 15:36:32 +08:00 committed by Subrata Banik
commit 0fc2422e88

View file

@ -58,6 +58,32 @@ void __weak variant_generate_s0ix_hook(enum s0ix_entry entry)
*/
}
static void mainboard_generate_s0ix_hook(void)
{
acpigen_write_if_lequal_op_int(ARG0_OP, 1);
{
if (CONFIG(HAVE_SLP_S0_GATE))
acpigen_soc_clear_tx_gpio(GPIO_SLP_S0_GATE);
variant_generate_s0ix_hook(S0IX_ENTRY);
}
acpigen_write_else();
{
if (CONFIG(HAVE_SLP_S0_GATE))
acpigen_soc_set_tx_gpio(GPIO_SLP_S0_GATE);
variant_generate_s0ix_hook(S0IX_EXIT);
}
acpigen_write_if_end();
}
static void mainboard_fill_ssdt(const struct device *dev)
{
acpigen_write_scope("\\_SB");
acpigen_write_method_serialized("MS0X", 1);
mainboard_generate_s0ix_hook();
acpigen_write_method_end(); /* Method */
acpigen_write_scope_end(); /* Scope */
}
static void mainboard_dev_init(struct device *dev)
{
mainboard_ec_init();
@ -66,6 +92,7 @@ static void mainboard_dev_init(struct device *dev)
static void mainboard_enable(struct device *dev)
{
dev->ops->init = mainboard_dev_init;
dev->ops->acpi_fill_ssdt = mainboard_fill_ssdt;
}
struct chip_operations mainboard_ops = {