ASoC: SOF: Intel: make DMI L1 selection more robust
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 12 Aug 2021 23:19:40 +0000 (18:19 -0500)
committerMark Brown <broonie@kernel.org>
Fri, 13 Aug 2021 12:16:16 +0000 (13:16 +0100)
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>
sound/soc/sof/intel/Kconfig
sound/soc/sof/intel/hda-pcm.c

index ef8cf95..88b6176 100644 (file)
@@ -249,16 +249,6 @@ config SND_SOC_SOF_HDA_PROBES
          Say Y if you want to enable probes.
          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
 
 config SND_SOC_SOF_HDA_LINK_BASELINE
index 59220fa..cc8ddef 100644 (file)
@@ -15,6 +15,7 @@
  * Hardware interface for generic Intel audio DSP HDA IP
  */
 
+#include <linux/moduleparam.h>
 #include <sound/hda_register.h>
 #include <sound/pcm_params.h>
 #include "../sof-audio.h"
 #define SDnFMT_BITS(x) ((x) << 4)
 #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)
 {
        switch (rate) {
@@ -216,6 +221,7 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
                     struct snd_pcm_substream *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 hdac_ext_stream *dsp_stream;
        struct snd_sof_pcm *spcm;
@@ -228,9 +234,14 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
                return -EINVAL;
        }
 
-       /* All playback and D0i3 compatible streams are DMI L1 capable */
-       if (IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1) ||
-           direction == SNDRV_PCM_STREAM_PLAYBACK ||
+       /*
+        * All playback streams are DMI L1 capable, capture streams need
+        * 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)
                flags |= SOF_HDA_STREAM_DMI_L1_COMPATIBLE;