Lines Matching +full:imx8mp +full:- +full:aud2htx
1 // SPDX-License-Identifier: GPL-2.0+
5 #include <linux/clk-provider.h>
18 #include <linux/dma-mapping.h>
21 #include "imx-pcm.h"
26 struct fsl_aud2htx *aud2htx = snd_soc_dai_get_drvdata(dai); in fsl_aud2htx_trigger() local
32 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL, in fsl_aud2htx_trigger()
34 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_trigger()
40 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_trigger()
42 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL, in fsl_aud2htx_trigger()
46 return -EINVAL; in fsl_aud2htx_trigger()
53 struct fsl_aud2htx *aud2htx = dev_get_drvdata(cpu_dai->dev); in fsl_aud2htx_dai_probe() local
56 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_dai_probe()
60 regmap_update_bits(aud2htx->regmap, AUD2HTX_IRQ_MASK, in fsl_aud2htx_dai_probe()
69 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_dai_probe()
72 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_dai_probe()
76 snd_soc_dai_init_dma_data(cpu_dai, &aud2htx->dma_params_tx, in fsl_aud2htx_dai_probe()
77 &aud2htx->dma_params_rx); in fsl_aud2htx_dai_probe()
89 .stream_name = "CPU-Playback",
105 .name = "fsl-aud2htx",
176 { .compatible = "fsl,imx8mp-aud2htx",},
188 struct fsl_aud2htx *aud2htx; in fsl_aud2htx_probe() local
193 aud2htx = devm_kzalloc(&pdev->dev, sizeof(*aud2htx), GFP_KERNEL); in fsl_aud2htx_probe()
194 if (!aud2htx) in fsl_aud2htx_probe()
195 return -ENOMEM; in fsl_aud2htx_probe()
197 aud2htx->pdev = pdev; in fsl_aud2htx_probe()
203 aud2htx->regmap = devm_regmap_init_mmio(&pdev->dev, regs, in fsl_aud2htx_probe()
205 if (IS_ERR(aud2htx->regmap)) { in fsl_aud2htx_probe()
206 dev_err(&pdev->dev, "failed to init regmap"); in fsl_aud2htx_probe()
207 return PTR_ERR(aud2htx->regmap); in fsl_aud2htx_probe()
214 ret = devm_request_irq(&pdev->dev, irq, fsl_aud2htx_isr, 0, in fsl_aud2htx_probe()
215 dev_name(&pdev->dev), aud2htx); in fsl_aud2htx_probe()
217 dev_err(&pdev->dev, "failed to claim irq %u: %d\n", irq, ret); in fsl_aud2htx_probe()
221 aud2htx->bus_clk = devm_clk_get(&pdev->dev, "bus"); in fsl_aud2htx_probe()
222 if (IS_ERR(aud2htx->bus_clk)) { in fsl_aud2htx_probe()
223 dev_err(&pdev->dev, "failed to get mem clock\n"); in fsl_aud2htx_probe()
224 return PTR_ERR(aud2htx->bus_clk); in fsl_aud2htx_probe()
227 aud2htx->dma_params_tx.chan_name = "tx"; in fsl_aud2htx_probe()
228 aud2htx->dma_params_tx.maxburst = AUD2HTX_MAXBURST; in fsl_aud2htx_probe()
229 aud2htx->dma_params_tx.addr = res->start + AUD2HTX_WR; in fsl_aud2htx_probe()
231 platform_set_drvdata(pdev, aud2htx); in fsl_aud2htx_probe()
232 pm_runtime_enable(&pdev->dev); in fsl_aud2htx_probe()
234 regcache_cache_only(aud2htx->regmap, true); in fsl_aud2htx_probe()
240 ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); in fsl_aud2htx_probe()
242 dev_err(&pdev->dev, "failed to pcm register\n"); in fsl_aud2htx_probe()
243 pm_runtime_disable(&pdev->dev); in fsl_aud2htx_probe()
247 ret = devm_snd_soc_register_component(&pdev->dev, in fsl_aud2htx_probe()
251 dev_err(&pdev->dev, "failed to register ASoC DAI\n"); in fsl_aud2htx_probe()
252 pm_runtime_disable(&pdev->dev); in fsl_aud2htx_probe()
261 pm_runtime_disable(&pdev->dev); in fsl_aud2htx_remove()
266 struct fsl_aud2htx *aud2htx = dev_get_drvdata(dev); in fsl_aud2htx_runtime_suspend() local
268 regcache_cache_only(aud2htx->regmap, true); in fsl_aud2htx_runtime_suspend()
269 clk_disable_unprepare(aud2htx->bus_clk); in fsl_aud2htx_runtime_suspend()
276 struct fsl_aud2htx *aud2htx = dev_get_drvdata(dev); in fsl_aud2htx_runtime_resume() local
279 ret = clk_prepare_enable(aud2htx->bus_clk); in fsl_aud2htx_runtime_resume()
283 regcache_cache_only(aud2htx->regmap, false); in fsl_aud2htx_runtime_resume()
284 regcache_mark_dirty(aud2htx->regmap); in fsl_aud2htx_runtime_resume()
285 regcache_sync(aud2htx->regmap); in fsl_aud2htx_runtime_resume()
301 .name = "fsl-aud2htx",
309 MODULE_DESCRIPTION("NXP AUD2HTX driver");