Lines Matching +full:lpass +full:- +full:lpaif

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2010-2011,2013-2015 The Linux Foundation. All rights reserved.
5 * lpass-platform.c -- ALSA SoC platform driver for QTi LPASS
8 #include <dt-bindings/sound/qcom,lpass.h>
9 #include <linux/dma-mapping.h>
17 #include "lpass-lpaif-reg.h"
18 #include "lpass.h"
20 #define DRV_NAME "lpass-platform"
104 const struct lpass_variant *v = drvdata->variant; in lpass_platform_alloc_rxtx_dmactl_fields()
110 return -ENOMEM; in lpass_platform_alloc_rxtx_dmactl_fields()
114 return -ENOMEM; in lpass_platform_alloc_rxtx_dmactl_fields()
116 drvdata->rxtx_rd_dmactl = rd_dmactl; in lpass_platform_alloc_rxtx_dmactl_fields()
117 drvdata->rxtx_wr_dmactl = wr_dmactl; in lpass_platform_alloc_rxtx_dmactl_fields()
119 rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->intf, in lpass_platform_alloc_rxtx_dmactl_fields()
120 &v->rxtx_rdma_intf, LPASS_CDC_DMA_REGISTER_FIELDS_MAX); in lpass_platform_alloc_rxtx_dmactl_fields()
124 return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->intf, in lpass_platform_alloc_rxtx_dmactl_fields()
125 &v->rxtx_wrdma_intf, LPASS_CDC_DMA_REGISTER_FIELDS_MAX); in lpass_platform_alloc_rxtx_dmactl_fields()
132 const struct lpass_variant *v = drvdata->variant; in lpass_platform_alloc_va_dmactl_fields()
137 return -ENOMEM; in lpass_platform_alloc_va_dmactl_fields()
139 drvdata->va_wr_dmactl = wr_dmactl; in lpass_platform_alloc_va_dmactl_fields()
140 return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->intf, in lpass_platform_alloc_va_dmactl_fields()
141 &v->va_wrdma_intf, LPASS_CDC_DMA_REGISTER_FIELDS_MAX); in lpass_platform_alloc_va_dmactl_fields()
149 const struct lpass_variant *v = drvdata->variant; in lpass_platform_alloc_dmactl_fields()
153 drvdata->rd_dmactl = devm_kzalloc(dev, sizeof(struct lpaif_dmactl), in lpass_platform_alloc_dmactl_fields()
155 if (drvdata->rd_dmactl == NULL) in lpass_platform_alloc_dmactl_fields()
156 return -ENOMEM; in lpass_platform_alloc_dmactl_fields()
158 drvdata->wr_dmactl = devm_kzalloc(dev, sizeof(struct lpaif_dmactl), in lpass_platform_alloc_dmactl_fields()
160 if (drvdata->wr_dmactl == NULL) in lpass_platform_alloc_dmactl_fields()
161 return -ENOMEM; in lpass_platform_alloc_dmactl_fields()
163 rd_dmactl = drvdata->rd_dmactl; in lpass_platform_alloc_dmactl_fields()
164 wr_dmactl = drvdata->wr_dmactl; in lpass_platform_alloc_dmactl_fields()
166 rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->intf, in lpass_platform_alloc_dmactl_fields()
167 &v->rdma_intf, 6); in lpass_platform_alloc_dmactl_fields()
171 return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->intf, in lpass_platform_alloc_dmactl_fields()
172 &v->wrdma_intf, 6); in lpass_platform_alloc_dmactl_fields()
179 const struct lpass_variant *v = drvdata->variant; in lpass_platform_alloc_hdmidmactl_fields()
184 return -ENOMEM; in lpass_platform_alloc_hdmidmactl_fields()
186 drvdata->hdmi_rd_dmactl = rd_dmactl; in lpass_platform_alloc_hdmidmactl_fields()
188 return devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->bursten, in lpass_platform_alloc_hdmidmactl_fields()
189 &v->hdmi_rdma_bursten, 8); in lpass_platform_alloc_hdmidmactl_fields()
195 struct snd_pcm_runtime *runtime = substream->runtime; in lpass_platform_pcmops_open()
199 const struct lpass_variant *v = drvdata->variant; in lpass_platform_pcmops_open()
200 int ret, dma_ch, dir = substream->stream; in lpass_platform_pcmops_open()
203 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcmops_open()
205 component->id = dai_id; in lpass_platform_pcmops_open()
208 return -ENOMEM; in lpass_platform_pcmops_open()
210 data->i2s_port = cpu_dai->driver->id; in lpass_platform_pcmops_open()
211 runtime->private_data = data; in lpass_platform_pcmops_open()
213 if (v->alloc_dma_channel) in lpass_platform_pcmops_open()
214 dma_ch = v->alloc_dma_channel(drvdata, dir, dai_id); in lpass_platform_pcmops_open()
225 map = drvdata->lpaif_map; in lpass_platform_pcmops_open()
226 drvdata->substream[dma_ch] = substream; in lpass_platform_pcmops_open()
229 map = drvdata->hdmiif_map; in lpass_platform_pcmops_open()
230 drvdata->hdmi_substream[dma_ch] = substream; in lpass_platform_pcmops_open()
234 map = drvdata->rxtx_lpaif_map; in lpass_platform_pcmops_open()
235 drvdata->rxtx_substream[dma_ch] = substream; in lpass_platform_pcmops_open()
238 map = drvdata->va_lpaif_map; in lpass_platform_pcmops_open()
239 drvdata->va_substream[dma_ch] = substream; in lpass_platform_pcmops_open()
245 data->dma_ch = dma_ch; in lpass_platform_pcmops_open()
249 ret = regmap_write(map, LPAIF_DMACTL_REG(v, dma_ch, dir, data->i2s_port), 0); in lpass_platform_pcmops_open()
252 dev_err(soc_runtime->dev, "error writing to rdmactl reg: %d\n", ret); in lpass_platform_pcmops_open()
256 runtime->dma_bytes = lpass_platform_pcm_hardware.buffer_bytes_max; in lpass_platform_pcmops_open()
261 runtime->dma_bytes = lpass_platform_rxtx_hardware.buffer_bytes_max; in lpass_platform_pcmops_open()
262 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); in lpass_platform_pcmops_open()
266 runtime->dma_bytes = lpass_platform_va_hardware.buffer_bytes_max; in lpass_platform_pcmops_open()
267 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer); in lpass_platform_pcmops_open()
276 dev_err(soc_runtime->dev, "setting constraints failed: %d\n", in lpass_platform_pcmops_open()
278 return -EINVAL; in lpass_platform_pcmops_open()
287 struct snd_pcm_runtime *runtime = substream->runtime; in lpass_platform_pcmops_close()
291 const struct lpass_variant *v = drvdata->variant; in lpass_platform_pcmops_close()
293 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcmops_close()
295 data = runtime->private_data; in lpass_platform_pcmops_close()
299 drvdata->substream[data->dma_ch] = NULL; in lpass_platform_pcmops_close()
302 drvdata->hdmi_substream[data->dma_ch] = NULL; in lpass_platform_pcmops_close()
306 drvdata->rxtx_substream[data->dma_ch] = NULL; in lpass_platform_pcmops_close()
309 drvdata->va_substream[data->dma_ch] = NULL; in lpass_platform_pcmops_close()
315 if (v->free_dma_channel) in lpass_platform_pcmops_close()
316 v->free_dma_channel(drvdata, data->dma_ch, dai_id); in lpass_platform_pcmops_close()
330 switch (cpu_dai->driver->id) { in __lpass_get_dmactl_handle()
332 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in __lpass_get_dmactl_handle()
333 dmactl = drvdata->rd_dmactl; in __lpass_get_dmactl_handle()
335 dmactl = drvdata->wr_dmactl; in __lpass_get_dmactl_handle()
338 dmactl = drvdata->hdmi_rd_dmactl; in __lpass_get_dmactl_handle()
341 dmactl = drvdata->rxtx_rd_dmactl; in __lpass_get_dmactl_handle()
344 dmactl = drvdata->rxtx_wr_dmactl; in __lpass_get_dmactl_handle()
347 dmactl = drvdata->va_wr_dmactl; in __lpass_get_dmactl_handle()
360 struct snd_pcm_runtime *rt = substream->runtime; in __lpass_get_id()
361 struct lpass_pcm_data *pcm_data = rt->private_data; in __lpass_get_id()
362 const struct lpass_variant *v = drvdata->variant; in __lpass_get_id()
365 switch (cpu_dai->driver->id) { in __lpass_get_id()
367 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in __lpass_get_id()
368 id = pcm_data->dma_ch; in __lpass_get_id()
370 id = pcm_data->dma_ch - v->wrdma_channel_start; in __lpass_get_id()
373 id = pcm_data->dma_ch; in __lpass_get_id()
376 id = pcm_data->dma_ch; in __lpass_get_id()
379 id = pcm_data->dma_ch - v->rxtx_wrdma_channel_start; in __lpass_get_id()
382 id = pcm_data->dma_ch - v->va_wrdma_channel_start; in __lpass_get_id()
397 switch (cpu_dai->driver->id) { in __lpass_get_regmap_handle()
399 map = drvdata->lpaif_map; in __lpass_get_regmap_handle()
402 map = drvdata->hdmiif_map; in __lpass_get_regmap_handle()
406 map = drvdata->rxtx_lpaif_map; in __lpass_get_regmap_handle()
409 map = drvdata->va_lpaif_map; in __lpass_get_regmap_handle()
423 struct snd_pcm_runtime *rt = substream->runtime; in lpass_platform_pcmops_hw_params()
424 struct lpass_pcm_data *pcm_data = rt->private_data; in lpass_platform_pcmops_hw_params()
425 const struct lpass_variant *v = drvdata->variant; in lpass_platform_pcmops_hw_params()
432 int ret, dma_port = pcm_data->i2s_port + v->dmactl_audif_start; in lpass_platform_pcmops_hw_params()
433 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcmops_hw_params()
440 dev_err(soc_runtime->dev, "invalid bit width given: %d\n", in lpass_platform_pcmops_hw_params()
445 ret = regmap_fields_write(dmactl->bursten, id, LPAIF_DMACTL_BURSTEN_INCR4); in lpass_platform_pcmops_hw_params()
447 dev_err(soc_runtime->dev, "error updating bursten field: %d\n", ret); in lpass_platform_pcmops_hw_params()
451 ret = regmap_fields_write(dmactl->fifowm, id, LPAIF_DMACTL_FIFOWM_8); in lpass_platform_pcmops_hw_params()
453 dev_err(soc_runtime->dev, "error updating fifowm field: %d\n", ret); in lpass_platform_pcmops_hw_params()
459 ret = regmap_fields_write(dmactl->burst8, id, in lpass_platform_pcmops_hw_params()
462 dev_err(soc_runtime->dev, "error updating burst8en field: %d\n", ret); in lpass_platform_pcmops_hw_params()
465 ret = regmap_fields_write(dmactl->burst16, id, in lpass_platform_pcmops_hw_params()
468 dev_err(soc_runtime->dev, "error updating burst16en field: %d\n", ret); in lpass_platform_pcmops_hw_params()
471 ret = regmap_fields_write(dmactl->dynburst, id, in lpass_platform_pcmops_hw_params()
474 dev_err(soc_runtime->dev, "error updating dynbursten field: %d\n", ret); in lpass_platform_pcmops_hw_params()
483 ret = regmap_fields_write(dmactl->intf, id, in lpass_platform_pcmops_hw_params()
486 dev_err(soc_runtime->dev, "error updating audio interface field: %d\n", in lpass_platform_pcmops_hw_params()
497 dev_err(soc_runtime->dev, "%s: invalid interface: %d\n", __func__, dai_id); in lpass_platform_pcmops_hw_params()
517 dev_err(soc_runtime->dev, "invalid PCM config given: bw=%d, ch=%u\n", in lpass_platform_pcmops_hw_params()
519 return -EINVAL; in lpass_platform_pcmops_hw_params()
549 dev_err(soc_runtime->dev, "invalid PCM config given: bw=%d, ch=%u\n", in lpass_platform_pcmops_hw_params()
551 return -EINVAL; in lpass_platform_pcmops_hw_params()
555 dev_err(soc_runtime->dev, "invalid PCM config given: bw=%d, ch=%u\n", in lpass_platform_pcmops_hw_params()
557 return -EINVAL; in lpass_platform_pcmops_hw_params()
560 ret = regmap_fields_write(dmactl->wpscnt, id, regval); in lpass_platform_pcmops_hw_params()
562 dev_err(soc_runtime->dev, "error writing to dmactl reg: %d\n", in lpass_platform_pcmops_hw_params()
576 struct snd_pcm_runtime *rt = substream->runtime; in lpass_platform_pcmops_hw_free()
577 struct lpass_pcm_data *pcm_data = rt->private_data; in lpass_platform_pcmops_hw_free()
578 const struct lpass_variant *v = drvdata->variant; in lpass_platform_pcmops_hw_free()
582 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcmops_hw_free()
588 reg = LPAIF_DMACTL_REG(v, pcm_data->dma_ch, substream->stream, dai_id); in lpass_platform_pcmops_hw_free()
591 dev_err(soc_runtime->dev, "error writing to rdmactl reg: %d\n", in lpass_platform_pcmops_hw_free()
600 struct snd_pcm_runtime *runtime = substream->runtime; in lpass_platform_pcmops_prepare()
604 struct snd_pcm_runtime *rt = substream->runtime; in lpass_platform_pcmops_prepare()
605 struct lpass_pcm_data *pcm_data = rt->private_data; in lpass_platform_pcmops_prepare()
606 const struct lpass_variant *v = drvdata->variant; in lpass_platform_pcmops_prepare()
609 int ret, id, ch, dir = substream->stream; in lpass_platform_pcmops_prepare()
610 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcmops_prepare()
612 ch = pcm_data->dma_ch; in lpass_platform_pcmops_prepare()
619 runtime->dma_addr); in lpass_platform_pcmops_prepare()
621 dev_err(soc_runtime->dev, "error writing to rdmabase reg: %d\n", in lpass_platform_pcmops_prepare()
627 (snd_pcm_lib_buffer_bytes(substream) >> 2) - 1); in lpass_platform_pcmops_prepare()
629 dev_err(soc_runtime->dev, "error writing to rdmabuff reg: %d\n", in lpass_platform_pcmops_prepare()
635 (snd_pcm_lib_period_bytes(substream) >> 2) - 1); in lpass_platform_pcmops_prepare()
637 dev_err(soc_runtime->dev, "error writing to rdmaper reg: %d\n", in lpass_platform_pcmops_prepare()
643 ret = regmap_fields_write(dmactl->fifowm, id, LPAIF_DMACTL_FIFOWM_8); in lpass_platform_pcmops_prepare()
645 dev_err(soc_runtime->dev, "error writing fifowm field to dmactl reg: %d, id: %d\n", in lpass_platform_pcmops_prepare()
650 ret = regmap_fields_write(dmactl->enable, id, LPAIF_DMACTL_ENABLE_ON); in lpass_platform_pcmops_prepare()
652 dev_err(soc_runtime->dev, "error writing to rdmactl reg: %d\n", in lpass_platform_pcmops_prepare()
667 struct snd_pcm_runtime *rt = substream->runtime; in lpass_platform_pcmops_trigger()
668 struct lpass_pcm_data *pcm_data = rt->private_data; in lpass_platform_pcmops_trigger()
669 const struct lpass_variant *v = drvdata->variant; in lpass_platform_pcmops_trigger()
675 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcmops_trigger()
677 ch = pcm_data->dma_ch; in lpass_platform_pcmops_trigger()
686 ret = regmap_fields_write(dmactl->enable, id, in lpass_platform_pcmops_trigger()
689 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
695 ret = regmap_fields_write(dmactl->dyncclk, id, in lpass_platform_pcmops_trigger()
698 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
733 ret = regmap_fields_write(dmactl->dyncclk, id, LPAIF_DMACTL_DYNCLK_ON); in lpass_platform_pcmops_trigger()
735 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
747 ret = regmap_fields_write(dmactl->dyncclk, id, LPAIF_DMACTL_DYNCLK_ON); in lpass_platform_pcmops_trigger()
749 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
761 dev_err(soc_runtime->dev, "%s: invalid %d interface\n", __func__, dai_id); in lpass_platform_pcmops_trigger()
762 return -EINVAL; in lpass_platform_pcmops_trigger()
767 dev_err(soc_runtime->dev, "error writing to irqclear reg: %d\n", ret); in lpass_platform_pcmops_trigger()
772 dev_err(soc_runtime->dev, "error writing to irqen reg: %d\n", ret); in lpass_platform_pcmops_trigger()
779 ret = regmap_fields_write(dmactl->enable, id, in lpass_platform_pcmops_trigger()
782 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
788 ret = regmap_fields_write(dmactl->dyncclk, id, in lpass_platform_pcmops_trigger()
791 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
813 ret = regmap_fields_write(dmactl->dyncclk, id, LPAIF_DMACTL_DYNCLK_OFF); in lpass_platform_pcmops_trigger()
815 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
828 ret = regmap_fields_write(dmactl->dyncclk, id, LPAIF_DMACTL_DYNCLK_OFF); in lpass_platform_pcmops_trigger()
830 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
843 dev_err(soc_runtime->dev, "%s: invalid %d interface\n", __func__, dai_id); in lpass_platform_pcmops_trigger()
844 return -EINVAL; in lpass_platform_pcmops_trigger()
849 dev_err(soc_runtime->dev, in lpass_platform_pcmops_trigger()
866 struct snd_pcm_runtime *rt = substream->runtime; in lpass_platform_pcmops_pointer()
867 struct lpass_pcm_data *pcm_data = rt->private_data; in lpass_platform_pcmops_pointer()
868 const struct lpass_variant *v = drvdata->variant; in lpass_platform_pcmops_pointer()
870 int ret, ch, dir = substream->stream; in lpass_platform_pcmops_pointer()
872 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcmops_pointer()
875 ch = pcm_data->dma_ch; in lpass_platform_pcmops_pointer()
880 dev_err(soc_runtime->dev, in lpass_platform_pcmops_pointer()
888 dev_err(soc_runtime->dev, in lpass_platform_pcmops_pointer()
893 return bytes_to_frames(substream->runtime, curr_addr - base_addr); in lpass_platform_pcmops_pointer()
899 struct snd_pcm_runtime *runtime = substream->runtime; in lpass_platform_cdc_dma_mmap()
902 vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); in lpass_platform_cdc_dma_mmap()
903 size = vma->vm_end - vma->vm_start; in lpass_platform_cdc_dma_mmap()
904 offset = vma->vm_pgoff << PAGE_SHIFT; in lpass_platform_cdc_dma_mmap()
905 return io_remap_pfn_range(vma, vma->vm_start, in lpass_platform_cdc_dma_mmap()
906 (runtime->dma_addr + offset) >> PAGE_SHIFT, in lpass_platform_cdc_dma_mmap()
907 size, vma->vm_page_prot); in lpass_platform_cdc_dma_mmap()
917 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcmops_mmap()
932 const struct lpass_variant *v = drvdata->variant; in lpass_dma_interrupt_handler()
937 unsigned int dai_id = cpu_dai->driver->id; in lpass_dma_interrupt_handler()
942 map = drvdata->hdmiif_map; in lpass_dma_interrupt_handler()
953 map = drvdata->lpaif_map; in lpass_dma_interrupt_handler()
959 map = drvdata->rxtx_lpaif_map; in lpass_dma_interrupt_handler()
964 map = drvdata->va_lpaif_map; in lpass_dma_interrupt_handler()
969 dev_err(soc_runtime->dev, "%s: invalid %d interface\n", __func__, dai_id); in lpass_dma_interrupt_handler()
970 return -EINVAL; in lpass_dma_interrupt_handler()
975 dev_err(soc_runtime->dev, in lpass_dma_interrupt_handler()
986 dev_err(soc_runtime->dev, in lpass_dma_interrupt_handler()
990 dev_warn_ratelimited(soc_runtime->dev, "xrun warning\n"); in lpass_dma_interrupt_handler()
999 dev_err(soc_runtime->dev, in lpass_dma_interrupt_handler()
1003 dev_err(soc_runtime->dev, "bus access error\n"); in lpass_dma_interrupt_handler()
1011 dev_err(soc_runtime->dev, in lpass_dma_interrupt_handler()
1024 const struct lpass_variant *v = drvdata->variant; in lpass_platform_lpaif_irq()
1028 rv = regmap_read(drvdata->lpaif_map, in lpass_platform_lpaif_irq()
1037 if (irqs & LPAIF_IRQ_ALL(chan) && drvdata->substream[chan]) { in lpass_platform_lpaif_irq()
1039 drvdata->substream[chan], in lpass_platform_lpaif_irq()
1052 const struct lpass_variant *v = drvdata->variant; in lpass_platform_hdmiif_irq()
1056 rv = regmap_read(drvdata->hdmiif_map, in lpass_platform_hdmiif_irq()
1068 && drvdata->hdmi_substream[chan]) { in lpass_platform_hdmiif_irq()
1070 drvdata->hdmi_substream[chan], in lpass_platform_hdmiif_irq()
1082 const struct lpass_variant *v = drvdata->variant; in lpass_platform_rxtxif_irq()
1087 rv = regmap_read(drvdata->rxtx_lpaif_map, in lpass_platform_rxtxif_irq()
1092 if (irqs & LPAIF_IRQ_ALL(chan) && drvdata->rxtx_substream[chan]) { in lpass_platform_rxtxif_irq()
1094 drvdata->rxtx_substream[chan], in lpass_platform_rxtxif_irq()
1107 const struct lpass_variant *v = drvdata->variant; in lpass_platform_vaif_irq()
1112 rv = regmap_read(drvdata->va_lpaif_map, in lpass_platform_vaif_irq()
1117 if (irqs & LPAIF_IRQ_ALL(chan) && drvdata->va_substream[chan]) { in lpass_platform_vaif_irq()
1119 drvdata->va_substream[chan], in lpass_platform_vaif_irq()
1135 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) in lpass_platform_prealloc_cdc_dma_buffer()
1136 substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; in lpass_platform_prealloc_cdc_dma_buffer()
1138 substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; in lpass_platform_prealloc_cdc_dma_buffer()
1140 buf = &substream->dma_buffer; in lpass_platform_prealloc_cdc_dma_buffer()
1141 buf->dev.dev = pcm->card->dev; in lpass_platform_prealloc_cdc_dma_buffer()
1142 buf->private_data = NULL; in lpass_platform_prealloc_cdc_dma_buffer()
1145 buf->dev.type = SNDRV_DMA_TYPE_CONTINUOUS; in lpass_platform_prealloc_cdc_dma_buffer()
1149 buf->bytes = lpass_platform_rxtx_hardware.buffer_bytes_max; in lpass_platform_prealloc_cdc_dma_buffer()
1150 buf->addr = drvdata->rxtx_cdc_dma_lpm_buf; in lpass_platform_prealloc_cdc_dma_buffer()
1153 buf->bytes = lpass_platform_rxtx_hardware.buffer_bytes_max; in lpass_platform_prealloc_cdc_dma_buffer()
1154 buf->addr = drvdata->rxtx_cdc_dma_lpm_buf + LPASS_RXTX_CDC_DMA_LPM_BUFF_SIZE; in lpass_platform_prealloc_cdc_dma_buffer()
1157 buf->bytes = lpass_platform_va_hardware.buffer_bytes_max; in lpass_platform_prealloc_cdc_dma_buffer()
1158 buf->addr = drvdata->va_cdc_dma_lpm_buf; in lpass_platform_prealloc_cdc_dma_buffer()
1164 buf->area = (unsigned char * __force)memremap(buf->addr, buf->bytes, MEMREMAP_WC); in lpass_platform_prealloc_cdc_dma_buffer()
1172 struct snd_pcm *pcm = soc_runtime->pcm; in lpass_platform_pcm_new()
1174 unsigned int dai_id = cpu_dai->driver->id; in lpass_platform_pcm_new()
1179 * Lpass codec dma can access only lpass lpm hardware memory. in lpass_platform_pcm_new()
1186 component->dev, size); in lpass_platform_pcm_new()
1193 unsigned int dai_id = component->id; in lpass_platform_pcmops_suspend()
1196 map = drvdata->hdmiif_map; in lpass_platform_pcmops_suspend()
1198 map = drvdata->lpaif_map; in lpass_platform_pcmops_suspend()
1210 unsigned int dai_id = component->id; in lpass_platform_pcmops_resume()
1213 map = drvdata->hdmiif_map; in lpass_platform_pcmops_resume()
1215 map = drvdata->lpaif_map; in lpass_platform_pcmops_resume()
1226 struct snd_pcm_runtime *rt = substream->runtime; in lpass_platform_copy()
1227 unsigned int dai_id = component->id; in lpass_platform_copy()
1230 void __iomem *dma_buf = (void __iomem *) (rt->dma_area + pos + in lpass_platform_copy()
1231 channel * (rt->dma_bytes / rt->channels)); in lpass_platform_copy()
1233 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in lpass_platform_copy()
1238 ret = -EFAULT; in lpass_platform_copy()
1240 } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { in lpass_platform_copy()
1245 ret = -EFAULT; in lpass_platform_copy()
1272 const struct lpass_variant *v = drvdata->variant; in asoc_qcom_lpass_platform_register()
1275 drvdata->lpaif_irq = platform_get_irq_byname(pdev, "lpass-irq-lpaif"); in asoc_qcom_lpass_platform_register()
1276 if (drvdata->lpaif_irq < 0) in asoc_qcom_lpass_platform_register()
1277 return -ENODEV; in asoc_qcom_lpass_platform_register()
1280 ret = regmap_write(drvdata->lpaif_map, in asoc_qcom_lpass_platform_register()
1283 dev_err(&pdev->dev, "error writing to irqen reg: %d\n", ret); in asoc_qcom_lpass_platform_register()
1287 ret = devm_request_irq(&pdev->dev, drvdata->lpaif_irq, in asoc_qcom_lpass_platform_register()
1289 "lpass-irq-lpaif", drvdata); in asoc_qcom_lpass_platform_register()
1291 dev_err(&pdev->dev, "irq request failed: %d\n", ret); in asoc_qcom_lpass_platform_register()
1295 ret = lpass_platform_alloc_dmactl_fields(&pdev->dev, in asoc_qcom_lpass_platform_register()
1296 drvdata->lpaif_map); in asoc_qcom_lpass_platform_register()
1298 dev_err(&pdev->dev, in asoc_qcom_lpass_platform_register()
1303 if (drvdata->codec_dma_enable) { in asoc_qcom_lpass_platform_register()
1304 ret = regmap_write(drvdata->rxtx_lpaif_map, in asoc_qcom_lpass_platform_register()
1307 dev_err(&pdev->dev, "error writing to rxtx irqen reg: %d\n", ret); in asoc_qcom_lpass_platform_register()
1310 ret = regmap_write(drvdata->va_lpaif_map, in asoc_qcom_lpass_platform_register()
1313 dev_err(&pdev->dev, "error writing to rxtx irqen reg: %d\n", ret); in asoc_qcom_lpass_platform_register()
1316 drvdata->rxtxif_irq = platform_get_irq_byname(pdev, "lpass-irq-rxtxif"); in asoc_qcom_lpass_platform_register()
1317 if (drvdata->rxtxif_irq < 0) in asoc_qcom_lpass_platform_register()
1318 return -ENODEV; in asoc_qcom_lpass_platform_register()
1320 ret = devm_request_irq(&pdev->dev, drvdata->rxtxif_irq, in asoc_qcom_lpass_platform_register()
1321 lpass_platform_rxtxif_irq, 0, "lpass-irq-rxtxif", drvdata); in asoc_qcom_lpass_platform_register()
1323 dev_err(&pdev->dev, "rxtx irq request failed: %d\n", ret); in asoc_qcom_lpass_platform_register()
1327 ret = lpass_platform_alloc_rxtx_dmactl_fields(&pdev->dev, in asoc_qcom_lpass_platform_register()
1328 drvdata->rxtx_lpaif_map); in asoc_qcom_lpass_platform_register()
1330 dev_err(&pdev->dev, in asoc_qcom_lpass_platform_register()
1335 drvdata->vaif_irq = platform_get_irq_byname(pdev, "lpass-irq-vaif"); in asoc_qcom_lpass_platform_register()
1336 if (drvdata->vaif_irq < 0) in asoc_qcom_lpass_platform_register()
1337 return -ENODEV; in asoc_qcom_lpass_platform_register()
1339 ret = devm_request_irq(&pdev->dev, drvdata->vaif_irq, in asoc_qcom_lpass_platform_register()
1340 lpass_platform_vaif_irq, 0, "lpass-irq-vaif", drvdata); in asoc_qcom_lpass_platform_register()
1342 dev_err(&pdev->dev, "va irq request failed: %d\n", ret); in asoc_qcom_lpass_platform_register()
1346 ret = lpass_platform_alloc_va_dmactl_fields(&pdev->dev, in asoc_qcom_lpass_platform_register()
1347 drvdata->va_lpaif_map); in asoc_qcom_lpass_platform_register()
1349 dev_err(&pdev->dev, in asoc_qcom_lpass_platform_register()
1355 if (drvdata->hdmi_port_enable) { in asoc_qcom_lpass_platform_register()
1356 drvdata->hdmiif_irq = platform_get_irq_byname(pdev, "lpass-irq-hdmi"); in asoc_qcom_lpass_platform_register()
1357 if (drvdata->hdmiif_irq < 0) in asoc_qcom_lpass_platform_register()
1358 return -ENODEV; in asoc_qcom_lpass_platform_register()
1360 ret = devm_request_irq(&pdev->dev, drvdata->hdmiif_irq, in asoc_qcom_lpass_platform_register()
1361 lpass_platform_hdmiif_irq, 0, "lpass-irq-hdmi", drvdata); in asoc_qcom_lpass_platform_register()
1363 dev_err(&pdev->dev, "irq hdmi request failed: %d\n", ret); in asoc_qcom_lpass_platform_register()
1366 ret = regmap_write(drvdata->hdmiif_map, in asoc_qcom_lpass_platform_register()
1369 dev_err(&pdev->dev, "error writing to hdmi irqen reg: %d\n", ret); in asoc_qcom_lpass_platform_register()
1373 ret = lpass_platform_alloc_hdmidmactl_fields(&pdev->dev, in asoc_qcom_lpass_platform_register()
1374 drvdata->hdmiif_map); in asoc_qcom_lpass_platform_register()
1376 dev_err(&pdev->dev, in asoc_qcom_lpass_platform_register()
1381 return devm_snd_soc_register_component(&pdev->dev, in asoc_qcom_lpass_platform_register()
1386 MODULE_DESCRIPTION("QTi LPASS Platform Driver");