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 */
205 /* wait for IPC message reply */
206 static int tx_wait_done(struct snd_sof_ipc *ipc, struct snd_sof_ipc_msg *msg, in tx_wait_done() argument
209 struct snd_sof_dev *sdev = ipc->sdev; in tx_wait_done()
213 /* wait for DSP IPC completion */ in tx_wait_done()
218 dev_err(sdev->dev, "error: ipc timed out for 0x%x size %d\n", in tx_wait_done()
220 snd_sof_handle_fw_exception(ipc->sdev); in tx_wait_done()
225 dev_err(sdev->dev, "error: ipc error for 0x%x size %zu\n", in tx_wait_done()
228 ipc_log_header(sdev->dev, "ipc tx succeeded", hdr->cmd); in tx_wait_done()
239 /* send IPC message from host to DSP */
240 static int sof_ipc_tx_message_unlocked(struct snd_sof_ipc *ipc, u32 header, in sof_ipc_tx_message_unlocked() argument
244 struct snd_sof_dev *sdev = ipc->sdev; in sof_ipc_tx_message_unlocked()
248 if (ipc->disable_ipc_tx) in sof_ipc_tx_message_unlocked()
258 msg = &ipc->msg; in sof_ipc_tx_message_unlocked()
280 "error: ipc tx failed with error %d\n", in sof_ipc_tx_message_unlocked()
285 ipc_log_header(sdev->dev, "ipc tx", msg->header); in sof_ipc_tx_message_unlocked()
289 ret = tx_wait_done(ipc, msg, reply_data); in sof_ipc_tx_message_unlocked()
294 /* send IPC message from host to DSP */
295 int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header, in sof_ipc_tx_message() argument
304 /* ensure the DSP is in D0 before sending a new IPC */ in sof_ipc_tx_message()
305 ret = snd_sof_dsp_set_power_state(ipc->sdev, &target_state); in sof_ipc_tx_message()
307 dev_err(ipc->sdev->dev, "error: resuming DSP %d\n", ret); in sof_ipc_tx_message()
311 return sof_ipc_tx_message_no_pm(ipc, header, msg_data, msg_bytes, in sof_ipc_tx_message()
317 * send IPC message from host to DSP without modifying the DSP state.
318 * This will be used for IPC's that can be handled by the DSP
321 int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, u32 header, in sof_ipc_tx_message_no_pm() argument
331 /* Serialise IPC TX */ in sof_ipc_tx_message_no_pm()
332 mutex_lock(&ipc->tx_mutex); in sof_ipc_tx_message_no_pm()
334 ret = sof_ipc_tx_message_unlocked(ipc, header, msg_data, msg_bytes, in sof_ipc_tx_message_no_pm()
337 mutex_unlock(&ipc->tx_mutex); in sof_ipc_tx_message_no_pm()
346 struct snd_sof_ipc_msg *msg = &sdev->ipc->msg; in snd_sof_ipc_reply()
370 ipc_log_header(sdev->dev, "ipc rx", hdr.cmd); in snd_sof_ipc_msgs_rx()
378 dev_err(sdev->dev, "error: ipc reply unknown\n"); in snd_sof_ipc_msgs_rx()
410 ipc_log_header(sdev->dev, "ipc rx done", hdr.cmd); in snd_sof_ipc_msgs_rx()
415 * IPC trace mechanism.
436 * IPC stream position.
518 /* get stream position IPC - use faster MMIO method if available on platform */
527 /* read position via slower IPC */ in snd_sof_ipc_stream_posn()
532 /* send IPC to the DSP */ in snd_sof_ipc_stream_posn()
533 err = sof_ipc_tx_message(sdev->ipc, in snd_sof_ipc_stream_posn()
591 /* allocate max ipc size because we have at least one */ in sof_set_get_large_ctrl_data()
613 /* Serialise IPC TX */ in sof_set_get_large_ctrl_data()
614 mutex_lock(&sdev->ipc->tx_mutex); in sof_set_get_large_ctrl_data()
628 err = sof_ipc_tx_message_unlocked(sdev->ipc, in sof_set_get_large_ctrl_data()
643 mutex_unlock(&sdev->ipc->tx_mutex); in sof_set_get_large_ctrl_data()
650 * IPC get()/set() for kcontrols.
721 /* send normal size ipc in one part */ in snd_sof_ipc_set_get_comp_data()
723 err = sof_ipc_tx_message(sdev->ipc, cdata->rhdr.hdr.cmd, cdata, in snd_sof_ipc_set_get_comp_data()
728 dev_err(sdev->dev, "error: set/get ctrl ipc comp %d\n", in snd_sof_ipc_set_get_comp_data()
734 /* data is bigger than max ipc size, chop into smaller pieces */ in snd_sof_ipc_set_get_comp_data()
735 dev_dbg(sdev->dev, "large ipc size %u, control size %u\n", in snd_sof_ipc_set_get_comp_data()
747 dev_err(sdev->dev, "error: set/get large ctrl ipc comp %d\n", in snd_sof_ipc_set_get_comp_data()
755 * IPC layer enumeration.
823 struct snd_sof_ipc *ipc; in snd_sof_ipc_init() local
826 ipc = devm_kzalloc(sdev->dev, sizeof(*ipc), GFP_KERNEL); in snd_sof_ipc_init()
827 if (!ipc) in snd_sof_ipc_init()
830 mutex_init(&ipc->tx_mutex); in snd_sof_ipc_init()
831 ipc->sdev = sdev; in snd_sof_ipc_init()
832 msg = &ipc->msg; in snd_sof_ipc_init()
850 return ipc; in snd_sof_ipc_init()
856 struct snd_sof_ipc *ipc = sdev->ipc; in snd_sof_ipc_free() local
858 if (!ipc) in snd_sof_ipc_free()
861 /* disable sending of ipc's */ in snd_sof_ipc_free()
862 mutex_lock(&ipc->tx_mutex); in snd_sof_ipc_free()
863 ipc->disable_ipc_tx = true; in snd_sof_ipc_free()
864 mutex_unlock(&ipc->tx_mutex); in snd_sof_ipc_free()