Skip to content

Commit 7893df6

Browse files
akloniexbroonie
authored andcommitted
ASoC: SOF: Add XRUN flags field to struct sof_ipc_buffer.
Currently if a component source buffer underruns or a component sink buffer overruns the pipeline will enter an XRUN status and attempt recovery. This is desired in most pipelines but some topologies need to support use cases where we expect buffers to underrun or overrun. Host ---> Proc----> Selector0 --> Buf0 ---- > DAI Playback | v Buf1 | v Host <---------------Selector1 <----- Buf2 <----- Echo Ref DAI In the example above we two host PCMs that can be independently started/stopped thereby causing buf1 to either underrun or overrun (and stop the pipelines). Buf1 should be permitted to underrun or overrun without invoking pipeline XRUN logic and should over write oldest data (for overrun) and readback 0s (for underrun). 2 flags have been added for use during buffer instantiation: SOF_BUF_OVERRUN_PERMITTED and SOF_BUF_UNDERRUN_PERMITTED, along with struct sof_ipc_buffer member fields: flags and reserved. Flags field is supposed to hold the above-mentioned flags to allow some control over XRUN behaviour. Also added reserved field to the structure in case it comes in handy some time in the future. This is an incremental ABI change as the new fields are ignored by older versions of the firmware. Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Link: https://lore.kernel.org/r/20200415202816.934-16-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a9a9cbf commit 7893df6

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎include/sound/sof/topology.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,23 @@ struct sof_ipc_comp {
7676
#define SOF_MEM_CAPS_CACHE (1 << 6) /**< cacheable */
7777
#define SOF_MEM_CAPS_EXEC (1 << 7) /**< executable */
7878

79+
/*
80+
* overrun will cause ring buffer overwrite, instead of XRUN.
81+
*/
82+
#define SOF_BUF_OVERRUN_PERMITTED BIT(0)
83+
84+
/*
85+
* underrun will cause readback of 0s, instead of XRUN.
86+
*/
87+
#define SOF_BUF_UNDERRUN_PERMITTED BIT(1)
88+
7989
/* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */
8090
struct sof_ipc_buffer {
8191
struct sof_ipc_comp comp;
8292
uint32_t size; /**< buffer size in bytes */
8393
uint32_t caps; /**< SOF_MEM_CAPS_ */
94+
uint32_t flags; /**< SOF_BUF_ flags defined above */
95+
uint32_t reserved; /**< reserved for future use */
8496
} __packed;
8597

8698
/* generic component config data - must always be after struct sof_ipc_comp */

0 commit comments

Comments
 (0)