Skip to content

Commit 7c2318b

Browse files
committed
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 <peter.ujfalusi@linux.intel.com>
1 parent c5342a4 commit 7c2318b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ static bool hda_disable_rewinds;
3737
module_param_named(disable_rewinds, hda_disable_rewinds, bool, 0444);
3838
MODULE_PARM_DESC(disable_rewinds, "SOF HDA disable rewinds");
3939

40+
static int hda_force_pause_support = -1;
41+
module_param_named(force_pause_support, hda_force_pause_support, int, 0444);
42+
MODULE_PARM_DESC(force_pause_support,
43+
"Pause support: -1: Use default, 0: Disable, 1: Enable (default -1)");
44+
4045
u32 hda_dsp_get_mult_div(struct snd_sof_dev *sdev, int rate)
4146
{
4247
switch (rate) {
@@ -240,6 +245,16 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
240245
if (hda_always_enable_dmi_l1 && direction == SNDRV_PCM_STREAM_CAPTURE)
241246
runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE;
242247

248+
/*
249+
* Do not advertise the PAUSE support if it is forced to be disabled via
250+
* module parameter or if the pause_supported is false for the PCM
251+
* device
252+
*/
253+
if (hda_force_pause_support == 0 ||
254+
(hda_force_pause_support == -1 &&
255+
!spcm->stream[substream->stream].pause_supported))
256+
runtime->hw.info &= ~SNDRV_PCM_INFO_PAUSE;
257+
243258
if (hda_always_enable_dmi_l1 ||
244259
direction == SNDRV_PCM_STREAM_PLAYBACK ||
245260
spcm->stream[substream->stream].d0i3_compatible)

0 commit comments

Comments
 (0)