Lines Matching +full:imx8mp +full:- +full:aud2htx
1 // SPDX-License-Identifier: GPL-2.0+
5 #include <linux/clk-provider.h>
19 #include <linux/dma-mapping.h>
22 #include "imx-pcm.h"
27 struct fsl_aud2htx *aud2htx = snd_soc_dai_get_drvdata(dai); in fsl_aud2htx_trigger() local
33 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL, in fsl_aud2htx_trigger()
35 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_trigger()
41 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_trigger()
43 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL, in fsl_aud2htx_trigger()
47 return -EINVAL; in fsl_aud2htx_trigger()
54 struct fsl_aud2htx *aud2htx = dev_get_drvdata(cpu_dai->dev); in fsl_aud2htx_dai_probe() local
57 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_dai_probe()
61 regmap_update_bits(aud2htx->regmap, AUD2HTX_IRQ_MASK, in fsl_aud2htx_dai_probe()
70 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_dai_probe()
73 regmap_update_bits(aud2htx->regmap, AUD2HTX_CTRL_EXT, in fsl_aud2htx_dai_probe()
77 snd_soc_dai_init_dma_data(cpu_dai, &aud2htx->dma_params_tx, in fsl_aud2htx_dai_probe()
78 &aud2htx->dma_params_rx); in fsl_aud2htx_dai_probe()
90 .stream_name = "CPU-Playback",
106 .name = "fsl-aud2htx",
177 { .compatible = "fsl,imx8mp-aud2htx",},
189 struct fsl_aud2htx *aud2htx; in fsl_aud2htx_probe() local
194 aud2htx = devm_kzalloc(&pdev->dev, sizeof(*aud2htx), GFP_KERNEL); in fsl_aud2htx_probe()
195 if (!aud2htx) in fsl_aud2htx_probe()
196 return -ENOMEM; in fsl_aud2htx_probe()
198 aud2htx->pdev = pdev; in fsl_aud2htx_probe()
204 aud2htx->regmap = devm_regmap_init_mmio(&pdev->dev, regs, in fsl_aud2htx_probe()
206 if (IS_ERR(aud2htx->regmap)) { in fsl_aud2htx_probe()
207 dev_err(&pdev->dev, "failed to init regmap"); in fsl_aud2htx_probe()
208 return PTR_ERR(aud2htx->regmap); in fsl_aud2htx_probe()
215 ret = devm_request_irq(&pdev->dev, irq, fsl_aud2htx_isr, 0, in fsl_aud2htx_probe()
216 dev_name(&pdev->dev), aud2htx); in fsl_aud2htx_probe()
218 dev_err(&pdev->dev, "failed to claim irq %u: %d\n", irq, ret); in fsl_aud2htx_probe()
222 aud2htx->bus_clk = devm_clk_get(&pdev->dev, "bus"); in fsl_aud2htx_probe()
223 if (IS_ERR(aud2htx->bus_clk)) { in fsl_aud2htx_probe()
224 dev_err(&pdev->dev, "failed to get mem clock\n"); in fsl_aud2htx_probe()
225 return PTR_ERR(aud2htx->bus_clk); in fsl_aud2htx_probe()
228 aud2htx->dma_params_tx.chan_name = "tx"; in fsl_aud2htx_probe()
229 aud2htx->dma_params_tx.maxburst = AUD2HTX_MAXBURST; in fsl_aud2htx_probe()
230 aud2htx->dma_params_tx.addr = res->start + AUD2HTX_WR; in fsl_aud2htx_probe()
232 platform_set_drvdata(pdev, aud2htx); in fsl_aud2htx_probe()
233 pm_runtime_enable(&pdev->dev); in fsl_aud2htx_probe()
235 regcache_cache_only(aud2htx->regmap, true); in fsl_aud2htx_probe()
241 ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0); in fsl_aud2htx_probe()
243 dev_err(&pdev->dev, "failed to pcm register\n"); in fsl_aud2htx_probe()
244 pm_runtime_disable(&pdev->dev); in fsl_aud2htx_probe()
248 ret = devm_snd_soc_register_component(&pdev->dev, in fsl_aud2htx_probe()
252 dev_err(&pdev->dev, "failed to register ASoC DAI\n"); in fsl_aud2htx_probe()
253 pm_runtime_disable(&pdev->dev); in fsl_aud2htx_probe()
262 pm_runtime_disable(&pdev->dev); in fsl_aud2htx_remove()
267 struct fsl_aud2htx *aud2htx = dev_get_drvdata(dev); in fsl_aud2htx_runtime_suspend() local
269 regcache_cache_only(aud2htx->regmap, true); in fsl_aud2htx_runtime_suspend()
270 clk_disable_unprepare(aud2htx->bus_clk); in fsl_aud2htx_runtime_suspend()
277 struct fsl_aud2htx *aud2htx = dev_get_drvdata(dev); in fsl_aud2htx_runtime_resume() local
280 ret = clk_prepare_enable(aud2htx->bus_clk); in fsl_aud2htx_runtime_resume()
284 regcache_cache_only(aud2htx->regmap, false); in fsl_aud2htx_runtime_resume()
285 regcache_mark_dirty(aud2htx->regmap); in fsl_aud2htx_runtime_resume()
286 regcache_sync(aud2htx->regmap); in fsl_aud2htx_runtime_resume()
303 .name = "fsl-aud2htx",
311 MODULE_DESCRIPTION("NXP AUD2HTX driver");