Lines Matching +full:dai +full:- +full:links
1 // SPDX-License-Identifier: GPL-2.0
10 #include "meson-card.h"
29 if (ret && ret != -ENOTSUPP) in meson_card_i2s_set_sysclk()
35 if (ret && ret != -ENOTSUPP) in meson_card_i2s_set_sysclk()
46 struct snd_soc_dai_link *links; in meson_card_reallocate_links() local
49 links = krealloc(priv->card.dai_link, in meson_card_reallocate_links()
50 num_links * sizeof(*priv->card.dai_link), in meson_card_reallocate_links()
52 if (!links) in meson_card_reallocate_links()
55 ldata = krealloc(priv->link_data, in meson_card_reallocate_links()
56 num_links * sizeof(*priv->link_data), in meson_card_reallocate_links()
61 priv->card.dai_link = links; in meson_card_reallocate_links()
62 priv->link_data = ldata; in meson_card_reallocate_links()
63 priv->card.num_links = num_links; in meson_card_reallocate_links()
67 kfree(links); in meson_card_reallocate_links()
69 dev_err(priv->card.dev, "failed to allocate links\n"); in meson_card_reallocate_links()
70 return -ENOMEM; in meson_card_reallocate_links()
84 return -EINVAL; in meson_card_parse_dai()
86 ret = of_parse_phandle_with_args(node, "sound-dai", in meson_card_parse_dai()
87 "#sound-dai-cells", 0, &args); in meson_card_parse_dai()
89 return dev_err_probe(card->dev, ret, "can't parse dai\n"); in meson_card_parse_dai()
102 char *name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s", in meson_card_set_link_name()
103 prefix, node->full_name); in meson_card_set_link_name()
105 return -ENOMEM; in meson_card_set_link_name()
107 link->name = name; in meson_card_set_link_name()
108 link->stream_name = name; in meson_card_set_link_name()
150 dev_err(card->dev, "be link %s has no codec\n", in meson_card_set_be_link()
151 node->full_name); in meson_card_set_be_link()
152 return -EINVAL; in meson_card_set_be_link()
155 codec = devm_kcalloc(card->dev, num_codecs, sizeof(*codec), GFP_KERNEL); in meson_card_set_be_link()
157 return -ENOMEM; in meson_card_set_be_link()
159 link->codecs = codec; in meson_card_set_be_link()
160 link->num_codecs = num_codecs; in meson_card_set_be_link()
163 ret = meson_card_parse_dai(card, np, &codec->of_node, in meson_card_set_be_link()
164 &codec->dai_name); in meson_card_set_be_link()
175 dev_err(card->dev, "error setting %pOFn link name\n", np); in meson_card_set_be_link()
188 codec = devm_kzalloc(card->dev, sizeof(*codec), GFP_KERNEL); in meson_card_set_fe_link()
190 return -ENOMEM; in meson_card_set_fe_link()
192 link->codecs = codec; in meson_card_set_fe_link()
193 link->num_codecs = 1; in meson_card_set_fe_link()
195 link->dynamic = 1; in meson_card_set_fe_link()
196 link->dpcm_merged_format = 1; in meson_card_set_fe_link()
197 link->dpcm_merged_chan = 1; in meson_card_set_fe_link()
198 link->dpcm_merged_rate = 1; in meson_card_set_fe_link()
199 link->codecs->dai_name = "snd-soc-dummy-dai"; in meson_card_set_fe_link()
200 link->codecs->name = "snd-soc-dummy"; in meson_card_set_fe_link()
203 link->dpcm_playback = 1; in meson_card_set_fe_link()
205 link->dpcm_capture = 1; in meson_card_set_fe_link()
214 struct device_node *node = card->dev->of_node; in meson_card_add_links()
220 dev_err(card->dev, "card has no links\n"); in meson_card_add_links()
221 return -EINVAL; in meson_card_add_links()
230 ret = priv->match_data->add_link(card, np, &i); in meson_card_add_links()
248 if (!of_property_read_bool(card->dev->of_node, propname)) in meson_card_parse_of_optional()
257 struct snd_soc_card *card = &priv->card; in meson_card_clean_references()
263 if (card->dai_link) { in meson_card_clean_references()
265 if (link->cpus) in meson_card_clean_references()
266 of_node_put(link->cpus->of_node); in meson_card_clean_references()
268 of_node_put(codec->of_node); in meson_card_clean_references()
272 if (card->aux_dev) { in meson_card_clean_references()
274 of_node_put(aux->dlc.of_node); in meson_card_clean_references()
277 kfree(card->dai_link); in meson_card_clean_references()
278 kfree(priv->link_data); in meson_card_clean_references()
284 struct device *dev = &pdev->dev; in meson_card_probe()
291 return -ENODEV; in meson_card_probe()
296 return -ENOMEM; in meson_card_probe()
299 snd_soc_card_set_drvdata(&priv->card, priv); in meson_card_probe()
301 priv->card.owner = THIS_MODULE; in meson_card_probe()
302 priv->card.dev = dev; in meson_card_probe()
303 priv->card.driver_name = dev->driver->name; in meson_card_probe()
304 priv->match_data = data; in meson_card_probe()
306 ret = snd_soc_of_parse_card_name(&priv->card, "model"); in meson_card_probe()
310 ret = meson_card_parse_of_optional(&priv->card, "audio-routing", in meson_card_probe()
317 ret = meson_card_parse_of_optional(&priv->card, "audio-widgets", in meson_card_probe()
324 ret = meson_card_add_links(&priv->card); in meson_card_probe()
328 ret = snd_soc_of_parse_aux_devs(&priv->card, "audio-aux-devs"); in meson_card_probe()
332 ret = devm_snd_soc_register_card(dev, &priv->card); in meson_card_probe()