Lines Matching +full:rpmsg +full:- +full:micfil +full:- +full:channel

1 // SPDX-License-Identifier: GPL-2.0+
2 // Copyright 2017-2021 NXP
4 #include <linux/dma-mapping.h>
8 #include <linux/rpmsg.h>
15 #include "imx-pcm.h"
17 #include "imx-pcm-rpmsg.h"
39 struct rpmsg_device *rpdev = info->rpdev; in imx_rpmsg_pcm_send_message()
42 mutex_lock(&info->msg_lock); in imx_rpmsg_pcm_send_message()
44 dev_err(info->dev, "rpmsg channel not ready\n"); in imx_rpmsg_pcm_send_message()
45 mutex_unlock(&info->msg_lock); in imx_rpmsg_pcm_send_message()
46 return -EINVAL; in imx_rpmsg_pcm_send_message()
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()
52 reinit_completion(&info->cmd_complete); in imx_rpmsg_pcm_send_message()
54 ret = rpmsg_send(rpdev->ept, (void *)&msg->s_msg, in imx_rpmsg_pcm_send_message()
57 dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret); in imx_rpmsg_pcm_send_message()
58 mutex_unlock(&info->msg_lock); in imx_rpmsg_pcm_send_message()
63 if (msg->s_msg.header.type == MSG_TYPE_C) { in imx_rpmsg_pcm_send_message()
64 mutex_unlock(&info->msg_lock); in imx_rpmsg_pcm_send_message()
68 /* wait response from rpmsg */ in imx_rpmsg_pcm_send_message()
69 ret = wait_for_completion_timeout(&info->cmd_complete, in imx_rpmsg_pcm_send_message()
72 dev_err(&rpdev->dev, "rpmsg_send cmd %d timeout!\n", in imx_rpmsg_pcm_send_message()
73 msg->s_msg.header.cmd); in imx_rpmsg_pcm_send_message()
74 mutex_unlock(&info->msg_lock); in imx_rpmsg_pcm_send_message()
75 return -ETIMEDOUT; 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()
101 info->r_msg.param.resp); in imx_rpmsg_pcm_send_message()
103 mutex_unlock(&info->msg_lock); in imx_rpmsg_pcm_send_message()
119 spin_lock_irqsave(&info->wq_lock, flags); in imx_rpmsg_insert_workqueue()
120 if (info->work_write_index != info->work_read_index) { in imx_rpmsg_insert_workqueue()
121 int index = info->work_write_index; in imx_rpmsg_insert_workqueue()
123 memcpy(&info->work_list[index].msg, msg, in imx_rpmsg_insert_workqueue()
126 queue_work(info->rpmsg_wq, &info->work_list[index].work); in imx_rpmsg_insert_workqueue()
127 info->work_write_index++; in imx_rpmsg_insert_workqueue()
128 info->work_write_index %= WORK_MAX_NUM; in imx_rpmsg_insert_workqueue()
130 info->msg_drop_count[substream->stream]++; in imx_rpmsg_insert_workqueue()
131 ret = -EPIPE; in imx_rpmsg_insert_workqueue()
133 spin_unlock_irqrestore(&info->wq_lock, flags); in imx_rpmsg_insert_workqueue()
142 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_pcm_hw_params()
145 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_pcm_hw_params()
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()
193 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_pcm_pointer()
198 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in imx_rpmsg_pcm_pointer()
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()
206 return bytes_to_frames(substream->runtime, pos); in imx_rpmsg_pcm_pointer()
213 struct snd_pcm_substream *substream = stream_timer->substream; in imx_rpmsg_timer_callback()
214 struct rpmsg_info *info = stream_timer->info; in imx_rpmsg_timer_callback()
217 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_timer_callback()
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()
231 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_pcm_open()
234 struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev); in imx_rpmsg_pcm_open() local
240 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_pcm_open()
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()
264 pcm_hardware.buffer_bytes_max = rpmsg->buffer_size; in imx_rpmsg_pcm_open()
269 ret = snd_pcm_hw_constraint_integer(substream->runtime, in imx_rpmsg_pcm_open()
274 info->msg_drop_count[substream->stream] = 0; in imx_rpmsg_pcm_open()
277 info->stream_timer[substream->stream].info = info; in imx_rpmsg_pcm_open()
278 info->stream_timer[substream->stream].substream = substream; in imx_rpmsg_pcm_open()
279 timer_setup(&info->stream_timer[substream->stream].timer, in imx_rpmsg_pcm_open()
288 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_pcm_close()
292 flush_workqueue(info->rpmsg_wq); in imx_rpmsg_pcm_close()
294 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_pcm_close()
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()
304 del_timer(&info->stream_timer[substream->stream].timer); in imx_rpmsg_pcm_close()
306 rtd->dai_link->ignore_suspend = 0; in imx_rpmsg_pcm_close()
308 if (info->msg_drop_count[substream->stream]) in imx_rpmsg_pcm_close()
309 dev_warn(rtd->dev, "Msg is dropped!, number is %d\n", in imx_rpmsg_pcm_close()
310 info->msg_drop_count[substream->stream]); in imx_rpmsg_pcm_close()
318 struct snd_pcm_runtime *runtime = substream->runtime; in imx_rpmsg_pcm_prepare()
321 struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev); in imx_rpmsg_pcm_prepare() local
324 * NON-MMAP mode, NONBLOCK, Version 2, enable lpa in dts in imx_rpmsg_pcm_prepare()
327 if ((runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || in imx_rpmsg_pcm_prepare()
328 runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) && in imx_rpmsg_pcm_prepare()
329 rpmsg->enable_lpa) { in imx_rpmsg_pcm_prepare()
334 rtd->dai_link->ignore_suspend = 1; in imx_rpmsg_pcm_prepare()
335 rpmsg->force_lpa = 1; in imx_rpmsg_pcm_prepare()
337 rpmsg->force_lpa = 0; in imx_rpmsg_pcm_prepare()
353 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_prepare_and_submit()
356 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_prepare_and_submit()
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()
373 info->callback[substream->stream] = imx_rpmsg_pcm_dma_complete; in imx_rpmsg_prepare_and_submit()
374 info->callback_param[substream->stream] = substream; in imx_rpmsg_prepare_and_submit()
382 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_async_issue_pending()
385 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_async_issue_pending()
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()
399 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_restart()
402 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_restart()
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()
416 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_pause()
419 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_pause()
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()
433 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_terminate_all()
437 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_terminate_all()
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()
455 del_timer(&info->stream_timer[substream->stream].timer); in imx_rpmsg_terminate_all()
463 struct snd_pcm_runtime *runtime = substream->runtime; in imx_rpmsg_pcm_trigger()
466 struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev); in imx_rpmsg_pcm_trigger() local
477 if (rpmsg->force_lpa) in imx_rpmsg_pcm_trigger()
484 if (!rpmsg->force_lpa) { in imx_rpmsg_pcm_trigger()
485 if (runtime->info & SNDRV_PCM_INFO_PAUSE) in imx_rpmsg_pcm_trigger()
498 return -EINVAL; in imx_rpmsg_pcm_trigger()
510 * Send the period index to M core through rpmsg, but not send
512 * to reduce the pressure of rpmsg bandwidth.
517 struct snd_pcm_runtime *runtime = substream->runtime; in imx_rpmsg_pcm_ack()
520 struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev); in imx_rpmsg_pcm_ack() local
521 struct rpmsg_info *info = dev_get_drvdata(component->dev); in imx_rpmsg_pcm_ack()
522 snd_pcm_uframes_t period_size = runtime->period_size; in imx_rpmsg_pcm_ack()
530 if (!rpmsg->force_lpa) in imx_rpmsg_pcm_ack()
533 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in imx_rpmsg_pcm_ack()
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()
543 buffer_tail = (frames_to_bytes(runtime, runtime->control->appl_ptr) % 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()
551 written_num += runtime->periods; in imx_rpmsg_pcm_ack()
553 msg->s_msg.param.buffer_tail = buffer_tail; in imx_rpmsg_pcm_ack()
556 spin_lock_irqsave(&info->lock[substream->stream], flags); in imx_rpmsg_pcm_ack()
557 memcpy(&info->notify[substream->stream], msg, in imx_rpmsg_pcm_ack()
559 info->notify_updated[substream->stream] = true; in imx_rpmsg_pcm_ack()
560 spin_unlock_irqrestore(&info->lock[substream->stream], flags); in imx_rpmsg_pcm_ack()
562 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in imx_rpmsg_pcm_ack()
567 timer = &info->stream_timer[substream->stream].timer; in imx_rpmsg_pcm_ack()
580 if ((avail - written_num * period_size) <= period_size) { in imx_rpmsg_pcm_ack()
582 } else if (rpmsg->force_lpa && !timer_pending(timer)) { in imx_rpmsg_pcm_ack()
585 time_msec = (int)(runtime->period_size * 1000 / runtime->rate); in imx_rpmsg_pcm_ack()
596 struct snd_card *card = rtd->card->snd_card; in imx_rpmsg_pcm_new()
597 struct snd_pcm *pcm = rtd->pcm; in imx_rpmsg_pcm_new()
599 struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev); in imx_rpmsg_pcm_new() local
602 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); in imx_rpmsg_pcm_new()
607 pcm->card->dev, rpmsg->buffer_size); in imx_rpmsg_pcm_new()
631 info = work_of_rpmsg->info; in imx_rpmsg_pcm_work()
639 spin_lock_irqsave(&info->lock[TX], flags); in imx_rpmsg_pcm_work()
640 if (info->notify_updated[TX]) { in imx_rpmsg_pcm_work()
641 memcpy(&msg, &info->notify[TX], sizeof(struct rpmsg_s_msg)); in imx_rpmsg_pcm_work()
642 info->notify_updated[TX] = false; in imx_rpmsg_pcm_work()
643 spin_unlock_irqrestore(&info->lock[TX], flags); in imx_rpmsg_pcm_work()
644 info->send_message(&msg, info); in imx_rpmsg_pcm_work()
646 spin_unlock_irqrestore(&info->lock[TX], flags); in imx_rpmsg_pcm_work()
649 spin_lock_irqsave(&info->lock[RX], flags); in imx_rpmsg_pcm_work()
650 if (info->notify_updated[RX]) { in imx_rpmsg_pcm_work()
651 memcpy(&msg, &info->notify[RX], sizeof(struct rpmsg_s_msg)); in imx_rpmsg_pcm_work()
652 info->notify_updated[RX] = false; in imx_rpmsg_pcm_work()
653 spin_unlock_irqrestore(&info->lock[RX], flags); in imx_rpmsg_pcm_work()
654 info->send_message(&msg, info); in imx_rpmsg_pcm_work()
656 spin_unlock_irqrestore(&info->lock[RX], flags); 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()
669 spin_lock_irqsave(&info->wq_lock, flags); in imx_rpmsg_pcm_work()
670 info->work_read_index++; in imx_rpmsg_pcm_work()
671 info->work_read_index %= WORK_MAX_NUM; in imx_rpmsg_pcm_work()
672 spin_unlock_irqrestore(&info->wq_lock, flags); in imx_rpmsg_pcm_work()
681 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); in imx_rpmsg_pcm_probe()
683 return -ENOMEM; in imx_rpmsg_pcm_probe()
687 info->rpdev = container_of(pdev->dev.parent, struct rpmsg_device, dev); in imx_rpmsg_pcm_probe()
688 info->dev = &pdev->dev; in imx_rpmsg_pcm_probe()
690 info->rpmsg_wq = alloc_ordered_workqueue(info->rpdev->id.name, in imx_rpmsg_pcm_probe()
694 if (!info->rpmsg_wq) { in imx_rpmsg_pcm_probe()
695 dev_err(&pdev->dev, "workqueue create failed\n"); in imx_rpmsg_pcm_probe()
696 return -ENOMEM; in imx_rpmsg_pcm_probe()
700 info->work_write_index = 1; in imx_rpmsg_pcm_probe()
701 info->send_message = imx_rpmsg_pcm_send_message; in imx_rpmsg_pcm_probe()
704 INIT_WORK(&info->work_list[i].work, imx_rpmsg_pcm_work); in imx_rpmsg_pcm_probe()
705 info->work_list[i].info = info; in imx_rpmsg_pcm_probe()
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()
717 init_completion(&info->cmd_complete); in imx_rpmsg_pcm_probe()
718 mutex_init(&info->msg_lock); in imx_rpmsg_pcm_probe()
719 spin_lock_init(&info->lock[TX]); in imx_rpmsg_pcm_probe()
720 spin_lock_init(&info->lock[RX]); in imx_rpmsg_pcm_probe()
721 spin_lock_init(&info->wq_lock); in imx_rpmsg_pcm_probe()
723 ret = devm_snd_soc_register_component(&pdev->dev, in imx_rpmsg_pcm_probe()
729 component = snd_soc_lookup_component(&pdev->dev, NULL); in imx_rpmsg_pcm_probe()
731 ret = -EINVAL; in imx_rpmsg_pcm_probe()
736 component->debugfs_prefix = "rpmsg"; in imx_rpmsg_pcm_probe()
742 if (info->rpmsg_wq) in imx_rpmsg_pcm_probe()
743 destroy_workqueue(info->rpmsg_wq); in imx_rpmsg_pcm_probe()
752 if (info->rpmsg_wq) in imx_rpmsg_pcm_remove()
753 destroy_workqueue(info->rpmsg_wq); in imx_rpmsg_pcm_remove()
760 cpu_latency_qos_add_request(&info->pm_qos_req, 0); in imx_rpmsg_pcm_runtime_resume()
769 cpu_latency_qos_remove_request(&info->pm_qos_req); in imx_rpmsg_pcm_runtime_suspend()
780 rpmsg_tx = &info->msg[TX_SUSPEND]; in imx_rpmsg_pcm_suspend()
781 rpmsg_rx = &info->msg[RX_SUSPEND]; in imx_rpmsg_pcm_suspend()
783 rpmsg_tx->s_msg.header.cmd = TX_SUSPEND; in imx_rpmsg_pcm_suspend()
784 info->send_message(rpmsg_tx, info); in imx_rpmsg_pcm_suspend()
786 rpmsg_rx->s_msg.header.cmd = RX_SUSPEND; in imx_rpmsg_pcm_suspend()
787 info->send_message(rpmsg_rx, info); in imx_rpmsg_pcm_suspend()
798 rpmsg_tx = &info->msg[TX_RESUME]; in imx_rpmsg_pcm_resume()
799 rpmsg_rx = &info->msg[RX_RESUME]; in imx_rpmsg_pcm_resume()
801 rpmsg_tx->s_msg.header.cmd = TX_RESUME; in imx_rpmsg_pcm_resume()
802 info->send_message(rpmsg_tx, info); in imx_rpmsg_pcm_resume()
804 rpmsg_rx->s_msg.header.cmd = RX_RESUME; in imx_rpmsg_pcm_resume()
805 info->send_message(rpmsg_rx, info); in imx_rpmsg_pcm_resume()
817 { .name = "rpmsg-audio-channel" },
818 { .name = "rpmsg-micfil-channel" },
834 MODULE_DESCRIPTION("Freescale SoC Audio RPMSG PCM interface");