diff mbox series

[2/3] ASoC: SOF: ipc4-loader: get max pipeline number

Message ID 20221108002910.2819709-3-yung-chuan.liao@linux.intel.com (mailing list archive)
State Accepted
Commit eb2eaf50395a8164f4f9e0021609ddb40ad97e87
Headers show
Series ASoC: SOF: get pipeline instance id from pipe_widget->instance_id | expand

Commit Message

Bard Liao Nov. 8, 2022, 12:29 a.m. UTC
Get max pipeline number from firmware configuration.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
 sound/soc/sof/ipc4-loader.c | 11 +++++++++++
 sound/soc/sof/ipc4-priv.h   |  2 ++
 2 files changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/sof/ipc4-loader.c b/sound/soc/sof/ipc4-loader.c
index 702196774c50..1321acc402fd 100644
--- a/sound/soc/sof/ipc4-loader.c
+++ b/sound/soc/sof/ipc4-loader.c
@@ -383,6 +383,17 @@  int sof_ipc4_query_fw_configuration(struct snd_sof_dev *sdev)
 			if (!ipc4_data->max_libs_count)
 				ipc4_data->max_libs_count = 1;
 			break;
+		case SOF_IPC4_FW_CFG_MAX_PPL_COUNT:
+			ipc4_data->max_num_pipelines = *tuple->value;
+			trace_sof_ipc4_fw_config(sdev, "Max PPL count %d",
+						 ipc4_data->max_num_pipelines);
+			if (ipc4_data->max_num_pipelines <= 0) {
+				dev_err(sdev->dev, "Invalid max_num_pipelines %d",
+					ipc4_data->max_num_pipelines);
+				ret = -EINVAL;
+				goto out;
+			}
+			break;
 		default:
 			break;
 		}
diff --git a/sound/soc/sof/ipc4-priv.h b/sound/soc/sof/ipc4-priv.h
index d6f35004c4b7..fc9efdce67e0 100644
--- a/sound/soc/sof/ipc4-priv.h
+++ b/sound/soc/sof/ipc4-priv.h
@@ -65,6 +65,7 @@  struct sof_ipc4_fw_library {
  * @nhlt: NHLT table either from the BIOS or the topology manifest
  * @mtrace_type: mtrace type supported on the booted platform
  * @mtrace_log_bytes: log bytes as reported by the firmware via fw_config reply
+ * @max_num_pipelines: max number of pipelines
  * @max_libs_count: Maximum number of libraries support by the FW including the
  *		    base firmware
  *
@@ -76,6 +77,7 @@  struct sof_ipc4_fw_data {
 	void *nhlt;
 	enum sof_ipc4_mtrace_type mtrace_type;
 	u32 mtrace_log_bytes;
+	int max_num_pipelines;
 	u32 max_libs_count;
 
 	int (*load_library)(struct snd_sof_dev *sdev,