• Home
  • Raw
  • Download

Lines Matching +full:dai +full:- +full:channels

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
22 #include <sound/soc-dai.h>
26 #define DRV_NAME "acp-pdm"
29 struct snd_soc_dai *dai) in acp_dmic_prepare() argument
31 struct acp_stream *stream = substream->runtime->private_data; in acp_dmic_prepare()
32 struct device *dev = dai->component->dev; in acp_dmic_prepare()
38 writel(PDM_CLK_FREQ_MASK, adata->acp_base + ACP_WOV_CLK_CTRL); in acp_dmic_prepare()
39 dmic_ctrl = readl(adata->acp_base + ACP_WOV_MISC_CTRL); in acp_dmic_prepare()
41 writel(dmic_ctrl, adata->acp_base + ACP_WOV_MISC_CTRL); in acp_dmic_prepare()
43 period_bytes = frames_to_bytes(substream->runtime, in acp_dmic_prepare()
44 substream->runtime->period_size); in acp_dmic_prepare()
45 size_dmic = frames_to_bytes(substream->runtime, in acp_dmic_prepare()
46 substream->runtime->buffer_size); in acp_dmic_prepare()
48 physical_addr = stream->reg_offset + MEM_WINDOW_START; in acp_dmic_prepare()
51 writel(physical_addr, adata->acp_base + ACP_WOV_RX_RINGBUFADDR); in acp_dmic_prepare()
52 writel(size_dmic, adata->acp_base + ACP_WOV_RX_RINGBUFSIZE); in acp_dmic_prepare()
53 writel(period_bytes, adata->acp_base + ACP_WOV_RX_INTR_WATERMARK_SIZE); in acp_dmic_prepare()
54 writel(0x01, adata->acp_base + ACPAXI2AXI_ATU_CTRL); in acp_dmic_prepare()
60 int cmd, struct snd_soc_dai *dai) in acp_dmic_dai_trigger() argument
62 struct device *dev = dai->component->dev; in acp_dmic_dai_trigger()
71 dma_enable = readl(adata->acp_base + ACP_WOV_PDM_DMA_ENABLE); in acp_dmic_dai_trigger()
73 writel(PDM_ENABLE, adata->acp_base + ACP_WOV_PDM_ENABLE); in acp_dmic_dai_trigger()
74 writel(PDM_ENABLE, adata->acp_base + ACP_WOV_PDM_DMA_ENABLE); in acp_dmic_dai_trigger()
77 ret = readl_poll_timeout_atomic(adata->acp_base + ACP_WOV_PDM_DMA_ENABLE, in acp_dmic_dai_trigger()
84 dma_enable = readl(adata->acp_base + ACP_WOV_PDM_DMA_ENABLE); in acp_dmic_dai_trigger()
86 writel(PDM_DISABLE, adata->acp_base + ACP_WOV_PDM_ENABLE); in acp_dmic_dai_trigger()
87 writel(PDM_DISABLE, adata->acp_base + ACP_WOV_PDM_DMA_ENABLE); in acp_dmic_dai_trigger()
91 ret = readl_poll_timeout_atomic(adata->acp_base + ACP_WOV_PDM_DMA_ENABLE, in acp_dmic_dai_trigger()
96 ret = -EINVAL; in acp_dmic_dai_trigger()
104 struct snd_pcm_hw_params *hwparams, struct snd_soc_dai *dai) in acp_dmic_hwparams() argument
106 struct device *dev = dai->component->dev; in acp_dmic_hwparams()
108 unsigned int channels, ch_mask; in acp_dmic_hwparams() local
110 channels = params_channels(hwparams); in acp_dmic_hwparams()
111 switch (channels) { in acp_dmic_hwparams()
122 dev_err(dev, "Invalid channels %d\n", channels); in acp_dmic_hwparams()
123 return -EINVAL; in acp_dmic_hwparams()
126 adata->ch_mask = ch_mask; in acp_dmic_hwparams()
128 dev_err(dai->dev, "Invalid format:%d\n", params_format(hwparams)); in acp_dmic_hwparams()
129 return -EINVAL; in acp_dmic_hwparams()
132 writel(ch_mask, adata->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS); in acp_dmic_hwparams()
133 writel(PDM_DEC_64, adata->acp_base + ACP_WOV_PDM_DECIMATION_FACTOR); in acp_dmic_hwparams()
139 struct snd_soc_dai *dai) in acp_dmic_dai_startup() argument
141 struct acp_stream *stream = substream->runtime->private_data; in acp_dmic_dai_startup()
142 struct device *dev = dai->component->dev; in acp_dmic_dai_startup()
146 stream->dai_id = DMIC_INSTANCE; in acp_dmic_dai_startup()
147 stream->irq_bit = BIT(PDM_DMA_STAT); in acp_dmic_dai_startup()
148 stream->pte_offset = ACP_SRAM_PDM_PTE_OFFSET; in acp_dmic_dai_startup()
149 stream->reg_offset = ACP_REGION2_OFFSET; in acp_dmic_dai_startup()
160 struct snd_soc_dai *dai) in acp_dmic_dai_shutdown() argument
162 struct device *dev = dai->component->dev; in acp_dmic_dai_shutdown()