Lines Matching +full:enable +full:- +full:lpa
1 // SPDX-License-Identifier: GPL-2.0+
2 // Copyright 2018-2021 NXP
5 #include <linux/clk-provider.h>
18 #include "imx-pcm.h"
44 struct clk *p = rpmsg->mclk, *pll = NULL, *npll = NULL; in fsl_rpmsg_hw_params()
49 while (p && rpmsg->pll8k && rpmsg->pll11k) { in fsl_rpmsg_hw_params()
52 if (clk_is_match(pp, rpmsg->pll8k) || in fsl_rpmsg_hw_params()
53 clk_is_match(pp, rpmsg->pll11k)) { in fsl_rpmsg_hw_params()
62 npll = (do_div(rate, 8000) ? rpmsg->pll11k : rpmsg->pll8k); in fsl_rpmsg_hw_params()
66 dev_warn(dai->dev, "failed to set parent %s: %d\n", in fsl_rpmsg_hw_params()
71 if (!(rpmsg->mclk_streams & BIT(substream->stream))) { in fsl_rpmsg_hw_params()
72 ret = clk_prepare_enable(rpmsg->mclk); in fsl_rpmsg_hw_params()
74 dev_err(dai->dev, "failed to enable mclk: %d\n", ret); in fsl_rpmsg_hw_params()
78 rpmsg->mclk_streams |= BIT(substream->stream); in fsl_rpmsg_hw_params()
89 if (rpmsg->mclk_streams & BIT(substream->stream)) { in fsl_rpmsg_hw_free()
90 clk_disable_unprepare(rpmsg->mclk); in fsl_rpmsg_hw_free()
91 rpmsg->mclk_streams &= ~BIT(substream->stream); in fsl_rpmsg_hw_free()
102 ret = snd_pcm_hw_constraint_list(substream->runtime, 0, in fsl_rpmsg_startup()
117 .stream_name = "CPU-Playback",
124 .stream_name = "CPU-Capture",
137 .name = "fsl-rpmsg",
187 { .compatible = "fsl,imx7ulp-rpmsg-audio", .data = &imx7ulp_data},
188 { .compatible = "fsl,imx8mm-rpmsg-audio", .data = &imx8mm_data},
189 { .compatible = "fsl,imx8mn-rpmsg-audio", .data = &imx8mn_data},
190 { .compatible = "fsl,imx8mp-rpmsg-audio", .data = &imx8mp_data},
191 { .compatible = "fsl,imx8ulp-rpmsg-audio", .data = &imx7ulp_data},
192 { .compatible = "fsl,imx93-rpmsg-audio", .data = &imx93_data},
193 { .compatible = "fsl,imx95-rpmsg-audio", .data = &imx95_data},
200 struct device_node *np = pdev->dev.of_node; in fsl_rpmsg_probe()
206 dai_drv = devm_kzalloc(&pdev->dev, sizeof(struct snd_soc_dai_driver), GFP_KERNEL); in fsl_rpmsg_probe()
208 return -ENOMEM; in fsl_rpmsg_probe()
211 rpmsg = devm_kzalloc(&pdev->dev, sizeof(struct fsl_rpmsg), GFP_KERNEL); in fsl_rpmsg_probe()
213 return -ENOMEM; in fsl_rpmsg_probe()
215 rpmsg->soc_data = of_device_get_match_data(&pdev->dev); in fsl_rpmsg_probe()
217 if (rpmsg->soc_data) { in fsl_rpmsg_probe()
218 dai_drv->playback.rates = rpmsg->soc_data->rates; in fsl_rpmsg_probe()
219 dai_drv->capture.rates = rpmsg->soc_data->rates; in fsl_rpmsg_probe()
220 dai_drv->playback.formats = rpmsg->soc_data->formats; in fsl_rpmsg_probe()
221 dai_drv->capture.formats = rpmsg->soc_data->formats; in fsl_rpmsg_probe()
225 ret = of_property_read_string(np, "fsl,rpmsg-channel-name", &dai_name); in fsl_rpmsg_probe()
227 if (ret == -EINVAL) { in fsl_rpmsg_probe()
228 dai_name = "rpmsg-audio-channel"; in fsl_rpmsg_probe()
230 dev_err(&pdev->dev, "Failed to get rpmsg channel name: %d!\n", ret); in fsl_rpmsg_probe()
234 dai_drv->name = dai_name; in fsl_rpmsg_probe()
236 if (of_property_read_bool(np, "fsl,enable-lpa")) { in fsl_rpmsg_probe()
237 rpmsg->enable_lpa = 1; in fsl_rpmsg_probe()
238 rpmsg->buffer_size = LPA_LARGE_BUFFER_SIZE; in fsl_rpmsg_probe()
240 rpmsg->buffer_size = IMX_DEFAULT_DMABUF_SIZE; in fsl_rpmsg_probe()
244 rpmsg->ipg = devm_clk_get_optional(&pdev->dev, "ipg"); in fsl_rpmsg_probe()
245 if (IS_ERR(rpmsg->ipg)) in fsl_rpmsg_probe()
246 return PTR_ERR(rpmsg->ipg); in fsl_rpmsg_probe()
248 rpmsg->mclk = devm_clk_get_optional(&pdev->dev, "mclk"); in fsl_rpmsg_probe()
249 if (IS_ERR(rpmsg->mclk)) in fsl_rpmsg_probe()
250 return PTR_ERR(rpmsg->mclk); in fsl_rpmsg_probe()
252 rpmsg->dma = devm_clk_get_optional(&pdev->dev, "dma"); in fsl_rpmsg_probe()
253 if (IS_ERR(rpmsg->dma)) in fsl_rpmsg_probe()
254 return PTR_ERR(rpmsg->dma); in fsl_rpmsg_probe()
256 rpmsg->pll8k = devm_clk_get_optional(&pdev->dev, "pll8k"); in fsl_rpmsg_probe()
257 if (IS_ERR(rpmsg->pll8k)) in fsl_rpmsg_probe()
258 return PTR_ERR(rpmsg->pll8k); in fsl_rpmsg_probe()
260 rpmsg->pll11k = devm_clk_get_optional(&pdev->dev, "pll11k"); in fsl_rpmsg_probe()
261 if (IS_ERR(rpmsg->pll11k)) in fsl_rpmsg_probe()
262 return PTR_ERR(rpmsg->pll11k); in fsl_rpmsg_probe()
265 pm_runtime_enable(&pdev->dev); in fsl_rpmsg_probe()
267 ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component, in fsl_rpmsg_probe()
275 pm_runtime_disable(&pdev->dev); in fsl_rpmsg_probe()
283 pm_runtime_disable(&pdev->dev); in fsl_rpmsg_remove()
285 if (rpmsg->card_pdev) in fsl_rpmsg_remove()
286 platform_device_unregister(rpmsg->card_pdev); in fsl_rpmsg_remove()
294 ret = clk_prepare_enable(rpmsg->ipg); in fsl_rpmsg_runtime_resume()
296 dev_err(dev, "failed to enable ipg clock: %d\n", ret); in fsl_rpmsg_runtime_resume()
300 ret = clk_prepare_enable(rpmsg->dma); in fsl_rpmsg_runtime_resume()
302 dev_err(dev, "Failed to enable dma clock %d\n", ret); in fsl_rpmsg_runtime_resume()
309 clk_disable_unprepare(rpmsg->ipg); in fsl_rpmsg_runtime_resume()
318 clk_disable_unprepare(rpmsg->dma); in fsl_rpmsg_runtime_suspend()
319 clk_disable_unprepare(rpmsg->ipg); in fsl_rpmsg_runtime_suspend()