ASoC: SOF: Add support for pause supported tokens from topology
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Fri, 13 Dec 2024 10:11:22 +0000 (12:11 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 13 Dec 2024 13:10:29 +0000 (13:10 +0000)
New tokens are added to topology:
1202: SOF_TKN_STREAM_PLAYBACK_PAUSE_SUPPORTED
1203: SOF_TKN_STREAM_CAPTURE_PAUSE_SUPPORTED

The new tokens are used to advertise support for PAUSE/RESUME operation on
a PCM device depending on firmware product, use case, pipeline topology.

The snd_sof_pcm_stream.pause_supported is updated to reflect the advertised
value for the PCM device.

If the token does not exist then the pause_supported is set to false.

Note: it is up to the platform code to use this flag to decide to advertise
the PAUSE support for user space or not.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Link: https://patch.msgid.link/20241213101123.27318-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/uapi/sound/sof/tokens.h
sound/soc/sof/sof-audio.h
sound/soc/sof/topology.c

index 0a246bc218d32a1cf039547b25130cef0819bffc..c28c766270de01117181215c98da7f67e3443b31 100644 (file)
 /* Stream */
 #define SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3        1200
 #define SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 1201
+#define SOF_TKN_STREAM_PLAYBACK_PAUSE_SUPPORTED        1202
+#define SOF_TKN_STREAM_CAPTURE_PAUSE_SUPPORTED 1203
 
 /* Led control for mute switches */
 #define SOF_TKN_MUTE_LED_USE                   1300
index 01b819dd84984152330f5502f96c58fe2781ef9a..62f3c11a9216de8ba4a9a7d258e8d0a541ee82db 100644 (file)
@@ -332,6 +332,7 @@ struct snd_sof_pcm_stream {
        struct work_struct period_elapsed_work;
        struct snd_soc_dapm_widget_list *list; /* list of connected DAPM widgets */
        bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */
+       bool pause_supported; /* PCM device supports PAUSE operation */
        unsigned int dsp_max_burst_size_in_ms; /* The maximum size of the host DMA burst in ms */
        /*
         * flag to indicate that the DSP pipelines should be kept
index b3fca5fd87d68c82204e1b3fb2da9409cb261aa3..688cc7ac17148a85adacfbb71e092f71c94134fa 100644 (file)
@@ -407,6 +407,10 @@ static const struct sof_topology_token stream_tokens[] = {
                offsetof(struct snd_sof_pcm, stream[0].d0i3_compatible)},
        {SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
                offsetof(struct snd_sof_pcm, stream[1].d0i3_compatible)},
+       {SOF_TKN_STREAM_PLAYBACK_PAUSE_SUPPORTED, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
+               offsetof(struct snd_sof_pcm, stream[0].pause_supported)},
+       {SOF_TKN_STREAM_CAPTURE_PAUSE_SUPPORTED, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
+               offsetof(struct snd_sof_pcm, stream[1].pause_supported)},
 };
 
 /* Leds */