Skip to content

Commit 483e20a

Browse files
committed
Merge series "SOF Fixes for S0iX suspend/resume sequence" from Ranjani Sridharan <[email protected]>:
This set of patches is required for facilitating system S0ix entry when the DSP is in D0I3. This first patch adds the missing CORB/RIRB DMA stop and restart to the suspend/resume sequence along with powering up/down the links. The second patch ensures that the FW traces are disabled when the system enters S0ix with the DSP in D0I3. Marcin Rajwa (2): ASoC: SOF: Intel: fix the suspend procedure to support s0ix entry ASoC: SOF: Intel: disable traces when switching to S0Ix D0I3 sound/soc/sof/intel/hda-dsp.c | 48 ++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) -- 2.25.1
2 parents e35cf9f + 79560b8 commit 483e20a

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

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

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,11 +408,13 @@ static int hda_dsp_set_D0_state(struct snd_sof_dev *sdev,
408408
value = SOF_HDA_VS_D0I3C_I3;
409409

410410
/*
411-
* Trace DMA is disabled by default when the DSP enters D0I3.
412-
* But it can be kept enabled when the DSP enters D0I3 while the
413-
* system is in S0 for debug.
411+
* Trace DMA need to be disabled when the DSP enters
412+
* D0I3 for S0Ix suspend, but it can be kept enabled
413+
* when the DSP enters D0I3 while the system is in S0
414+
* for debug purpose.
414415
*/
415-
if (hda_enable_trace_D0I3_S0 &&
416+
if (!sdev->dtrace_is_supported ||
417+
!hda_enable_trace_D0I3_S0 ||
416418
sdev->system_suspend_target != SOF_SUSPEND_NONE)
417419
flags = HDA_PM_NO_DMA_TRACE;
418420
} else {
@@ -696,12 +698,35 @@ int hda_dsp_resume(struct snd_sof_dev *sdev)
696698
.state = SOF_DSP_PM_D0,
697699
.substate = SOF_HDA_DSP_PM_D0I0,
698700
};
701+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
702+
struct hdac_bus *bus = sof_to_bus(sdev);
703+
struct hdac_ext_link *hlink = NULL;
704+
#endif
699705
int ret;
700706

701707
/* resume from D0I3 */
702708
if (sdev->dsp_power_state.state == SOF_DSP_PM_D0) {
703709
hda_codec_i915_display_power(sdev, true);
704710

711+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
712+
/* power up links that were active before suspend */
713+
list_for_each_entry(hlink, &bus->hlink_list, list) {
714+
if (hlink->ref_count) {
715+
ret = snd_hdac_ext_bus_link_power_up(hlink);
716+
if (ret < 0) {
717+
dev_dbg(sdev->dev,
718+
"error %x in %s: failed to power up links",
719+
ret, __func__);
720+
return ret;
721+
}
722+
}
723+
}
724+
725+
/* set up CORB/RIRB buffers if was on before suspend */
726+
if (bus->cmd_dma_state)
727+
snd_hdac_bus_init_cmd_io(bus);
728+
#endif
729+
705730
/* Set DSP power state */
706731
ret = snd_sof_dsp_set_power_state(sdev, &target_state);
707732
if (ret < 0) {
@@ -808,6 +833,21 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)
808833
HDA_VS_INTEL_EM2_L1SEN,
809834
HDA_VS_INTEL_EM2_L1SEN);
810835

836+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
837+
/* stop the CORB/RIRB DMA if it is On */
838+
if (bus->cmd_dma_state)
839+
snd_hdac_bus_stop_cmd_io(bus);
840+
841+
/* no link can be powered in s0ix state */
842+
ret = snd_hdac_ext_bus_link_power_down_all(bus);
843+
if (ret < 0) {
844+
dev_dbg(sdev->dev,
845+
"error %d in %s: failed to power down links",
846+
ret, __func__);
847+
return ret;
848+
}
849+
#endif
850+
811851
/* enable the system waking up via IPC IRQ */
812852
enable_irq_wake(pci->irq);
813853
pci_save_state(pci);

0 commit comments

Comments
 (0)