From dfc6451830e73caa10fc2840d78ba752b038044d Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Wed, 20 Dec 2023 15:34:55 -0700 Subject: [PATCH] soc/intel: Add config to use S3 over S0ix When S0ix support is enabled it is always advertised to the OS that it is the preferred suspend method via the FADT feature flag. This config prevents the feature flag from being set, indicating to the OS that S3 suspend is the preferred sleep method. Test: `/sys/power/mem_sleep` defaults to "deep" on system76/darp8. Change-Id: Ife98166338c5457fb2c7dad81a30e54f487495f6 Signed-off-by: Tim Crawford --- src/soc/intel/alderlake/acpi.c | 2 +- src/soc/intel/alderlake/chip.h | 8 ++++++++ src/soc/intel/cannonlake/acpi.c | 2 +- src/soc/intel/cannonlake/chip.h | 8 ++++++++ src/soc/intel/meteorlake/acpi.c | 2 +- src/soc/intel/meteorlake/chip.h | 8 ++++++++ src/soc/intel/tigerlake/acpi.c | 2 +- src/soc/intel/tigerlake/chip.h | 8 ++++++++ 8 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/soc/intel/alderlake/acpi.c b/src/soc/intel/alderlake/acpi.c index 7687f028dc..9271b6752b 100644 --- a/src/soc/intel/alderlake/acpi.c +++ b/src/soc/intel/alderlake/acpi.c @@ -158,7 +158,7 @@ void soc_fill_fadt(acpi_fadt_t *fadt) fill_fadt_extended_pm_io(fadt); - if (config->s0ix_enable) + if (config->s0ix_enable && !config->prefer_s3_suspend) fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0; } diff --git a/src/soc/intel/alderlake/chip.h b/src/soc/intel/alderlake/chip.h index b1e90fa774..7381144003 100644 --- a/src/soc/intel/alderlake/chip.h +++ b/src/soc/intel/alderlake/chip.h @@ -771,6 +771,14 @@ struct soc_intel_alderlake_config { * Set this to 0 in order to disable hwp scalability tracking. */ bool enable_hwp_scalability_tracking; + + /* + * Used with `s0ix_enable` to indicate S3 is the preferred suspend + * method via the FADT feature flag. + * Default is set to false, using S0ix for suspend. + * Set this to true to indicate to the OS that S3 should be used. + */ + bool prefer_s3_suspend; }; typedef struct soc_intel_alderlake_config config_t; diff --git a/src/soc/intel/cannonlake/acpi.c b/src/soc/intel/cannonlake/acpi.c index 1545d19b5e..4e14256500 100644 --- a/src/soc/intel/cannonlake/acpi.c +++ b/src/soc/intel/cannonlake/acpi.c @@ -157,7 +157,7 @@ void soc_fill_fadt(acpi_fadt_t *fadt) fill_fadt_extended_pm_io(fadt); - if (config->s0ix_enable) + if (config->s0ix_enable && !config->prefer_s3_suspend) fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0; } diff --git a/src/soc/intel/cannonlake/chip.h b/src/soc/intel/cannonlake/chip.h index 994f2aebef..0f6e05a46c 100644 --- a/src/soc/intel/cannonlake/chip.h +++ b/src/soc/intel/cannonlake/chip.h @@ -452,6 +452,14 @@ struct soc_intel_cannonlake_config { bool cpu_turbo_disable; bool disable_vmx; + + /* + * Used with `s0ix_enable` to indicate S3 is the preferred suspend + * method via the FADT feature flag. + * Default is set to false, using S0ix for suspend. + * Set this to true to indicate to the OS that S3 should be used. + */ + bool prefer_s3_suspend; }; typedef struct soc_intel_cannonlake_config config_t; diff --git a/src/soc/intel/meteorlake/acpi.c b/src/soc/intel/meteorlake/acpi.c index ca4e5e1055..1e8ae97a13 100644 --- a/src/soc/intel/meteorlake/acpi.c +++ b/src/soc/intel/meteorlake/acpi.c @@ -159,7 +159,7 @@ void soc_fill_fadt(acpi_fadt_t *fadt) fill_fadt_extended_pm_io(fadt); - if (config->s0ix_enable) + if (config->s0ix_enable && !config->prefer_s3_suspend) fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0; } diff --git a/src/soc/intel/meteorlake/chip.h b/src/soc/intel/meteorlake/chip.h index cfef3c1b51..9932e96c44 100644 --- a/src/soc/intel/meteorlake/chip.h +++ b/src/soc/intel/meteorlake/chip.h @@ -525,6 +525,14 @@ struct soc_intel_meteorlake_config { * as per `enum slew_rate` data type. */ uint8_t slow_slew_rate_config[NUM_VR_DOMAINS]; + + /* + * Used with `s0ix_enable` to indicate S3 is the preferred suspend + * method via the FADT feature flag. + * Default is set to false, using S0ix for suspend. + * Set this to true to indicate to the OS that S3 should be used. + */ + bool prefer_s3_suspend; }; typedef struct soc_intel_meteorlake_config config_t; diff --git a/src/soc/intel/tigerlake/acpi.c b/src/soc/intel/tigerlake/acpi.c index 5c4c838a6f..6abf45a83d 100644 --- a/src/soc/intel/tigerlake/acpi.c +++ b/src/soc/intel/tigerlake/acpi.c @@ -156,7 +156,7 @@ void soc_fill_fadt(acpi_fadt_t *fadt) fill_fadt_extended_pm_io(fadt); - if (config->s0ix_enable) + if (config->s0ix_enable && !config->prefer_s3_suspend) fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0; } diff --git a/src/soc/intel/tigerlake/chip.h b/src/soc/intel/tigerlake/chip.h index 3de8ffaf43..b9650c3295 100644 --- a/src/soc/intel/tigerlake/chip.h +++ b/src/soc/intel/tigerlake/chip.h @@ -533,6 +533,14 @@ struct soc_intel_tigerlake_config { /* i915 struct for GMA backlight control */ struct i915_gpu_controller_info gfx; + + /* + * Used with `s0ix_enable` to indicate S3 is the preferred suspend + * method via the FADT feature flag. + * Default is set to false, using S0ix for suspend. + * Set this to true to indicate to the OS that S3 should be used. + */ + bool prefer_s3_suspend; }; typedef struct soc_intel_tigerlake_config config_t;