[Sound-open-firmware] About sof and D0 D3 states, 'standby' and 'suspend to RAM'

Paul Olaru (OSS) paul.olaru at oss.nxp.com
Thu Apr 23 15:07:53 CEST 2020


I think the high level intent is to only have the DSP on when it's actually doing something, or a little while after in case you want to e.g. play multiple songs in a row. Keeping the DSP off when unused is a power saving measure. And this is done even without the host OS ever entering in a suspend state -- if you just browse the Internet and don't need sound the DSP doesn't need to be on, thus SOF will turn off for that moment and will turn back on as needed -- a notification sound or you starting to play music.

________________________________________
From: Sound-open-firmware <sound-open-firmware-bounces at alsa-project.org> on behalf of josep lladonosa capell <jlladonosa at gmail.com>
Sent: Thursday, April 23, 2020 8:12 AM
To: sound-open-firmware at alsa-project.org
Subject: [Sound-open-firmware] About sof and D0 D3 states,      'standby' and 'suspend to RAM'

Hello,

I have found[1]  that sof driver works (for now?) only two power
states: D0 (DSP ON) and D3 (DSP OFF).
In a laptop with battery, not connected to AC, I have many
"D0->D3->D0" state changes during system operation [3].When entering
into to D0, all firmware is loaded again, DSP set up and so (obvious,
as DSPs where off).

My guess is that this transition happens in a power state transition
lower than Suspend to RAM, i.e., Suspend-to-idle or Standby. [2]

Should not be the transition to D3 state done in a kernel transition
to S3 or higher only (Suspend to RAM, hibernate)?

I have digged into the code and found the debug line in
sound/soc/sof/intel/hda-codec.c:
dev_dbg(bus->dev, "Turning i915 HDAC power %d\n", enable);
and function hda_suspend is in hda-dsp.c:
static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)

Regards,
Josep


[1]: https://thesofproject.github.io/latest/developer_guides/linux_driver/architecture/sof_driver_arch.html#power-management
[2]: https://www.kernel.org/doc/html/v5.6/admin-guide/pm/sleep-states.html#suspend-to-idle
[3]: Log from a session in a laptop working on its battery (only D0 D3
transition debug  lines):
++++++++++++++++++++++++++++
Apr 23 08:06:20 debian kernel: [ 1357.524900] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:06:23 debian kernel: [ 1359.967511] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:06:29 debian kernel: [ 1366.697617] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:06:32 debian kernel: [ 1368.976763] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:07:41 debian kernel: [ 1438.758013] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:07:44 debian kernel: [ 1440.968094] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:08:29 debian kernel: [ 1486.346591] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:08:32 debian kernel: [ 1488.968805] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:08:33 debian kernel: [ 1489.970170] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:08:35 debian kernel: [ 1492.134071] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:09:43 debian kernel: [ 1560.535211] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:09:46 debian kernel: [ 1563.180713] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:11:12 debian kernel: [ 1649.719864] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:11:15 debian kernel: [ 1652.347401] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:11:23 debian kernel: [ 1660.328147] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:11:26 debian kernel: [ 1662.895611] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:11:38 debian kernel: [ 1675.404116] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:11:41 debian kernel: [ 1678.023978] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:11:43 debian kernel: [ 1680.128389] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:11:45 debian kernel: [ 1682.563802] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:11:46 debian kernel: [ 1683.187391] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:11:48 debian kernel: [ 1685.358684] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:11:52 debian kernel: [ 1689.704048] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:11:55 debian kernel: [ 1692.350057] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:11:56 debian kernel: [ 1693.056443] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:11:58 debian kernel: [ 1695.315083] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:12:28 debian kernel: [ 1725.232502] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:12:30 debian kernel: [ 1727.379811] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:12:35 debian kernel: [ 1732.240686] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:12:38 debian kernel: [ 1734.816780] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:12:39 debian kernel: [ 1736.719892] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:12:42 debian kernel: [ 1739.340736] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:12:51 debian kernel: [ 1748.048546] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
Apr 23 08:12:53 debian kernel: [ 1750.688659] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 0
Apr 23 08:12:58 debian kernel: [ 1755.075835] sof-audio-pci
0000:00:1f.3: Turning i915 HDAC power 1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
_______________________________________________
Sound-open-firmware mailing list
Sound-open-firmware at alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware


More information about the Sound-open-firmware mailing list