]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: ipc4-topology: Add new tokens for pipeline direction
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Wed, 4 Feb 2026 08:18:28 +0000 (10:18 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 4 Feb 2026 13:26:05 +0000 (13:26 +0000)
Parse the pipeline direction from topology. The direction_valid token is
required for backward-compatibility with older topologies that may not
have the direction set for pipelines. This will be used when
setting up pipelines to check if a pipeline is in the same direction as
the requested params and skip those in the opposite direction like in
the case of echo reference capture pipelines during playback.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20260204081833.16630-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/uapi/sound/sof/tokens.h
sound/soc/sof/ipc4-topology.c
sound/soc/sof/ipc4-topology.h
sound/soc/sof/sof-audio.h

index a68381a263ebe3b4cadd5449a9f094cf792c8393..f4a7baadb44da03798ac613707c5c7c31ef73cc2 100644 (file)
@@ -57,6 +57,8 @@
 #define SOF_TKN_SCHED_MEM_USAGE                        208
 #define SOF_TKN_SCHED_USE_CHAIN_DMA            209
 #define SOF_TKN_SCHED_KCPS                     210
+#define SOF_TKN_SCHED_DIRECTION                        211
+#define SOF_TKN_SCHED_DIRECTION_VALID          212
 
 /* volume */
 #define SOF_TKN_VOLUME_RAMP_STEP_TYPE          250
index d28aad71c7edd4805cec1fba852f0c5fff2131bb..09aca52e020ab1c6fa9c1f80e24a05982287c743 100644 (file)
@@ -76,6 +76,10 @@ static const struct sof_topology_token ipc4_sched_tokens[] = {
                offsetof(struct sof_ipc4_pipeline, core_id)},
        {SOF_TKN_SCHED_PRIORITY, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
                offsetof(struct sof_ipc4_pipeline, priority)},
+       {SOF_TKN_SCHED_DIRECTION, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
+               offsetof(struct sof_ipc4_pipeline, direction)},
+       {SOF_TKN_SCHED_DIRECTION, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
+               offsetof(struct sof_ipc4_pipeline, direction_valid)},
 };
 
 static const struct sof_topology_token pipeline_tokens[] = {
@@ -939,6 +943,10 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
 
        swidget->core = pipeline->core_id;
        spipe->core_mask |= BIT(pipeline->core_id);
+       if (pipeline->direction_valid) {
+               spipe->direction = pipeline->direction;
+               spipe->direction_valid = true;
+       }
 
        if (pipeline->use_chain_dma) {
                dev_dbg(scomp->dev, "Set up chain DMA for %s\n", swidget->widget->name);
@@ -954,9 +962,9 @@ static int sof_ipc4_widget_setup_comp_pipeline(struct snd_sof_widget *swidget)
                goto err;
        }
 
-       dev_dbg(scomp->dev, "pipeline '%s': id %d, pri %d, core_id %u, lp mode %d\n",
+       dev_dbg(scomp->dev, "pipeline '%s': id %d, pri %d, core_id %u, lp mode %d direction %d\n",
                swidget->widget->name, swidget->pipeline_id,
-               pipeline->priority, pipeline->core_id, pipeline->lp_mode);
+               pipeline->priority, pipeline->core_id, pipeline->lp_mode, pipeline->direction);
 
        swidget->private = pipeline;
 
index 9a028a59c5536a149b9884c8a38c5a52b89a192b..a289c1d8f3ff0ea1f729bb0328b7eb500e9ec2e4 100644 (file)
@@ -150,6 +150,8 @@ struct sof_ipc4_copier_config_set_sink_format {
  * @use_chain_dma: flag to indicate if the firmware shall use chained DMA
  * @msg: message structure for pipeline
  * @skip_during_fe_trigger: skip triggering this pipeline during the FE DAI trigger
+ * @direction_valid: flag indicating if valid direction is set in topology
+ * @direction: pipeline direction set in topology if direction_valid is true
  */
 struct sof_ipc4_pipeline {
        uint32_t priority;
@@ -160,6 +162,8 @@ struct sof_ipc4_pipeline {
        bool use_chain_dma;
        struct sof_ipc4_msg msg;
        bool skip_during_fe_trigger;
+       bool direction_valid;
+       u32 direction;
 };
 
 /**
index 5f62a34582dab925a852b52e3504c10a6c199e97..36082e764bf99ebc00e072e9cb6cb74db47674b5 100644 (file)
@@ -512,6 +512,9 @@ struct snd_sof_widget {
  * @complete: flag used to indicate that pipeline set up is complete.
  * @core_mask: Mask containing target cores for all modules in the pipeline
  * @list: List item in sdev pipeline_list
+ * @direction_valid: flag indicating if the direction is set in topology
+ * @direction: pipeline direction set in topology, valid is direction_valid is true
+ *
  */
 struct snd_sof_pipeline {
        struct snd_sof_widget *pipe_widget;
@@ -520,6 +523,8 @@ struct snd_sof_pipeline {
        int complete;
        unsigned long core_mask;
        struct list_head list;
+       bool direction_valid;
+       u32 direction;
 };
 
 /* ASoC SOF DAPM route */