Lines Matching +full:fifo +full:- +full:size
1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/dma-mapping.h>
11 #include <sound/soc-dai.h>
13 #include "aiu-fifo.h"
37 struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); in aiu_fifo_pointer() local
38 struct snd_pcm_runtime *runtime = substream->runtime; in aiu_fifo_pointer()
41 addr = snd_soc_component_read(component, fifo->mem_offset + AIU_MEM_RD); in aiu_fifo_pointer()
43 return bytes_to_frames(runtime, addr - (unsigned int)runtime->dma_addr); in aiu_fifo_pointer()
48 struct snd_soc_component *component = dai->component; in aiu_fifo_enable()
49 struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); in aiu_fifo_enable() local
54 fifo->mem_offset + AIU_MEM_CONTROL, in aiu_fifo_enable()
73 return -EINVAL; in aiu_fifo_trigger()
82 struct snd_soc_component *component = dai->component; in aiu_fifo_prepare()
83 struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); in aiu_fifo_prepare() local
86 fifo->mem_offset + AIU_MEM_CONTROL, in aiu_fifo_prepare()
90 fifo->mem_offset + AIU_MEM_CONTROL, in aiu_fifo_prepare()
99 struct snd_pcm_runtime *runtime = substream->runtime; in aiu_fifo_hw_params()
100 struct snd_soc_component *component = dai->component; in aiu_fifo_hw_params()
101 struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); in aiu_fifo_hw_params() local
104 /* Setup the fifo boundaries */ in aiu_fifo_hw_params()
105 end = runtime->dma_addr + runtime->dma_bytes - fifo->fifo_block; in aiu_fifo_hw_params()
106 snd_soc_component_write(component, fifo->mem_offset + AIU_MEM_START, in aiu_fifo_hw_params()
107 runtime->dma_addr); in aiu_fifo_hw_params()
108 snd_soc_component_write(component, fifo->mem_offset + AIU_MEM_RD, in aiu_fifo_hw_params()
109 runtime->dma_addr); in aiu_fifo_hw_params()
110 snd_soc_component_write(component, fifo->mem_offset + AIU_MEM_END, in aiu_fifo_hw_params()
113 /* Setup the fifo to read all the memory - no skip */ in aiu_fifo_hw_params()
115 fifo->mem_offset + AIU_MEM_MASKS, in aiu_fifo_hw_params()
135 struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); in aiu_fifo_startup() local
138 snd_soc_set_runtime_hwparams(substream, fifo->pcm); in aiu_fifo_startup()
141 * Make sure the buffer and period size are multiple of the fifo burst in aiu_fifo_startup()
142 * size in aiu_fifo_startup()
144 ret = snd_pcm_hw_constraint_step(substream->runtime, 0, in aiu_fifo_startup()
146 fifo->fifo_block); in aiu_fifo_startup()
150 ret = snd_pcm_hw_constraint_step(substream->runtime, 0, in aiu_fifo_startup()
152 fifo->fifo_block); in aiu_fifo_startup()
156 ret = clk_prepare_enable(fifo->pclk); in aiu_fifo_startup()
160 ret = request_irq(fifo->irq, aiu_fifo_isr, 0, dev_name(dai->dev), in aiu_fifo_startup()
163 clk_disable_unprepare(fifo->pclk); in aiu_fifo_startup()
171 struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); in aiu_fifo_shutdown() local
173 free_irq(fifo->irq, substream); in aiu_fifo_shutdown()
174 clk_disable_unprepare(fifo->pclk); in aiu_fifo_shutdown()
180 struct snd_card *card = rtd->card->snd_card; in aiu_fifo_pcm_new()
181 struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); in aiu_fifo_pcm_new() local
182 size_t size = fifo->pcm->buffer_bytes_max; in aiu_fifo_pcm_new() local
185 ret = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); in aiu_fifo_pcm_new()
189 snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, in aiu_fifo_pcm_new()
190 card->dev, size, size); in aiu_fifo_pcm_new()
197 struct aiu_fifo *fifo; in aiu_fifo_dai_probe() local
199 fifo = kzalloc(sizeof(*fifo), GFP_KERNEL); in aiu_fifo_dai_probe()
200 if (!fifo) in aiu_fifo_dai_probe()
201 return -ENOMEM; in aiu_fifo_dai_probe()
203 snd_soc_dai_dma_data_set_playback(dai, fifo); in aiu_fifo_dai_probe()
210 struct aiu_fifo *fifo = snd_soc_dai_dma_data_get_playback(dai); in aiu_fifo_dai_remove() local
212 kfree(fifo); in aiu_fifo_dai_remove()