Lines Matching +full:enable +full:- +full:lpa

1 // SPDX-License-Identifier: GPL-2.0+
2 // Copyright 2017-2020 NXP
14 #include <sound/soc-dapm.h>
15 #include "imx-pcm-rpmsg.h"
21 bool lpa; member
36 struct snd_soc_pcm_runtime *rtd = list_first_entry(&card->rtd_list, in imx_rpmsg_late_probe()
39 struct device *dev = card->dev; in imx_rpmsg_late_probe()
42 if (data->lpa) { in imx_rpmsg_late_probe()
48 codec_np = data->dai.codecs->of_node; in imx_rpmsg_late_probe()
55 codec_dev = &codec_i2c->dev; in imx_rpmsg_late_probe()
59 codec_dev = &codec_pdev->dev; in imx_rpmsg_late_probe()
69 num_widgets = of_property_count_strings(data->card.dev->of_node, in imx_rpmsg_late_probe()
70 "ignore-suspend-widgets"); in imx_rpmsg_late_probe()
72 of_property_read_string_index(data->card.dev->of_node, in imx_rpmsg_late_probe()
73 "ignore-suspend-widgets", in imx_rpmsg_late_probe()
79 codec_drv = codec_dev->driver; in imx_rpmsg_late_probe()
80 if (codec_drv->pm) { in imx_rpmsg_late_probe()
81 memcpy(&lpa_pm, codec_drv->pm, sizeof(lpa_pm)); in imx_rpmsg_late_probe()
88 codec_drv->pm = &lpa_pm; in imx_rpmsg_late_probe()
94 if (!data->sysclk) in imx_rpmsg_late_probe()
97 ret = snd_soc_dai_set_sysclk(codec_dai, 0, data->sysclk, SND_SOC_CLOCK_IN); in imx_rpmsg_late_probe()
98 if (ret && ret != -ENOTSUPP) { in imx_rpmsg_late_probe()
116 dlc = devm_kzalloc(&pdev->dev, 3 * sizeof(*dlc), GFP_KERNEL); in imx_rpmsg_probe()
118 return -ENOMEM; in imx_rpmsg_probe()
120 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); in imx_rpmsg_probe()
122 ret = -ENOMEM; in imx_rpmsg_probe()
126 data->dai.cpus = &dlc[0]; in imx_rpmsg_probe()
127 data->dai.num_cpus = 1; in imx_rpmsg_probe()
128 data->dai.platforms = &dlc[1]; in imx_rpmsg_probe()
129 data->dai.num_platforms = 1; in imx_rpmsg_probe()
130 data->dai.codecs = &dlc[2]; in imx_rpmsg_probe()
131 data->dai.num_codecs = 1; in imx_rpmsg_probe()
133 data->dai.name = "rpmsg hifi"; in imx_rpmsg_probe()
134 data->dai.stream_name = "rpmsg hifi"; in imx_rpmsg_probe()
135 data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | in imx_rpmsg_probe()
145 data->dai.ignore_pmdown_time = 1; in imx_rpmsg_probe()
147 data->dai.cpus->dai_name = pdev->dev.platform_data; in imx_rpmsg_probe()
148 cpu_dai = snd_soc_find_dai(data->dai.cpus); in imx_rpmsg_probe()
150 ret = -EPROBE_DEFER; in imx_rpmsg_probe()
153 np = cpu_dai->dev->of_node; in imx_rpmsg_probe()
155 dev_err(&pdev->dev, "failed to parse CPU DAI device node\n"); in imx_rpmsg_probe()
156 ret = -ENODEV; in imx_rpmsg_probe()
160 ret = of_reserved_mem_device_init_by_idx(&pdev->dev, np, 0); in imx_rpmsg_probe()
162 dev_warn(&pdev->dev, "no reserved DMA memory\n"); in imx_rpmsg_probe()
165 ret = of_parse_phandle_with_fixed_args(np, "audio-codec", 0, 0, &args); in imx_rpmsg_probe()
167 *data->dai.codecs = snd_soc_dummy_dlc; in imx_rpmsg_probe()
171 ret = snd_soc_get_dlc(&args, data->dai.codecs); in imx_rpmsg_probe()
173 dev_err(&pdev->dev, "Unable to get codec_dai_name\n"); in imx_rpmsg_probe()
177 clk = devm_get_clk_from_child(&pdev->dev, args.np, NULL); in imx_rpmsg_probe()
179 data->sysclk = clk_get_rate(clk); in imx_rpmsg_probe()
182 if (!of_property_read_string(np, "fsl,rpmsg-channel-name", &platform_name)) in imx_rpmsg_probe()
183 data->dai.platforms->name = platform_name; in imx_rpmsg_probe()
185 data->dai.platforms->name = "rpmsg-audio-channel"; in imx_rpmsg_probe()
186 data->dai.playback_only = true; in imx_rpmsg_probe()
187 data->dai.capture_only = true; in imx_rpmsg_probe()
188 data->card.num_links = 1; in imx_rpmsg_probe()
189 data->card.dai_link = &data->dai; in imx_rpmsg_probe()
191 if (of_property_read_bool(np, "fsl,rpmsg-out")) in imx_rpmsg_probe()
192 data->dai.capture_only = false; in imx_rpmsg_probe()
194 if (of_property_read_bool(np, "fsl,rpmsg-in")) in imx_rpmsg_probe()
195 data->dai.playback_only = false; in imx_rpmsg_probe()
197 if (data->dai.playback_only && data->dai.capture_only) { in imx_rpmsg_probe()
198 dev_err(&pdev->dev, "no enabled rpmsg DAI link\n"); in imx_rpmsg_probe()
199 ret = -EINVAL; in imx_rpmsg_probe()
203 if (of_property_read_bool(np, "fsl,enable-lpa")) in imx_rpmsg_probe()
204 data->lpa = true; in imx_rpmsg_probe()
206 data->card.dev = &pdev->dev; in imx_rpmsg_probe()
207 data->card.owner = THIS_MODULE; in imx_rpmsg_probe()
208 data->card.dapm_widgets = imx_rpmsg_dapm_widgets; in imx_rpmsg_probe()
209 data->card.num_dapm_widgets = ARRAY_SIZE(imx_rpmsg_dapm_widgets); in imx_rpmsg_probe()
210 data->card.late_probe = imx_rpmsg_late_probe; in imx_rpmsg_probe()
215 data->card.dev->of_node = np; in imx_rpmsg_probe()
217 ret = snd_soc_of_parse_card_name(&data->card, "model"); in imx_rpmsg_probe()
221 if (of_property_read_bool(np, "audio-routing")) { in imx_rpmsg_probe()
222 ret = snd_soc_of_parse_audio_routing(&data->card, "audio-routing"); in imx_rpmsg_probe()
224 dev_err(&pdev->dev, "failed to parse audio-routing: %d\n", ret); in imx_rpmsg_probe()
229 platform_set_drvdata(pdev, &data->card); in imx_rpmsg_probe()
230 snd_soc_card_set_drvdata(&data->card, data); in imx_rpmsg_probe()
231 ret = devm_snd_soc_register_card(&pdev->dev, &data->card); in imx_rpmsg_probe()
233 dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n"); in imx_rpmsg_probe()
238 pdev->dev.of_node = NULL; in imx_rpmsg_probe()
244 .name = "imx-audio-rpmsg",
253 MODULE_ALIAS("platform:imx-audio-rpmsg");