// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) // // This file is provided under a dual BSD/GPLv2 license. When using or // redistributing this file, you may do so under either license. // // Copyright(c) 2018 Intel Corporation // // Author: Liam Girdwood <[email protected]> // // Generic IPC layer that can work over MMIO and SPI/I2C. PHY layer provided // by platform driver code. // #include <linux/mutex.h> #include <linux/types.h> #include "sof-priv.h" #include "sof-audio.h" #include "ops.h" /** * sof_ipc_send_msg - generic function to prepare and send one IPC message * @sdev: pointer to SOF core device struct * @msg_data: pointer to a message to send * @msg_bytes: number of bytes in the message * @reply_bytes: number of bytes available for the reply. * The buffer for the reply data is not passed to this * function, the available size is an information for the * reply handling functions. * * On success the function returns 0, otherwise negative error number. * * Note: higher level sdev->ipc->tx_mutex must be held to make sure that * transfers are synchronized. */ int sof_ipc_send_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes, size_t reply_bytes) { … } /* send IPC message from host to DSP */ int sof_ipc_tx_message(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, void *reply_data, size_t reply_bytes) { … } EXPORT_SYMBOL(…); /* IPC set or get data from host to DSP */ int sof_ipc_set_get_data(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, bool set) { … } EXPORT_SYMBOL(…); /* * send IPC message from host to DSP without modifying the DSP state. * This will be used for IPC's that can be handled by the DSP * even in a low-power D0 substate. */ int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, void *reply_data, size_t reply_bytes) { … } EXPORT_SYMBOL(…); /* Generic helper function to retrieve the reply */ void snd_sof_ipc_get_reply(struct snd_sof_dev *sdev) { … } EXPORT_SYMBOL(…); /* handle reply message from DSP */ void snd_sof_ipc_reply(struct snd_sof_dev *sdev, u32 msg_id) { … } EXPORT_SYMBOL(…); struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev) { … } EXPORT_SYMBOL(…); void snd_sof_ipc_free(struct snd_sof_dev *sdev) { … } EXPORT_SYMBOL(…);