Lines Matching refs:msg
36 static int imx_rpmsg_pcm_send_message(struct rpmsg_msg *msg, in imx_rpmsg_pcm_send_message() argument
49 dev_dbg(&rpdev->dev, "send cmd %d\n", msg->s_msg.header.cmd); in imx_rpmsg_pcm_send_message()
51 if (!(msg->s_msg.header.type == MSG_TYPE_C)) in imx_rpmsg_pcm_send_message()
54 ret = rpmsg_send(rpdev->ept, (void *)&msg->s_msg, in imx_rpmsg_pcm_send_message()
63 if (msg->s_msg.header.type == MSG_TYPE_C) { in imx_rpmsg_pcm_send_message()
73 msg->s_msg.header.cmd); in imx_rpmsg_pcm_send_message()
78 memcpy(&msg->r_msg, &info->r_msg, sizeof(struct rpmsg_r_msg)); in imx_rpmsg_pcm_send_message()
79 memcpy(&info->msg[msg->r_msg.header.cmd].r_msg, in imx_rpmsg_pcm_send_message()
80 &msg->r_msg, sizeof(struct rpmsg_r_msg)); in imx_rpmsg_pcm_send_message()
89 switch (msg->s_msg.header.cmd) { in imx_rpmsg_pcm_send_message()
91 info->msg[TX_POINTER].r_msg.param.buffer_offset = 0; in imx_rpmsg_pcm_send_message()
94 info->msg[RX_POINTER].r_msg.param.buffer_offset = 0; in imx_rpmsg_pcm_send_message()
100 dev_dbg(&rpdev->dev, "cmd:%d, resp %d\n", msg->s_msg.header.cmd, in imx_rpmsg_pcm_send_message()
109 struct rpmsg_msg *msg, in imx_rpmsg_insert_workqueue() argument
123 memcpy(&info->work_list[index].msg, msg, in imx_rpmsg_insert_workqueue()
143 struct rpmsg_msg *msg; in imx_rpmsg_pcm_hw_params() local
146 msg = &info->msg[TX_HW_PARAM]; in imx_rpmsg_pcm_hw_params()
147 msg->s_msg.header.cmd = TX_HW_PARAM; in imx_rpmsg_pcm_hw_params()
149 msg = &info->msg[RX_HW_PARAM]; in imx_rpmsg_pcm_hw_params()
150 msg->s_msg.header.cmd = RX_HW_PARAM; in imx_rpmsg_pcm_hw_params()
153 msg->s_msg.param.rate = params_rate(params); in imx_rpmsg_pcm_hw_params()
157 msg->s_msg.param.format = RPMSG_S16_LE; in imx_rpmsg_pcm_hw_params()
160 msg->s_msg.param.format = RPMSG_S24_LE; in imx_rpmsg_pcm_hw_params()
163 msg->s_msg.param.format = RPMSG_DSD_U16_LE; in imx_rpmsg_pcm_hw_params()
166 msg->s_msg.param.format = RPMSG_DSD_U32_LE; in imx_rpmsg_pcm_hw_params()
169 msg->s_msg.param.format = RPMSG_S32_LE; in imx_rpmsg_pcm_hw_params()
175 msg->s_msg.param.channels = RPMSG_CH_LEFT; in imx_rpmsg_pcm_hw_params()
178 msg->s_msg.param.channels = RPMSG_CH_STEREO; in imx_rpmsg_pcm_hw_params()
181 msg->s_msg.param.channels = params_channels(params); in imx_rpmsg_pcm_hw_params()
185 info->send_message(msg, info); in imx_rpmsg_pcm_hw_params()
194 struct rpmsg_msg *msg; in imx_rpmsg_pcm_pointer() local
199 msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM]; in imx_rpmsg_pcm_pointer()
201 msg = &info->msg[RX_PERIOD_DONE + MSG_TYPE_A_NUM]; in imx_rpmsg_pcm_pointer()
203 buffer_tail = msg->r_msg.param.buffer_tail; in imx_rpmsg_pcm_pointer()
215 struct rpmsg_msg *msg; in imx_rpmsg_timer_callback() local
218 msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM]; in imx_rpmsg_timer_callback()
219 msg->s_msg.header.cmd = TX_PERIOD_DONE; in imx_rpmsg_timer_callback()
221 msg = &info->msg[RX_PERIOD_DONE + MSG_TYPE_A_NUM]; in imx_rpmsg_timer_callback()
222 msg->s_msg.header.cmd = RX_PERIOD_DONE; in imx_rpmsg_timer_callback()
225 imx_rpmsg_insert_workqueue(substream, msg, info); in imx_rpmsg_timer_callback()
236 struct rpmsg_msg *msg; in imx_rpmsg_pcm_open() local
241 msg = &info->msg[TX_OPEN]; in imx_rpmsg_pcm_open()
242 msg->s_msg.header.cmd = TX_OPEN; in imx_rpmsg_pcm_open()
246 info->msg[cmd].s_msg.param.buffer_tail = 0; in imx_rpmsg_pcm_open()
247 info->msg[cmd].r_msg.param.buffer_tail = 0; in imx_rpmsg_pcm_open()
248 info->msg[TX_POINTER].r_msg.param.buffer_offset = 0; in imx_rpmsg_pcm_open()
251 msg = &info->msg[RX_OPEN]; in imx_rpmsg_pcm_open()
252 msg->s_msg.header.cmd = RX_OPEN; in imx_rpmsg_pcm_open()
256 info->msg[cmd].s_msg.param.buffer_tail = 0; in imx_rpmsg_pcm_open()
257 info->msg[cmd].r_msg.param.buffer_tail = 0; in imx_rpmsg_pcm_open()
258 info->msg[RX_POINTER].r_msg.param.buffer_offset = 0; in imx_rpmsg_pcm_open()
261 info->send_message(msg, info); in imx_rpmsg_pcm_open()
289 struct rpmsg_msg *msg; in imx_rpmsg_pcm_close() local
295 msg = &info->msg[TX_CLOSE]; in imx_rpmsg_pcm_close()
296 msg->s_msg.header.cmd = TX_CLOSE; in imx_rpmsg_pcm_close()
298 msg = &info->msg[RX_CLOSE]; in imx_rpmsg_pcm_close()
299 msg->s_msg.header.cmd = RX_CLOSE; in imx_rpmsg_pcm_close()
302 info->send_message(msg, info); in imx_rpmsg_pcm_close()
354 struct rpmsg_msg *msg; in imx_rpmsg_prepare_and_submit() local
357 msg = &info->msg[TX_BUFFER]; in imx_rpmsg_prepare_and_submit()
358 msg->s_msg.header.cmd = TX_BUFFER; in imx_rpmsg_prepare_and_submit()
360 msg = &info->msg[RX_BUFFER]; in imx_rpmsg_prepare_and_submit()
361 msg->s_msg.header.cmd = RX_BUFFER; in imx_rpmsg_prepare_and_submit()
365 msg->s_msg.param.buffer_addr = substream->runtime->dma_addr; in imx_rpmsg_prepare_and_submit()
366 msg->s_msg.param.buffer_size = snd_pcm_lib_buffer_bytes(substream); in imx_rpmsg_prepare_and_submit()
367 msg->s_msg.param.period_size = snd_pcm_lib_period_bytes(substream); in imx_rpmsg_prepare_and_submit()
368 msg->s_msg.param.buffer_tail = 0; in imx_rpmsg_prepare_and_submit()
370 info->num_period[substream->stream] = msg->s_msg.param.buffer_size / in imx_rpmsg_prepare_and_submit()
371 msg->s_msg.param.period_size; in imx_rpmsg_prepare_and_submit()
376 return imx_rpmsg_insert_workqueue(substream, msg, info); in imx_rpmsg_prepare_and_submit()
383 struct rpmsg_msg *msg; in imx_rpmsg_async_issue_pending() local
386 msg = &info->msg[TX_START]; in imx_rpmsg_async_issue_pending()
387 msg->s_msg.header.cmd = TX_START; in imx_rpmsg_async_issue_pending()
389 msg = &info->msg[RX_START]; in imx_rpmsg_async_issue_pending()
390 msg->s_msg.header.cmd = RX_START; in imx_rpmsg_async_issue_pending()
393 return imx_rpmsg_insert_workqueue(substream, msg, info); in imx_rpmsg_async_issue_pending()
400 struct rpmsg_msg *msg; in imx_rpmsg_restart() local
403 msg = &info->msg[TX_RESTART]; in imx_rpmsg_restart()
404 msg->s_msg.header.cmd = TX_RESTART; in imx_rpmsg_restart()
406 msg = &info->msg[RX_RESTART]; in imx_rpmsg_restart()
407 msg->s_msg.header.cmd = RX_RESTART; in imx_rpmsg_restart()
410 return imx_rpmsg_insert_workqueue(substream, msg, info); in imx_rpmsg_restart()
417 struct rpmsg_msg *msg; in imx_rpmsg_pause() local
420 msg = &info->msg[TX_PAUSE]; in imx_rpmsg_pause()
421 msg->s_msg.header.cmd = TX_PAUSE; in imx_rpmsg_pause()
423 msg = &info->msg[RX_PAUSE]; in imx_rpmsg_pause()
424 msg->s_msg.header.cmd = RX_PAUSE; in imx_rpmsg_pause()
427 return imx_rpmsg_insert_workqueue(substream, msg, info); in imx_rpmsg_pause()
434 struct rpmsg_msg *msg; in imx_rpmsg_terminate_all() local
438 msg = &info->msg[TX_TERMINATE]; in imx_rpmsg_terminate_all()
439 msg->s_msg.header.cmd = TX_TERMINATE; in imx_rpmsg_terminate_all()
442 info->msg[cmd].s_msg.param.buffer_tail = 0; in imx_rpmsg_terminate_all()
443 info->msg[cmd].r_msg.param.buffer_tail = 0; in imx_rpmsg_terminate_all()
444 info->msg[TX_POINTER].r_msg.param.buffer_offset = 0; in imx_rpmsg_terminate_all()
446 msg = &info->msg[RX_TERMINATE]; in imx_rpmsg_terminate_all()
447 msg->s_msg.header.cmd = RX_TERMINATE; in imx_rpmsg_terminate_all()
450 info->msg[cmd].s_msg.param.buffer_tail = 0; in imx_rpmsg_terminate_all()
451 info->msg[cmd].r_msg.param.buffer_tail = 0; in imx_rpmsg_terminate_all()
452 info->msg[RX_POINTER].r_msg.param.buffer_offset = 0; in imx_rpmsg_terminate_all()
457 return imx_rpmsg_insert_workqueue(substream, msg, info); in imx_rpmsg_terminate_all()
525 struct rpmsg_msg *msg; in imx_rpmsg_pcm_ack() local
534 msg = &info->msg[TX_PERIOD_DONE + MSG_TYPE_A_NUM]; in imx_rpmsg_pcm_ack()
535 msg->s_msg.header.cmd = TX_PERIOD_DONE; in imx_rpmsg_pcm_ack()
537 msg = &info->msg[RX_PERIOD_DONE + MSG_TYPE_A_NUM]; in imx_rpmsg_pcm_ack()
538 msg->s_msg.header.cmd = RX_PERIOD_DONE; in imx_rpmsg_pcm_ack()
541 msg->s_msg.header.type = MSG_TYPE_C; in imx_rpmsg_pcm_ack()
548 if (buffer_tail != msg->s_msg.param.buffer_tail) { in imx_rpmsg_pcm_ack()
549 written_num = buffer_tail - msg->s_msg.param.buffer_tail; in imx_rpmsg_pcm_ack()
553 msg->s_msg.param.buffer_tail = buffer_tail; in imx_rpmsg_pcm_ack()
557 memcpy(&info->notify[substream->stream], msg, in imx_rpmsg_pcm_ack()
581 imx_rpmsg_insert_workqueue(substream, msg, info); in imx_rpmsg_pcm_ack()
627 struct rpmsg_msg msg; in imx_rpmsg_pcm_work() local
641 memcpy(&msg, &info->notify[TX], sizeof(struct rpmsg_s_msg)); in imx_rpmsg_pcm_work()
644 info->send_message(&msg, info); in imx_rpmsg_pcm_work()
651 memcpy(&msg, &info->notify[RX], sizeof(struct rpmsg_s_msg)); in imx_rpmsg_pcm_work()
654 info->send_message(&msg, info); in imx_rpmsg_pcm_work()
660 if (work_of_rpmsg->msg.s_msg.header.type == MSG_TYPE_C && in imx_rpmsg_pcm_work()
661 (work_of_rpmsg->msg.s_msg.header.cmd == TX_PERIOD_DONE || in imx_rpmsg_pcm_work()
662 work_of_rpmsg->msg.s_msg.header.cmd == RX_PERIOD_DONE)) in imx_rpmsg_pcm_work()
666 info->send_message(&work_of_rpmsg->msg, info); in imx_rpmsg_pcm_work()
710 info->msg[i].s_msg.header.cate = IMX_RPMSG_AUDIO; in imx_rpmsg_pcm_probe()
711 info->msg[i].s_msg.header.major = IMX_RMPSG_MAJOR; in imx_rpmsg_pcm_probe()
712 info->msg[i].s_msg.header.minor = IMX_RMPSG_MINOR; in imx_rpmsg_pcm_probe()
713 info->msg[i].s_msg.header.type = MSG_TYPE_A; in imx_rpmsg_pcm_probe()
714 info->msg[i].s_msg.param.audioindex = 0; in imx_rpmsg_pcm_probe()
786 rpmsg_tx = &info->msg[TX_SUSPEND]; in imx_rpmsg_pcm_suspend()
787 rpmsg_rx = &info->msg[RX_SUSPEND]; in imx_rpmsg_pcm_suspend()
804 rpmsg_tx = &info->msg[TX_RESUME]; in imx_rpmsg_pcm_resume()
805 rpmsg_rx = &info->msg[RX_RESUME]; in imx_rpmsg_pcm_resume()