ASoC: SOF: Intel: make DMI L1 selection more robust

Exposing the DMI L1 configuration as a kernel Kconfig option was in
hindsight a really bad idea. It led to several errors reported by
distributions which selected it by mistake.

The Kconfig is now replaced with a kernel parameter. Since DMI L1
entry is incompatible with pause on a capture stream, the latter is
disabled when the kernel parameter is set.

Experimental results show an increased residency in higher C states
and a significant decrease of system power consumption for "work from
home" usages such as VoIP calls.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20210812231940.172547-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Pierre-Louis Bossart 2021-08-12 18:19:40 -05:00 committed by Mark Brown
parent 5503e938fe
commit 246dd4287d
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 14 additions and 13 deletions

View File

@ -249,16 +249,6 @@ config SND_SOC_SOF_HDA_PROBES
Say Y if you want to enable probes. Say Y if you want to enable probes.
If unsure, select "N". If unsure, select "N".
config SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1
bool "SOF Intel-HDA enable DMI Link L1"
help
This option enables DMI L1 for both playback and capture
and disables known workarounds for specific HDAudio platforms.
Only use to look into power optimizations on platforms not
affected by DMI L1 issues. This option is not recommended.
Say Y if you want to enable DMI Link L1.
If unsure, select "N".
endif ## SND_SOC_SOF_HDA_COMMON endif ## SND_SOC_SOF_HDA_COMMON
config SND_SOC_SOF_HDA_LINK_BASELINE config SND_SOC_SOF_HDA_LINK_BASELINE

View File

@ -15,6 +15,7 @@
* Hardware interface for generic Intel audio DSP HDA IP * Hardware interface for generic Intel audio DSP HDA IP
*/ */
#include <linux/moduleparam.h>
#include <sound/hda_register.h> #include <sound/hda_register.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include "../sof-audio.h" #include "../sof-audio.h"
@ -27,6 +28,10 @@
#define SDnFMT_BITS(x) ((x) << 4) #define SDnFMT_BITS(x) ((x) << 4)
#define SDnFMT_CHAN(x) ((x) << 0) #define SDnFMT_CHAN(x) ((x) << 0)
static bool hda_always_enable_dmi_l1;
module_param_named(always_enable_dmi_l1, hda_always_enable_dmi_l1, bool, 0444);
MODULE_PARM_DESC(always_enable_dmi_l1, "SOF HDA always enable DMI l1");
u32 hda_dsp_get_mult_div(struct snd_sof_dev *sdev, int rate) u32 hda_dsp_get_mult_div(struct snd_sof_dev *sdev, int rate)
{ {
switch (rate) { switch (rate) {
@ -216,6 +221,7 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream) struct snd_pcm_substream *substream)
{ {
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_component *scomp = sdev->component; struct snd_soc_component *scomp = sdev->component;
struct hdac_ext_stream *dsp_stream; struct hdac_ext_stream *dsp_stream;
struct snd_sof_pcm *spcm; struct snd_sof_pcm *spcm;
@ -228,9 +234,14 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
return -EINVAL; return -EINVAL;
} }
/* All playback and D0i3 compatible streams are DMI L1 capable */ /*
if (IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1) || * All playback streams are DMI L1 capable, capture streams need
direction == SNDRV_PCM_STREAM_PLAYBACK || * pause push/release to be disabled
*/
if (hda_always_enable_dmi_l1 && direction == SNDRV_PCM_STREAM_CAPTURE)
runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE;
if (hda_always_enable_dmi_l1 ||
spcm->stream[substream->stream].d0i3_compatible) spcm->stream[substream->stream].d0i3_compatible)
flags |= SOF_HDA_STREAM_DMI_L1_COMPATIBLE; flags |= SOF_HDA_STREAM_DMI_L1_COMPATIBLE;