From bb8730d8837530b2fac096c33d2cd4f7ebd86cc1 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 5 Jun 2024 17:31:12 +0300 Subject: [PATCH] ASoC: SOF: Intel: hda-pcm: Follow the pause_supported flag to drop PAUSE support If the stream's pause_supported flag is false then mask out the PAUSE support so user space will be prevented to use it. Introduce a module parameter to ignore the pause_supported flag, named as force_pause_support to allow testing of the PAUSE feature. Signed-off-by: Peter Ujfalusi --- sound/soc/sof/intel/hda-pcm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c index 9fb8521b896ba0..fec30a0cf26d89 100644 --- a/sound/soc/sof/intel/hda-pcm.c +++ b/sound/soc/sof/intel/hda-pcm.c @@ -37,6 +37,11 @@ static bool hda_disable_rewinds; module_param_named(disable_rewinds, hda_disable_rewinds, bool, 0444); MODULE_PARM_DESC(disable_rewinds, "SOF HDA disable rewinds"); +static bool hda_force_pause_support; +module_param_named(force_pause_support, hda_force_pause_support, bool, 0444); +MODULE_PARM_DESC(force_pause_support, + "SOF HDA ignore pause_supported flag to allow pause operation"); + u32 hda_dsp_get_mult_div(struct snd_sof_dev *sdev, int rate) { switch (rate) { @@ -240,6 +245,14 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev, if (hda_always_enable_dmi_l1 && direction == SNDRV_PCM_STREAM_CAPTURE) runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE; + /* + * Follow the hint (unless a module parameter is set to ignore it) and + * disable the pause push/release support + */ + if (!hda_force_pause_support && + !spcm->stream[substream->stream].pause_supported) + runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE; + if (hda_always_enable_dmi_l1 || direction == SNDRV_PCM_STREAM_PLAYBACK || spcm->stream[substream->stream].d0i3_compatible)