Lines Matching full:ipc

10 // Generic IPC layer that can work over MMIO and SPI/I2C. PHY layer provided
25 * IPC message Tx/Rx message handling.
28 /* SOF generic IPC data */
34 /* disables further sending of ipc's */
216 /* wait for IPC message reply */
217 static int tx_wait_done(struct snd_sof_ipc *ipc, struct snd_sof_ipc_msg *msg, in tx_wait_done() argument
220 struct snd_sof_dev *sdev = ipc->sdev; in tx_wait_done()
224 /* wait for DSP IPC completion */ in tx_wait_done()
229 dev_err(sdev->dev, "error: ipc timed out for 0x%x size %d\n", in tx_wait_done()
231 snd_sof_handle_fw_exception(ipc->sdev); in tx_wait_done()
236 dev_err(sdev->dev, "error: ipc error for 0x%x size %zu\n", in tx_wait_done()
239 ipc_log_header(sdev->dev, "ipc tx succeeded", hdr->cmd); in tx_wait_done()
250 /* send IPC message from host to DSP */
251 static int sof_ipc_tx_message_unlocked(struct snd_sof_ipc *ipc, u32 header, in sof_ipc_tx_message_unlocked() argument
255 struct snd_sof_dev *sdev = ipc->sdev; in sof_ipc_tx_message_unlocked()
259 if (ipc->disable_ipc_tx) in sof_ipc_tx_message_unlocked()
269 msg = &ipc->msg; in sof_ipc_tx_message_unlocked()
291 "error: ipc tx failed with error %d\n", in sof_ipc_tx_message_unlocked()
296 ipc_log_header(sdev->dev, "ipc tx", msg->header); in sof_ipc_tx_message_unlocked()
300 ret = tx_wait_done(ipc, msg, reply_data); in sof_ipc_tx_message_unlocked()
305 /* send IPC message from host to DSP */
306 int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header, in sof_ipc_tx_message() argument
315 /* ensure the DSP is in D0 before sending a new IPC */ in sof_ipc_tx_message()
316 ret = snd_sof_dsp_set_power_state(ipc->sdev, &target_state); in sof_ipc_tx_message()
318 dev_err(ipc->sdev->dev, "error: resuming DSP %d\n", ret); in sof_ipc_tx_message()
322 return sof_ipc_tx_message_no_pm(ipc, header, msg_data, msg_bytes, in sof_ipc_tx_message()
328 * send IPC message from host to DSP without modifying the DSP state.
329 * This will be used for IPC's that can be handled by the DSP
332 int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, u32 header, in sof_ipc_tx_message_no_pm() argument
342 /* Serialise IPC TX */ in sof_ipc_tx_message_no_pm()
343 mutex_lock(&ipc->tx_mutex); in sof_ipc_tx_message_no_pm()
345 ret = sof_ipc_tx_message_unlocked(ipc, header, msg_data, msg_bytes, in sof_ipc_tx_message_no_pm()
348 mutex_unlock(&ipc->tx_mutex); in sof_ipc_tx_message_no_pm()
357 struct snd_sof_ipc_msg *msg = &sdev->ipc->msg; in snd_sof_ipc_reply()
381 ipc_log_header(sdev->dev, "ipc rx", hdr.cmd); in snd_sof_ipc_msgs_rx()
389 dev_err(sdev->dev, "error: ipc reply unknown\n"); in snd_sof_ipc_msgs_rx()
421 ipc_log_header(sdev->dev, "ipc rx done", hdr.cmd); in snd_sof_ipc_msgs_rx()
426 * IPC trace mechanism.
447 * IPC stream position.
529 /* get stream position IPC - use faster MMIO method if available on platform */
538 /* read position via slower IPC */ in snd_sof_ipc_stream_posn()
543 /* send IPC to the DSP */ in snd_sof_ipc_stream_posn()
544 err = sof_ipc_tx_message(sdev->ipc, in snd_sof_ipc_stream_posn()
602 /* allocate max ipc size because we have at least one */ in sof_set_get_large_ctrl_data()
624 /* Serialise IPC TX */ in sof_set_get_large_ctrl_data()
625 mutex_lock(&sdev->ipc->tx_mutex); in sof_set_get_large_ctrl_data()
639 err = sof_ipc_tx_message_unlocked(sdev->ipc, in sof_set_get_large_ctrl_data()
654 mutex_unlock(&sdev->ipc->tx_mutex); in sof_set_get_large_ctrl_data()
661 * IPC get()/set() for kcontrols.
732 /* send normal size ipc in one part */ in snd_sof_ipc_set_get_comp_data()
734 err = sof_ipc_tx_message(sdev->ipc, cdata->rhdr.hdr.cmd, cdata, in snd_sof_ipc_set_get_comp_data()
739 dev_err(sdev->dev, "error: set/get ctrl ipc comp %d\n", in snd_sof_ipc_set_get_comp_data()
745 /* data is bigger than max ipc size, chop into smaller pieces */ in snd_sof_ipc_set_get_comp_data()
746 dev_dbg(sdev->dev, "large ipc size %u, control size %u\n", in snd_sof_ipc_set_get_comp_data()
758 dev_err(sdev->dev, "error: set/get large ctrl ipc comp %d\n", in snd_sof_ipc_set_get_comp_data()
766 * IPC layer enumeration.
834 struct snd_sof_ipc *ipc; in snd_sof_ipc_init() local
837 ipc = devm_kzalloc(sdev->dev, sizeof(*ipc), GFP_KERNEL); in snd_sof_ipc_init()
838 if (!ipc) in snd_sof_ipc_init()
841 mutex_init(&ipc->tx_mutex); in snd_sof_ipc_init()
842 ipc->sdev = sdev; in snd_sof_ipc_init()
843 msg = &ipc->msg; in snd_sof_ipc_init()
861 return ipc; in snd_sof_ipc_init()
867 struct snd_sof_ipc *ipc = sdev->ipc; in snd_sof_ipc_free() local
869 if (!ipc) in snd_sof_ipc_free()
872 /* disable sending of ipc's */ in snd_sof_ipc_free()
873 mutex_lock(&ipc->tx_mutex); in snd_sof_ipc_free()
874 ipc->disable_ipc_tx = true; in snd_sof_ipc_free()
875 mutex_unlock(&ipc->tx_mutex); in snd_sof_ipc_free()