Commit 21c51692 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: SOF: dai: include new flags for DAI_CONFIG

Mirror changes done in SOF tree. The changes do not rely on
BIT/GENMASK on purpose to keep the structure and flags common with the
firmware tree.

The DAI_CONFIG IPC is currently used in multiple ways. It is sent to
the DSP firmware when enabling static or dynamic pipelines, in
hw_params or prepare callbacks for Intel SSP, HDaudio and ALH, on
trigger_stop and hw_free.

This IPC has been abused a bit in the past, i.e. the values used for
some of the DAI-specific fields are used to either allocate or free
resources. Two typical examples are Intel HDaudio and SoundWire/ALH
DAIs, where using a zero DMA channel number or stream tag signals to
the firmware the DMA channels or tags allocated earlier can be freed.

Rather than add a new IPC for 'hw_params' and 'hw_free', this patch
suggests supporting a 2-bit value conveying the 'stage' information in
an existing IPC structure. Only 3 possible values are used.

The mapping between HW_PARAMS and HW_FREE flags and ALSA definitions
is not strictly 1:1, e.g. in some cases the HW_PARAM flag might be set
during the .prepare callback, while the HW_FREE might be sent during the
ALSA .trigger for stop/suspend.

The semantics of the flags is to reserve and start/stop all needed
resources, typically hardware related such as DMAs or clocks, when the
HW_PARAMS is set, while the HW_FREE flag allows the firmware to
release the resources allocated. The data transfers are still
controlled within the firmware through the propagation of the trigger
command.

The driver can then pass information that the DAI_CONFIG was invoked
in e.g. a pipeline/DAI setup, hw_params or hw_free stage without
having to use a special DAI-specific encoding. Unfortunately we can't
remove old encodings due to backwards-compatibility requirements but
for new cases, such as the SSP in follow-up patches, we can make the
IPC less cryptic.

This change is tagged as ABI 3.19 and is completely backwards compatible.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarBard Liao <bard.liao@intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarBrent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-3-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 66374230
......@@ -50,6 +50,13 @@
#define SOF_DAI_FMT_INV_MASK 0x0f00
#define SOF_DAI_FMT_CLOCK_PROVIDER_MASK 0xf000
/* DAI_CONFIG flags */
#define SOF_DAI_CONFIG_FLAGS_MASK 0x3
#define SOF_DAI_CONFIG_FLAGS_NONE (0 << 0) /**< DAI_CONFIG sent without stage information */
#define SOF_DAI_CONFIG_FLAGS_HW_PARAMS (1 << 0) /**< DAI_CONFIG sent during hw_params stage */
#define SOF_DAI_CONFIG_FLAGS_HW_FREE (2 << 0) /**< DAI_CONFIG sent during hw_free stage */
#define SOF_DAI_CONFIG_FLAGS_RFU (3 << 0) /**< not used, reserved for future use */
/** \brief Types of DAI */
enum sof_ipc_dai_type {
SOF_DAI_INTEL_NONE = 0, /**< None */
......@@ -70,7 +77,7 @@ struct sof_ipc_dai_config {
/* physical protocol and clocking */
uint16_t format; /**< SOF_DAI_FMT_ */
uint8_t group_id; /**< group ID, 0 means no group (ABI 3.17) */
uint8_t reserved8; /**< alignment */
uint8_t flags; /**< SOF_DAI_CONFIG_FLAGS_ (ABI 3.19) */
/* reserved for future use */
uint32_t reserved[8];
......
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