Skip to content

Commit 043ae13

Browse files
ranj063broonie
authored andcommitted
ASoC: SOF: Add system_suspend_target field to struct snd_sof_dev
Add the system_suspend_target field to struct snd_sof_dev to track the intended system suspend power target. This will be used as one of the criteria for determining the final DSP power state. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200129220726.31792-4-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent fb9a811 commit 043ae13

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

‎sound/soc/sof/intel/hda-dsp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ int hda_dsp_resume(struct snd_sof_dev *sdev)
481481
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
482482
struct pci_dev *pci = to_pci_dev(sdev->dev);
483483

484-
if (sdev->s0_suspend) {
484+
if (sdev->system_suspend_target == SOF_SUSPEND_S0IX) {
485485
/* restore L1SEN bit */
486486
if (hda->l1_support_changed)
487487
snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
@@ -530,7 +530,7 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev)
530530
struct pci_dev *pci = to_pci_dev(sdev->dev);
531531
int ret;
532532

533-
if (sdev->s0_suspend) {
533+
if (sdev->system_suspend_target == SOF_SUSPEND_S0IX) {
534534
/* enable L1SEN to make sure the system can enter S0Ix */
535535
hda->l1_support_changed =
536536
snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,

‎sound/soc/sof/pcm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
372372
stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_START;
373373
break;
374374
case SNDRV_PCM_TRIGGER_SUSPEND:
375-
if (sdev->s0_suspend &&
375+
if (sdev->system_suspend_target == SOF_SUSPEND_S0IX &&
376376
spcm->stream[substream->stream].d0i3_compatible) {
377377
/*
378378
* trap the event, not sending trigger stop to

‎sound/soc/sof/pm.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,13 @@ int snd_sof_prepare(struct device *dev)
323323
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
324324

325325
#if defined(CONFIG_ACPI)
326-
sdev->s0_suspend = acpi_target_system_state() == ACPI_STATE_S0;
326+
if (acpi_target_system_state() == ACPI_STATE_S0)
327+
sdev->system_suspend_target = SOF_SUSPEND_S0IX;
328+
else
329+
sdev->system_suspend_target = SOF_SUSPEND_S3;
327330
#else
328331
/* will suspend to S3 by default */
329-
sdev->s0_suspend = false;
332+
sdev->system_suspend_target = SOF_SUSPEND_S3;
330333
#endif
331334

332335
return 0;
@@ -337,6 +340,6 @@ void snd_sof_complete(struct device *dev)
337340
{
338341
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
339342

340-
sdev->s0_suspend = false;
343+
sdev->system_suspend_target = SOF_SUSPEND_NONE;
341344
}
342345
EXPORT_SYMBOL(snd_sof_complete);

‎sound/soc/sof/sof-priv.h‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ enum sof_d0_substate {
6060
SOF_DSP_D0I3, /* DSP D0i3(low power) substate*/
6161
};
6262

63+
/* System suspend target state */
64+
enum sof_system_suspend_state {
65+
SOF_SUSPEND_NONE = 0,
66+
SOF_SUSPEND_S0IX,
67+
SOF_SUSPEND_S3,
68+
};
69+
6370
struct snd_sof_dev;
6471
struct snd_sof_ipc_msg;
6572
struct snd_sof_ipc;
@@ -325,8 +332,9 @@ struct snd_sof_dev {
325332

326333
/* power states related */
327334
enum sof_d0_substate d0_substate;
328-
/* flag to track if the intended power target of suspend is S0ix */
329-
bool s0_suspend;
335+
336+
/* Intended power target of system suspend */
337+
enum sof_system_suspend_state system_suspend_target;
330338

331339
/* DSP firmware boot */
332340
wait_queue_head_t boot_wait;

0 commit comments

Comments
 (0)