Skip to content

Commit 9b94f41

Browse files
committed
ASoC: SOF: core/Intel: Handle pause supported token
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>: A new set of tokens have been added to SOF topology to indicate that the pause operation is supported or not on the given PCM device. Pause is an optional feature that depends on pipeline, topology and modules used by the PCM. Add a pause_supported flag to snd_sof_pcm_stream and use this flag in Intel platform code to keep the pause support enabled or to disable it.
2 parents f851b98 + 3a47319 commit 9b94f41

4 files changed

Lines changed: 22 additions & 0 deletions

File tree

include/uapi/sound/sof/tokens.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@
153153
/* Stream */
154154
#define SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 1200
155155
#define SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 1201
156+
#define SOF_TKN_STREAM_PLAYBACK_PAUSE_SUPPORTED 1202
157+
#define SOF_TKN_STREAM_CAPTURE_PAUSE_SUPPORTED 1203
156158

157159
/* Led control for mute switches */
158160
#define SOF_TKN_MUTE_LED_USE 1300

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)

sound/soc/sof/sof-audio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ struct snd_sof_pcm_stream {
332332
struct work_struct period_elapsed_work;
333333
struct snd_soc_dapm_widget_list *list; /* list of connected DAPM widgets */
334334
bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */
335+
bool pause_supported; /* PCM device supports PAUSE operation */
335336
unsigned int dsp_max_burst_size_in_ms; /* The maximum size of the host DMA burst in ms */
336337
/*
337338
* flag to indicate that the DSP pipelines should be kept

sound/soc/sof/topology.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ static const struct sof_topology_token stream_tokens[] = {
407407
offsetof(struct snd_sof_pcm, stream[0].d0i3_compatible)},
408408
{SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
409409
offsetof(struct snd_sof_pcm, stream[1].d0i3_compatible)},
410+
{SOF_TKN_STREAM_PLAYBACK_PAUSE_SUPPORTED, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
411+
offsetof(struct snd_sof_pcm, stream[0].pause_supported)},
412+
{SOF_TKN_STREAM_CAPTURE_PAUSE_SUPPORTED, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
413+
offsetof(struct snd_sof_pcm, stream[1].pause_supported)},
410414
};
411415

412416
/* Leds */

0 commit comments

Comments
 (0)