Skip to content

Commit 43437d0

Browse files
dbalutabroonie
authored andcommitted
ASoC: SOF: pm: Fix prepare callback behavior for OF usecase
On i.MX platforms PM is not managed via ACPI although CONFIG_ACPI can be set. So, in order to correctly set the system target state we introduce a flag for platforms that require to use acpi target states. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20200921105038.2909899-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 6410887 commit 43437d0

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎include/sound/sof.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ struct sof_dev_desc {
6666
/* alternate list of machines using this configuration */
6767
struct snd_soc_acpi_mach *alt_machines;
6868

69+
bool use_acpi_target_states;
70+
6971
/* Platform resource indexes in BAR / ACPI resources. */
7072
/* Must set to -1 if not used - add new items to end */
7173
int resindex_lpe_base;

‎sound/soc/sof/pm.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,17 @@ EXPORT_SYMBOL(snd_sof_suspend);
305305
int snd_sof_prepare(struct device *dev)
306306
{
307307
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
308+
const struct sof_dev_desc *desc = sdev->pdata->desc;
309+
310+
/* will suspend to S3 by default */
311+
sdev->system_suspend_target = SOF_SUSPEND_S3;
312+
313+
if (!desc->use_acpi_target_states)
314+
return 0;
308315

309316
#if defined(CONFIG_ACPI)
310317
if (acpi_target_system_state() == ACPI_STATE_S0)
311318
sdev->system_suspend_target = SOF_SUSPEND_S0IX;
312-
else
313-
sdev->system_suspend_target = SOF_SUSPEND_S3;
314-
#else
315-
/* will suspend to S3 by default */
316-
sdev->system_suspend_target = SOF_SUSPEND_S3;
317319
#endif
318320

319321
return 0;

‎sound/soc/sof/sof-pci-dev.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ static const struct dmi_system_id community_key_platforms[] = {
7777
#if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
7878
static const struct sof_dev_desc bxt_desc = {
7979
.machines = snd_soc_acpi_intel_bxt_machines,
80+
.use_acpi_target_states = true,
8081
.resindex_lpe_base = 0,
8182
.resindex_pcicfg_base = -1,
8283
.resindex_imr_base = -1,
@@ -94,6 +95,7 @@ static const struct sof_dev_desc bxt_desc = {
9495
#if IS_ENABLED(CONFIG_SND_SOC_SOF_GEMINILAKE)
9596
static const struct sof_dev_desc glk_desc = {
9697
.machines = snd_soc_acpi_intel_glk_machines,
98+
.use_acpi_target_states = true,
9799
.resindex_lpe_base = 0,
98100
.resindex_pcicfg_base = -1,
99101
.resindex_imr_base = -1,
@@ -139,6 +141,7 @@ static const struct sof_dev_desc tng_desc = {
139141
static const struct sof_dev_desc cnl_desc = {
140142
.machines = snd_soc_acpi_intel_cnl_machines,
141143
.alt_machines = snd_soc_acpi_intel_cnl_sdw_machines,
144+
.use_acpi_target_states = true,
142145
.resindex_lpe_base = 0,
143146
.resindex_pcicfg_base = -1,
144147
.resindex_imr_base = -1,
@@ -157,6 +160,7 @@ static const struct sof_dev_desc cnl_desc = {
157160
static const struct sof_dev_desc cfl_desc = {
158161
.machines = snd_soc_acpi_intel_cfl_machines,
159162
.alt_machines = snd_soc_acpi_intel_cfl_sdw_machines,
163+
.use_acpi_target_states = true,
160164
.resindex_lpe_base = 0,
161165
.resindex_pcicfg_base = -1,
162166
.resindex_imr_base = -1,
@@ -175,6 +179,7 @@ static const struct sof_dev_desc cfl_desc = {
175179
static const struct sof_dev_desc cml_desc = {
176180
.machines = snd_soc_acpi_intel_cml_machines,
177181
.alt_machines = snd_soc_acpi_intel_cml_sdw_machines,
182+
.use_acpi_target_states = true,
178183
.resindex_lpe_base = 0,
179184
.resindex_pcicfg_base = -1,
180185
.resindex_imr_base = -1,
@@ -193,6 +198,7 @@ static const struct sof_dev_desc cml_desc = {
193198
static const struct sof_dev_desc icl_desc = {
194199
.machines = snd_soc_acpi_intel_icl_machines,
195200
.alt_machines = snd_soc_acpi_intel_icl_sdw_machines,
201+
.use_acpi_target_states = true,
196202
.resindex_lpe_base = 0,
197203
.resindex_pcicfg_base = -1,
198204
.resindex_imr_base = -1,
@@ -211,6 +217,7 @@ static const struct sof_dev_desc icl_desc = {
211217
static const struct sof_dev_desc tgl_desc = {
212218
.machines = snd_soc_acpi_intel_tgl_machines,
213219
.alt_machines = snd_soc_acpi_intel_tgl_sdw_machines,
220+
.use_acpi_target_states = true,
214221
.resindex_lpe_base = 0,
215222
.resindex_pcicfg_base = -1,
216223
.resindex_imr_base = -1,
@@ -244,6 +251,7 @@ static const struct sof_dev_desc tglh_desc = {
244251
#if IS_ENABLED(CONFIG_SND_SOC_SOF_ELKHARTLAKE)
245252
static const struct sof_dev_desc ehl_desc = {
246253
.machines = snd_soc_acpi_intel_ehl_machines,
254+
.use_acpi_target_states = true,
247255
.resindex_lpe_base = 0,
248256
.resindex_pcicfg_base = -1,
249257
.resindex_imr_base = -1,
@@ -261,6 +269,7 @@ static const struct sof_dev_desc ehl_desc = {
261269
#if IS_ENABLED(CONFIG_SND_SOC_SOF_JASPERLAKE)
262270
static const struct sof_dev_desc jsl_desc = {
263271
.machines = snd_soc_acpi_intel_jsl_machines,
272+
.use_acpi_target_states = true,
264273
.resindex_lpe_base = 0,
265274
.resindex_pcicfg_base = -1,
266275
.resindex_imr_base = -1,

0 commit comments

Comments
 (0)