Lines Matching refs:ipc

16 void catpt_ipc_init(struct catpt_ipc *ipc, struct device *dev)  in catpt_ipc_init()  argument
18 ipc->dev = dev; in catpt_ipc_init()
19 ipc->ready = false; in catpt_ipc_init()
20 ipc->default_timeout = CATPT_IPC_TIMEOUT_MS; in catpt_ipc_init()
21 init_completion(&ipc->done_completion); in catpt_ipc_init()
22 init_completion(&ipc->busy_completion); in catpt_ipc_init()
23 spin_lock_init(&ipc->lock); in catpt_ipc_init()
24 mutex_init(&ipc->mutex); in catpt_ipc_init()
27 static int catpt_ipc_arm(struct catpt_ipc *ipc, struct catpt_fw_ready *config) in catpt_ipc_arm() argument
34 ipc->rx.data = devm_kzalloc(ipc->dev, config->outbox_size, GFP_KERNEL); in catpt_ipc_arm()
35 if (!ipc->rx.data) in catpt_ipc_arm()
38 memcpy(&ipc->config, config, sizeof(*config)); in catpt_ipc_arm()
39 ipc->ready = true; in catpt_ipc_arm()
44 static void catpt_ipc_msg_init(struct catpt_ipc *ipc, in catpt_ipc_msg_init() argument
47 lockdep_assert_held(&ipc->lock); in catpt_ipc_msg_init()
49 ipc->rx.header = 0; in catpt_ipc_msg_init()
50 ipc->rx.size = reply ? reply->size : 0; in catpt_ipc_msg_init()
51 reinit_completion(&ipc->done_completion); in catpt_ipc_msg_init()
52 reinit_completion(&ipc->busy_completion); in catpt_ipc_msg_init()
69 struct catpt_ipc *ipc = &cdev->ipc; in catpt_wait_msg_completion() local
72 ret = wait_for_completion_timeout(&ipc->done_completion, in catpt_wait_msg_completion()
76 if (ipc->rx.rsp.status != CATPT_REPLY_PENDING) in catpt_wait_msg_completion()
80 ret = wait_for_completion_timeout(&ipc->busy_completion, in catpt_wait_msg_completion()
89 struct catpt_ipc *ipc = &cdev->ipc; in catpt_dsp_do_send_msg() local
93 if (!ipc->ready) in catpt_dsp_do_send_msg()
95 if (request.size > ipc->config.outbox_size || in catpt_dsp_do_send_msg()
96 (reply && reply->size > ipc->config.outbox_size)) in catpt_dsp_do_send_msg()
99 spin_lock_irqsave(&ipc->lock, flags); in catpt_dsp_do_send_msg()
100 catpt_ipc_msg_init(ipc, reply); in catpt_dsp_do_send_msg()
102 spin_unlock_irqrestore(&ipc->lock, flags); in catpt_dsp_do_send_msg()
108 ipc->ready = false; in catpt_dsp_do_send_msg()
113 ret = ipc->rx.rsp.status; in catpt_dsp_do_send_msg()
115 reply->header = ipc->rx.header; in catpt_dsp_do_send_msg()
118 memcpy(reply->data, ipc->rx.data, reply->size); in catpt_dsp_do_send_msg()
128 struct catpt_ipc *ipc = &cdev->ipc; in catpt_dsp_send_msg_timeout() local
131 mutex_lock(&ipc->mutex); in catpt_dsp_send_msg_timeout()
133 mutex_unlock(&ipc->mutex); in catpt_dsp_send_msg_timeout()
142 cdev->ipc.default_timeout); in catpt_dsp_send_msg()
185 struct catpt_ipc *ipc = &cdev->ipc; in catpt_dsp_copy_rx() local
187 ipc->rx.header = header; in catpt_dsp_copy_rx()
188 if (ipc->rx.rsp.status != CATPT_REPLY_SUCCESS) in catpt_dsp_copy_rx()
191 memcpy_fromio(ipc->rx.data, catpt_outbox_addr(cdev), ipc->rx.size); in catpt_dsp_copy_rx()
192 trace_catpt_ipc_payload(ipc->rx.data, ipc->rx.size); in catpt_dsp_copy_rx()
198 struct catpt_ipc *ipc = &cdev->ipc; in catpt_dsp_process_response() local
208 catpt_ipc_arm(ipc, &config); in catpt_dsp_process_response()
216 ipc->ready = false; in catpt_dsp_process_response()
229 complete(&ipc->busy_completion); in catpt_dsp_process_response()
281 complete(&cdev->ipc.done_completion); in catpt_dsp_irq_handler()