Commit 7893df67 authored by Artur Kloniecki's avatar Artur Kloniecki Committed by Mark Brown

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: default avatarArtur Kloniecki <arturx.kloniecki@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20200415202816.934-16-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a9a9cbf0
...@@ -76,11 +76,23 @@ struct sof_ipc_comp { ...@@ -76,11 +76,23 @@ struct sof_ipc_comp {
#define SOF_MEM_CAPS_CACHE (1 << 6) /**< cacheable */ #define SOF_MEM_CAPS_CACHE (1 << 6) /**< cacheable */
#define SOF_MEM_CAPS_EXEC (1 << 7) /**< executable */ #define SOF_MEM_CAPS_EXEC (1 << 7) /**< executable */
/*
* overrun will cause ring buffer overwrite, instead of XRUN.
*/
#define SOF_BUF_OVERRUN_PERMITTED BIT(0)
/*
* underrun will cause readback of 0s, instead of XRUN.
*/
#define SOF_BUF_UNDERRUN_PERMITTED BIT(1)
/* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */ /* create new component buffer - SOF_IPC_TPLG_BUFFER_NEW */
struct sof_ipc_buffer { struct sof_ipc_buffer {
struct sof_ipc_comp comp; struct sof_ipc_comp comp;
uint32_t size; /**< buffer size in bytes */ uint32_t size; /**< buffer size in bytes */
uint32_t caps; /**< SOF_MEM_CAPS_ */ uint32_t caps; /**< SOF_MEM_CAPS_ */
uint32_t flags; /**< SOF_BUF_ flags defined above */
uint32_t reserved; /**< reserved for future use */
} __packed; } __packed;
/* generic component config data - must always be after struct sof_ipc_comp */ /* generic component config data - must always be after struct sof_ipc_comp */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment