diff mbox series

[16/19] ASoC: SOF: loader: Add support for IPC dependent post firmware boot ops

Message ID 20221018120916.19820-17-peter.ujfalusi@linux.intel.com
State Superseded
Headers show
Series ASoC: SOF: Intel/IPC4: Support for external firmware libraries | expand

Commit Message

Peter Ujfalusi Oct. 18, 2022, 12:09 p.m. UTC
Add support for executing IPC dependent tasks after a successful firmware
boot.

The new post_fw_boot ops can make the fw_loader query_fw_configuration
callback redundant as IPC code can handle the first boot internally.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/sof/loader.c   | 6 ++++++
 sound/soc/sof/sof-priv.h | 3 +++
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index 723bd8267a3d..a1c4a51636c9 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -174,6 +174,12 @@  int snd_sof_run_firmware(struct snd_sof_dev *sdev)
 		return ret;
 	}
 
+	if (sdev->ipc->ops->post_fw_boot) {
+		ret = sdev->ipc->ops->post_fw_boot(sdev);
+		if (ret)
+			return ret;
+	}
+
 	if (sdev->first_boot && sdev->ipc->ops->fw_loader->query_fw_configuration)
 		return sdev->ipc->ops->fw_loader->query_fw_configuration(sdev);
 
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index ea6013ab1d4a..c7ab78b042aa 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -445,6 +445,8 @@  struct sof_ipc_pcm_ops;
  *
  * @init:	Optional pointer for IPC related initialization
  * @exit:	Optional pointer for IPC related cleanup
+ * @post_fw_boot: Optional pointer to execute IPC related tasks after firmware
+ *		boot.
  *
  * @tx_msg:	Function pointer for sending a 'short' IPC message
  * @set_get_data: Function pointer for set/get data ('large' IPC message). This
@@ -469,6 +471,7 @@  struct sof_ipc_ops {
 
 	int (*init)(struct snd_sof_dev *sdev);
 	void (*exit)(struct snd_sof_dev *sdev);
+	int (*post_fw_boot)(struct snd_sof_dev *sdev);
 
 	int (*tx_msg)(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes,
 		      void *reply_data, size_t reply_bytes, bool no_pm);