diff options
author | Peter Ujfalusi <peter.ujfalusi@linux.intel.com> | 2022-10-20 15:12:26 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-10-21 15:04:59 +0300 |
commit | aa23b375363f6aba208761ff9985231cc69d00b8 (patch) | |
tree | c25fa9cefbd301c5bf41a5ba10e0b4a3e0e41a13 /sound/soc/sof/ipc.c | |
parent | e3775fda57d49984eaa2cfd86665a152806bfd81 (diff) | |
download | linux-aa23b375363f6aba208761ff9985231cc69d00b8.tar.xz |
ASoC: SOF: ipc: ops: Add support for optional init and exit callbacks
Add support for IPC specific initialization (init) and cleanup (exit)
callback.
These callbacks can be used by IPC implementation to do basic
initialization and cleanup.
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>
Link: https://lore.kernel.org/r/20221020121238.18339-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc.c')
-rw-r--r-- | sound/soc/sof/ipc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index 6ed3f9b6a0c4..30781e808a02 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -200,6 +200,9 @@ struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev) return NULL; } + if (ops->init && ops->init(sdev)) + return NULL; + ipc->ops = ops; return ipc; @@ -217,5 +220,8 @@ void snd_sof_ipc_free(struct snd_sof_dev *sdev) mutex_lock(&ipc->tx_mutex); ipc->disable_ipc_tx = true; mutex_unlock(&ipc->tx_mutex); + + if (ipc->ops->exit) + ipc->ops->exit(sdev); } EXPORT_SYMBOL(snd_sof_ipc_free); |