Lines Matching +full:lpass +full:- +full:lpaif
1 // SPDX-License-Identifier: GPL-2.0-only
5 * lpass-cdc-dma.c -- ALSA SoC CDC DMA CPU DAI driver for QTi LPASS
8 #include <dt-bindings/sound/qcom,lpass.h>
13 #include <sound/soc-dai.h>
15 #include "lpass-lpaif-reg.h"
16 #include "lpass.h"
39 struct snd_pcm_runtime *rt = substream->runtime; in __lpass_get_dmactl_handle()
40 struct lpass_pcm_data *pcm_data = rt->private_data; in __lpass_get_dmactl_handle()
41 const struct lpass_variant *v = drvdata->variant; in __lpass_get_dmactl_handle()
42 unsigned int dai_id = cpu_dai->driver->id; in __lpass_get_dmactl_handle()
46 *dmactl = drvdata->rxtx_rd_dmactl; in __lpass_get_dmactl_handle()
47 *id = pcm_data->dma_ch; in __lpass_get_dmactl_handle()
50 *dmactl = drvdata->rxtx_wr_dmactl; in __lpass_get_dmactl_handle()
51 *id = pcm_data->dma_ch - v->rxtx_wrdma_channel_start; in __lpass_get_dmactl_handle()
54 *dmactl = drvdata->va_wr_dmactl; in __lpass_get_dmactl_handle()
55 *id = pcm_data->dma_ch - v->va_wrdma_channel_start; in __lpass_get_dmactl_handle()
58 dev_err(soc_runtime->dev, "invalid dai id for dma ctl: %d\n", dai_id); in __lpass_get_dmactl_handle()
117 ret = -EINVAL; in __lpass_get_codec_dma_intf_type()
129 struct device *dev = soc_runtime->dev; in __lpass_platform_codec_intf_init()
131 unsigned int dai_id = cpu_dai->driver->id; in __lpass_platform_codec_intf_init()
141 return -EINVAL; in __lpass_platform_codec_intf_init()
143 ret = regmap_fields_write(dmactl->codec_intf, id, codec_intf); in __lpass_platform_codec_intf_init()
148 ret = regmap_fields_write(dmactl->codec_fs_sel, id, 0x0); in __lpass_platform_codec_intf_init()
153 ret = regmap_fields_write(dmactl->codec_fs_delay, id, 0x0); in __lpass_platform_codec_intf_init()
158 ret = regmap_fields_write(dmactl->codec_pack, id, 0x1); in __lpass_platform_codec_intf_init()
163 ret = regmap_fields_write(dmactl->codec_enable, id, LPAIF_DMACTL_ENABLE_ON); in __lpass_platform_codec_intf_init()
177 switch (dai->id) { in lpass_cdc_dma_daiops_startup()
180 clk_set_rate(drvdata->codec_mem0, CODEC_MEM_HZ_NORMAL); in lpass_cdc_dma_daiops_startup()
181 clk_prepare_enable(drvdata->codec_mem0); in lpass_cdc_dma_daiops_startup()
184 clk_set_rate(drvdata->va_mem0, CODEC_MEM_HZ_NORMAL); in lpass_cdc_dma_daiops_startup()
185 clk_prepare_enable(drvdata->va_mem0); in lpass_cdc_dma_daiops_startup()
188 dev_err(soc_runtime->dev, "%s: invalid interface: %d\n", __func__, dai->id); in lpass_cdc_dma_daiops_startup()
200 switch (dai->id) { in lpass_cdc_dma_daiops_shutdown()
203 clk_disable_unprepare(drvdata->codec_mem0); in lpass_cdc_dma_daiops_shutdown()
206 clk_disable_unprepare(drvdata->va_mem0); in lpass_cdc_dma_daiops_shutdown()
209 dev_err(soc_runtime->dev, "%s: invalid interface: %d\n", __func__, dai->id); in lpass_cdc_dma_daiops_shutdown()
241 dev_err(soc_runtime->dev, "invalid PCM config\n"); in lpass_cdc_dma_daiops_hw_params()
242 return -EINVAL; in lpass_cdc_dma_daiops_hw_params()
247 return -EINVAL; in lpass_cdc_dma_daiops_hw_params()
249 ret = regmap_fields_write(dmactl->codec_channel, id, regval); in lpass_cdc_dma_daiops_hw_params()
251 dev_err(soc_runtime->dev, in lpass_cdc_dma_daiops_hw_params()
276 return -EINVAL; in lpass_cdc_dma_daiops_trigger()
278 ret = regmap_fields_write(dmactl->codec_enable, id, LPAIF_DMACTL_ENABLE_OFF); in lpass_cdc_dma_daiops_trigger()
280 dev_err(soc_runtime->dev, in lpass_cdc_dma_daiops_trigger()
286 ret = -EINVAL; in lpass_cdc_dma_daiops_trigger()
287 dev_err(soc_runtime->dev, "%s: invalid %d interface\n", __func__, cmd); in lpass_cdc_dma_daiops_trigger()
301 MODULE_DESCRIPTION("QTi LPASS CDC DMA Driver");